Releases: victools/jsonschema-generator
Releases · victools/jsonschema-generator
4.12.2 – Performance and Maven Plugin Package Resolution Fix
jsonschema-generator
Fixed
- Performance: Cache looked-up getter in
FieldScope.findGetter()
- Performance: Cache looked-up field in
MethodScope.findGetterField()
jsonschema-maven-plugin
Fixed
- Collecting all classes from a given
<packageName>
even if it contains classes whose supertypes are not included
4.12.1 – Maven Plugin Classpath Fix
jsonschema-maven-plugin
Fixed
- Setting correct contextual classpath for class/package look-up via reflections
4.12.0 – Sortable Properties and support of @JsonNaming annotations
jsonschema-generator
Added
- New
SchemaGeneratorGeneralConfigPart.withPropertySorter()
exposing the sorting logic of an object schema's properties
jsonschema-module-jackson
Added
- New
JacksonOption.RESPECT_JSONPROPERTY_ORDER
to sort properties in an object's schema based on@JsonPropertyOrder
annotations - New
JacksonOption.IGNORE_PROPERTY_NAMING_STRATEGY
to skip the adjustment of property names based on@JsonNaming
annotations
Changed
- Consider
@JsonNaming
annotations to alter the names of contained fields according to the specifiedPropertyNamingStrategy
4.11.1 – Maven Plugin Dependency Resolution Fix
4.11.0 – Maven Plugin and Preparation for OpenAPI 3.1
jsonschema-generator
Added
- New
Option.MAP_VALUES_AS_ADDITIONAL_PROPERTIES
to includeadditionalProperties
with a schema for eachMap<K, V>
's value typeV
- New
Option.DEFINITION_FOR_MAIN_SCHEMA
to allow moving main/target schema intodefinitions
/$defs
- New
Option.PLAIN_DEFINITION_KEYS
to ensure keys indefinitions
/$defs
adhere to the reduced set of allowed characters expected by OpenAPI - New
SchemaGenerator.buildMultipleSchemaDefinitions()
allowing to generate JSON Schema elements (e.g. for building an OpenAPI description)
Fixed
- Skip fields for which
isFakeContainerItemScope()
returnstrue
, when fulfilling value collection forOption.VALUES_FROM_CONSTANT_FIELDS
- Treat
Byte
/byte
as"type": "string"
and not as"type": "integer"
by default
jsonschema-maven-plugin
Added
- Initial implementation
- Support schema generation from one or multiple classes
- Support schema generation for all classes in one or multiple packages
- Allow configuration of target schema version
- Allow configuration of
OptionPreset
(also allowing forNONE
) - Allow configuration of individual
Option
s to be enabled/disabled - Allow configuration of standard modules by name, with possible list of module options
- Allow configuration of custom modules by class name
4.10.0 – Draft 6, Inline Option and enum via @JsonProperty
jsonschema-generator
Added
- Official support for Draft 6 (via new
SchemaVersion.DRAFT_6
) - New
Option.INLINE_ALL_SCHEMAS
to enforce nodefinitions
/$defs
to be produced (throwing exception if there is at least one circular reference) - Offering also
SchemaGenerationContext.createStandardDefinition(FieldScope, CustomPropertyDefinitionProvider)
- Offering also
SchemaGenerationContext.createStandardDefinition(MethodScope, CustomPropertyDefinitionProvider)
- Alternative
SchemaGenerationConfigPart.withInstanceAttributeOverride(InstanceAttributeOverrideV2)
with access toSchemaGenerationContext
Changed
- Enhance
Option.ALLOF_CLEANUP_AT_THE_END
to also reduceallOf
if multiple parts have the same attributes but with equal values (except forif
tags) - Providing access to the
SchemaGenerationContext
when invokingTypeAttributeOverrideV2
(potentially BREAKING change in case of lambda usage)
Deprecated
SchemaGenerationConfigPart.withInstanceAttributeOverride(InstanceAttributeOverride)
without access toSchemaGenerationContext
InstanceAttributeOverride
interface without access toSchemaGenerationContext
TypeAttributeOverride
interface with only access toSchemaGenerationConfig
and notSchemaGenerationContext
- Ambiguous
SchemaGeneratorConfigBuilder.with(CustomDefinitionProviderV2)
- Ambiguous and outdated
SchemaGeneratorConfigBuilder.with(TypeAttributeOverride)
jsonschema-module-jackson
Added
- New
JacksonOption.FLATTENED_ENUMS_FROM_JSONPROPERTY
to allow enum serialization based on each constant's@JsonProperty
value
4.9.0 – First Level Container Item Annotations
jsonschema-generator
Added
- Convenience constructors on
SchemaGeneratorConfigBuilder
without explicitObjectMapper
instance being expected - Convenience methods on
FieldScope
/MethodScope
for accessing (first level) container item annotations:getContainerItemAnnotation()
andgetContainerItemAnnotationConsideringFieldAndGetter()
Changed
MethodScope.getAnnotation()
now also considers annotations directly on return type (when no matching annotation was found on the method itself)
Fixed
- Attributes set in custom property definitions should not be overridden by other configurations (except for explicit attribute overrides)
jsonschema-module-javax-validation
Changed
- Consider (first level) container item annotations (e.g.
List<@Size(min = 3) String>
)
4.8.1 – Release and Swagger Module Fix
All
Fixed
- Include parent
pom.xml
when publishing release
jsonschema-module-swagger-1.5
Fixed
- Error when encountering container/collection property
4.8.0 - Enhanced Subtype Resolution (especially via Jackson module)
jsonschema-generator
Added
- Support for custom definitions in the scope of a particular field/method via
SchemaGeneratorConfigPart.withCustomDefinitionProvider()
- Ability to opt-out of normal "attribute collection" for custom definitions through new
CustomDefinition
constructor parameters
Changed
- Consolidate
anyOf
entries that only contain ananyOf
themselves into the outeranyOf
(mostly relevant for nullable entries with subtypes) - If a field/method is of a container type: apply the per-property configurations on its items; with
MemberScope.isFakeContainerItemScope()
flag
Fixed
- Should consider per-type attributes even on inline custom definitions
- Use less strict
anyOf
instead ofoneOf
when indicating that a sub-schema may be of"type": "null"
Dependency Update
com.fasterxml.jackson.core
:jackson-core
/jackson-databind
from2.10.2
to2.10.3
- Remove dependencies to
log4j
implementation (onlyslf4j-api
remains)
jsonschema-module-jackson
Added
- Look-up subtypes according to
@JsonTypeInfo
and@JsonSubTypes
annotations per-type or overridden per-property:- Considering
@JsonTypeInfo.include
with valuesAs.PROPERTY
,As.EXISTING_PROPERTY
,As.WRAPPER_ARRAY
,As.WRAPPER_OBJECT
- Considering
@JsonTypeInfo.use
with valuesId.NAME
(from@JsonTypeName
) andId.CLASS
- Considering
- New
JacksonOption.SKIP_SUBTYPE_LOOKUP
for disabling the new look-up of subtypes (i.e. to regain previous behaviour) if required - New
JacksonOption.IGNORE_TYPE_INFO_TRANSFORM
for disabling addition of extra property or wrapping in an array/object according to@JsonTypeInfo
4.7.0 – Support multiples (target type overrides, types with same name, definitions per type)
Added
- Support for multiple target type overrides at once per field/method
- Support for "$id" property via
SchemaGeneratorGeneralConfigPart.withIdResolver()
- Support for "$anchor" property via
SchemaGeneratorGeneralConfigPart.withAnchorResolver()
Fixed
- Allow for multiple types with the same name (but different package) instead of picking one at random
- Allow for multiple definitions for the same type (e.g. in case of a custom definition wrapping the standard definition)
Deprecated
- Configuration option for single target type override
- Look-up of single target type override from configuration