Skip to content

Commit

Permalink
fix(java): Update to use JsonMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper committed Aug 3, 2023
1 parent 849f2a2 commit 161fbca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions config/clients/java/template/libraries/native/JSON.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public class JSON {
private ObjectMapper mapper;
public JSON() {
mapper = new ObjectMapper();
mapper = JsonMapper.builder()
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
.build();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
Expand Down

0 comments on commit 161fbca

Please sign in to comment.