creek-service / creek-json-schema

Annotations and code for generating JSON schemas from code
Apache License 2.0
6 stars 1 forks source link

Use standard Jackson-compatible subtype names #277

Closed big-andy-coates closed 8 months ago

big-andy-coates commented 8 months ago

...as it just makes things easier and Jackson already provides a way to customise.

Also, add support for JsonTypeInfo.Id.SIMPLE_NAME.

BREAKING CHANGE:

Changing the subtype name in the schema is a breaking change. Regenerating a schema that uses polymorphism using @JsonTypeInfo with uses set to JsonTypeInfo.Id.NAME, but without @JsonSubTypes defined, will result in a different schema being produced.

However, the previously generated schema wasn't compatible with the JSON Jackson would have produced. Where as it now is.

Also, it's possible to annotate subtypes with @JsonTypeName to specify an exact logical name to use in both the schema and in the JSON.

coveralls commented 8 months ago

Coverage Status

coverage: 93.511% (-0.4%) from 93.87% when pulling 02dde461decca81949101056a705d436d36bb790 on standard_sub_names into 3314fcc41b93dac3d4bee9cdd0e96cd64401299f on main.