Skip to content

Enum serialization bug with jackson-2.7.5 #258

@viruscamp

Description

@viruscamp

I am using this cool lib.
After I update some lib to new versions, I met a bug.

lightadmin-1.2.0.RC1
spring-data-rest-webmvc-2.2.4.RELEASE instead of 2.2.2.RELEASE
jackson-*-2.7.5 instead of 2.4.5

The js request such rest service lightadmin/rest/schoolClasses/metadata
and get this response, which should contains "listView" : { ... },

{
  "name" : "my.package.entity.Student",
  "managed_type" : true,
  ...
  "dynamic_properties" : {
    "LIST_VIEW" : { ... },
    "FORM_VIEW" : { ... }
  }
}

Add a custom serializer for DomainConfigurationUnitType to resolve it.
Or configure jackson ObjectMapper like this.
org.lightadmin.core.config.context.LightAdminRepositoryRestMvcConfiguration.configureJacksonObjectMapper

protected void configureJacksonObjectMapper(ObjectMapper objectMapper) {
    objectMapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true);
    objectMapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);
    objectMapper.registerModule(new LightAdminJacksonModule(globalAdministrationConfiguration()));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions