mirror of https://github.com/halo-dev/halo
Enable mapper feature: accept case-insensitive enums (#3707)
#### What type of PR is this?
/kind improvement
/area core
#### What this PR does / why we need it:
After enabling this mapper feature, we could pass a enum value with any case in request body(JSON format).
See 39fdb63607/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserializationTest.java (L22)
for more.
#### Does this PR introduce a user-facing change?
```release-note
None
```
pull/3727/head
parent
bfe8b3ba58
commit
45313a529e
|
@ -1,6 +1,7 @@
|
|||
package run.halo.app.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -14,6 +15,7 @@ public class HaloConfiguration {
|
|||
Jackson2ObjectMapperBuilderCustomizer objectMapperCustomizer() {
|
||||
return builder -> {
|
||||
builder.serializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
builder.featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue