Interface SchemaGeneratorConfig
-
- All Known Implementing Classes:
SchemaGeneratorConfigImpl
public interface SchemaGeneratorConfig
Default implementation of a schema generator's configuration.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.fasterxml.jackson.databind.node.ArrayNode
createArrayNode()
Generate an empty JSON node representing an array (which will subsequently be filled by the generator).com.fasterxml.jackson.databind.node.ObjectNode
createObjectNode()
Generate an empty JSON node representing an object (which will subsequently be filled by the generator).CustomDefinition
getCustomDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context, CustomDefinitionProviderV2 ignoredDefinitionProvider)
Look-up the non-standard JSON schema definition for a given type.List<InstanceAttributeOverride<FieldScope>>
getFieldAttributeOverrides()
Getter for the applicable instance attribute overrides for fields.List<InstanceAttributeOverride<MethodScope>>
getMethodAttributeOverrides()
Getter for the applicable instance attribute overrides for methods.com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
Getter for the underlying object mapper.List<TypeAttributeOverride>
getTypeAttributeOverrides()
Getter for the applicable type attribute overrides.boolean
isNullable(FieldScope field)
Check whether a field/property is nullable.boolean
isNullable(MethodScope method)
Check whether a method's return value is nullable.boolean
isRequired(FieldScope field)
Check whether a field/property value is required.boolean
isRequired(MethodScope method)
Check whether a method value is required.Integer
resolveArrayMaxItems(FieldScope field)
Determine the "maxItems" of an object's field/property.Integer
resolveArrayMaxItems(MethodScope method)
Determine the "maxItems" of a method's return value.Integer
resolveArrayMinItems(FieldScope field)
Determine the "minItems" of an object's field/property.Integer
resolveArrayMinItems(MethodScope method)
Determine the "minItems" of a method's return value.Boolean
resolveArrayUniqueItems(FieldScope field)
Determine the "uniqueItems" of an object's field/property.Boolean
resolveArrayUniqueItems(MethodScope method)
Determine the "uniqueItems" of a method's return value.Object
resolveDefault(FieldScope field)
Determine the "default" value of an object's field/property.Object
resolveDefault(MethodScope method)
Determine the "default" value of a method's return value.String
resolveDescription(FieldScope field)
Determine the "description" of an object's field/property.String
resolveDescription(MethodScope method)
Determine the "description" of a method's return value.Collection<?>
resolveEnum(FieldScope field)
Determine the "enum"/"const" of an object's field/property.Collection<?>
resolveEnum(MethodScope method)
Determine the "enum"/"const" of a method's return value.BigDecimal
resolveNumberExclusiveMaximum(FieldScope field)
Determine the "exclusiveMaximum" of an object's field/property.BigDecimal
resolveNumberExclusiveMaximum(MethodScope method)
Determine the "exclusiveMaximum" of a method's return value.BigDecimal
resolveNumberExclusiveMinimum(FieldScope field)
Determine the "exclusiveMinimum" of an object's field/property.BigDecimal
resolveNumberExclusiveMinimum(MethodScope method)
Determine the "exclusiveMinimum" of a method's return value.BigDecimal
resolveNumberInclusiveMaximum(FieldScope field)
Determine the "maximum" of an object's field/property.BigDecimal
resolveNumberInclusiveMaximum(MethodScope method)
Determine the "maximum" of a method's return value.BigDecimal
resolveNumberInclusiveMinimum(FieldScope field)
Determine the "minimum" of an object's field/property.BigDecimal
resolveNumberInclusiveMinimum(MethodScope method)
Determine the "minimum" of a method's return value.BigDecimal
resolveNumberMultipleOf(FieldScope field)
Determine the "multipleOf" of an object's field/property.BigDecimal
resolveNumberMultipleOf(MethodScope method)
Determine the "multipleOf" of a method's return value.String
resolvePropertyNameOverride(FieldScope field)
Determine the alternative name in a parent JSON Schema's "properties" from an object's field/property.String
resolvePropertyNameOverride(MethodScope method)
Determine the alternative name in a parent JSON Schema's "properties" from a method's return value.String
resolveStringFormat(FieldScope field)
Determine the "format" of an object's field/property.String
resolveStringFormat(MethodScope method)
Determine the "format" of a method's return value.Integer
resolveStringMaxLength(FieldScope field)
Determine the "maxLength" of an object's field/property.Integer
resolveStringMaxLength(MethodScope method)
Determine the "maxLength" of a method's return value.Integer
resolveStringMinLength(FieldScope field)
Determine the "minLength" of an object's field/property.Integer
resolveStringMinLength(MethodScope method)
Determine the "minLength" of a method's return value.String
resolveStringPattern(FieldScope field)
Determine the "pattern" of an object's field/property.String
resolveStringPattern(MethodScope method)
Determine the "pattern" of a method's return value.com.fasterxml.classmate.ResolvedType
resolveTargetTypeOverride(FieldScope field)
Determine the alternative target type from an object's field/property.com.fasterxml.classmate.ResolvedType
resolveTargetTypeOverride(MethodScope method)
Determine the alternative target type from a method's return value.String
resolveTitle(FieldScope field)
Determine the "title" of an object's field/property.String
resolveTitle(MethodScope method)
Determine the "title" of a method's return value.boolean
shouldCreateDefinitionsForAllObjects()
Determine whether all referenced objects should be listed in the schema's "definitions", even if they only occur once.boolean
shouldIgnore(FieldScope field)
Check whether a field/property should be ignored.boolean
shouldIgnore(MethodScope method)
Check whether a method should be ignored.boolean
shouldIncludeSchemaVersionIndicator()
Determine whether the ""$schema"" attribute with value ""http://json-schema.org/draft-07/schema#"" should be added.boolean
shouldIncludeStaticFields()
Determine whether static fields should be included in the generated schema.boolean
shouldIncludeStaticMethods()
Determine whether static methods should be included in the generated schema.
-
-
-
Method Detail
-
shouldCreateDefinitionsForAllObjects
boolean shouldCreateDefinitionsForAllObjects()
Determine whether all referenced objects should be listed in the schema's "definitions", even if they only occur once.- Returns:
- whether to add a definition even for objects occurring only once
-
shouldIncludeSchemaVersionIndicator
boolean shouldIncludeSchemaVersionIndicator()
Determine whether the ""$schema"" attribute with value ""http://json-schema.org/draft-07/schema#"" should be added.- Returns:
- whether to add the schema version attribute
-
shouldIncludeStaticFields
boolean shouldIncludeStaticFields()
Determine whether static fields should be included in the generated schema.- Returns:
- whether to include static fields
-
shouldIncludeStaticMethods
boolean shouldIncludeStaticMethods()
Determine whether static methods should be included in the generated schema.- Returns:
- whether to included static methods
-
getObjectMapper
com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Getter for the underlying object mapper.- Returns:
- object mapper being used for generating JSON Schema structure
-
createObjectNode
com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()
Generate an empty JSON node representing an object (which will subsequently be filled by the generator).
This is equivalent to callinggetObjectMapper().createObjectNode()
- Returns:
- JSON object node
-
createArrayNode
com.fasterxml.jackson.databind.node.ArrayNode createArrayNode()
Generate an empty JSON node representing an array (which will subsequently be filled by the generator).
This is equivalent to callinggetObjectMapper().createArrayNode()
- Returns:
- JSON array node
-
getCustomDefinition
CustomDefinition getCustomDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context, CustomDefinitionProviderV2 ignoredDefinitionProvider)
Look-up the non-standard JSON schema definition for a given type. If this returns null, the standard behaviour is expected to be applied.- Parameters:
javaType
- generic type to provide custom definition forcontext
- generation context allowing to let the standard generation take over nested parts of the custom definitionignoredDefinitionProvider
- custom definition provider to ignore- Returns:
- non-standard JSON schema definition (may be null)
-
getTypeAttributeOverrides
List<TypeAttributeOverride> getTypeAttributeOverrides()
Getter for the applicable type attribute overrides.- Returns:
- overrides of a given JSON Schema node's type attributes
-
getFieldAttributeOverrides
List<InstanceAttributeOverride<FieldScope>> getFieldAttributeOverrides()
Getter for the applicable instance attribute overrides for fields.- Returns:
- overrides of a given JSON Schema node's instance attributes
-
getMethodAttributeOverrides
List<InstanceAttributeOverride<MethodScope>> getMethodAttributeOverrides()
Getter for the applicable instance attribute overrides for methods.- Returns:
- overrides of a given JSON Schema node's instance attributes
-
isNullable
boolean isNullable(FieldScope field)
Check whether a field/property is nullable.- Parameters:
field
- object's field/property to check- Returns:
- whether the field/property is nullable
-
isNullable
boolean isNullable(MethodScope method)
Check whether a method's return value is nullable.- Parameters:
method
- method to check- Returns:
- whether the method's return value is nullable
-
isRequired
boolean isRequired(FieldScope field)
Check whether a field/property value is required.- Parameters:
field
- object's field/property to check- Returns:
- whether the field/property value should be required
-
isRequired
boolean isRequired(MethodScope method)
Check whether a method value is required.- Parameters:
method
- method to check- Returns:
- whether the method value should be required
-
shouldIgnore
boolean shouldIgnore(FieldScope field)
Check whether a field/property should be ignored.- Parameters:
field
- object's field/property to check- Returns:
- whether the field/property should be ignored
-
shouldIgnore
boolean shouldIgnore(MethodScope method)
Check whether a method should be ignored.- Parameters:
method
- method to check- Returns:
- whether the method should be ignored
-
resolveTargetTypeOverride
com.fasterxml.classmate.ResolvedType resolveTargetTypeOverride(FieldScope field)
Determine the alternative target type from an object's field/property.- Parameters:
field
- object's field/property to determine the target type for- Returns:
- target type (may be null)
-
resolveTargetTypeOverride
com.fasterxml.classmate.ResolvedType resolveTargetTypeOverride(MethodScope method)
Determine the alternative target type from a method's return value.- Parameters:
method
- method for whose return value to determine the target type for- Returns:
- target type (may be null)
-
resolvePropertyNameOverride
String resolvePropertyNameOverride(FieldScope field)
Determine the alternative name in a parent JSON Schema's "properties" from an object's field/property.- Parameters:
field
- object's field/property to determine name in parent JSON Schema's properties for- Returns:
- name in a parent JSON Schema's "properties" (may be null, thereby falling back on the default value)
-
resolvePropertyNameOverride
String resolvePropertyNameOverride(MethodScope method)
Determine the alternative name in a parent JSON Schema's "properties" from a method's return value.- Parameters:
method
- method for whose return value to determine name in parent JSON Schema's properties for- Returns:
- name in a parent JSON Schema's "properties" (may be null, thereby falling back on the default value)
-
resolveTitle
String resolveTitle(FieldScope field)
Determine the "title" of an object's field/property.- Parameters:
field
- object's field/property to determine "title" value for- Returns:
- "title" in a JSON Schema (may be null)
-
resolveTitle
String resolveTitle(MethodScope method)
Determine the "title" of a method's return value.- Parameters:
method
- method for whose return value to determine "title" value for- Returns:
- "title" in a JSON Schema (may be null)
-
resolveDescription
String resolveDescription(FieldScope field)
Determine the "description" of an object's field/property.- Parameters:
field
- object's field/property to determine "description" value for- Returns:
- "description" in a JSON Schema (may be null)
-
resolveDescription
String resolveDescription(MethodScope method)
Determine the "description" of a method's return value.- Parameters:
method
- method for whose return value to determine "description" value for- Returns:
- "description" in a JSON Schema (may be null)
-
resolveDefault
Object resolveDefault(MethodScope method)
Determine the "default" value of a method's return value.- Parameters:
method
- method for whose return value to determine "default" value for- Returns:
- "default" in a JSON Schema (may be null)
-
resolveDefault
Object resolveDefault(FieldScope field)
Determine the "default" value of an object's field/property.- Parameters:
field
- object's field/property to determine "default" value for- Returns:
- "default" in a JSON Schema (may be null)
-
resolveEnum
Collection<?> resolveEnum(FieldScope field)
Determine the "enum"/"const" of an object's field/property.- Parameters:
field
- object's field/property to determine "enum"/"const" value for- Returns:
- "enum"/"const" in a JSON Schema (may be null)
-
resolveEnum
Collection<?> resolveEnum(MethodScope method)
Determine the "enum"/"const" of a method's return value.- Parameters:
method
- method for whose return value to determine "enum"/"const" value for- Returns:
- "enum"/"const" in a JSON Schema (may be null)
-
resolveStringMinLength
Integer resolveStringMinLength(FieldScope field)
Determine the "minLength" of an object's field/property.- Parameters:
field
- object's field/property to determine "minLength" value for- Returns:
- "minLength" in a JSON Schema (may be null)
-
resolveStringMinLength
Integer resolveStringMinLength(MethodScope method)
Determine the "minLength" of a method's return value.- Parameters:
method
- method for whose return value to determine "minLength" value for- Returns:
- "minLength" in a JSON Schema (may be null)
-
resolveStringMaxLength
Integer resolveStringMaxLength(FieldScope field)
Determine the "maxLength" of an object's field/property.- Parameters:
field
- object's field/property to determine "maxLength" value for- Returns:
- "maxLength" in a JSON Schema (may be null)
-
resolveStringMaxLength
Integer resolveStringMaxLength(MethodScope method)
Determine the "maxLength" of a method's return value.- Parameters:
method
- method for whose return value to determine "maxLength" value for- Returns:
- "maxLength" in a JSON Schema (may be null)
-
resolveStringFormat
String resolveStringFormat(FieldScope field)
Determine the "format" of an object's field/property.- Parameters:
field
- object's field/property to determine "format" value for- Returns:
- "format" in a JSON Schema (may be null)
-
resolveStringFormat
String resolveStringFormat(MethodScope method)
Determine the "format" of a method's return value.- Parameters:
method
- method for whose return value to determine "format" value for- Returns:
- "format" in a JSON Schema (may be null)
-
resolveStringPattern
String resolveStringPattern(FieldScope field)
Determine the "pattern" of an object's field/property.- Parameters:
field
- object's field/property to determine "pattern" value for- Returns:
- "pattern" in a JSON Schema (may be null)
-
resolveStringPattern
String resolveStringPattern(MethodScope method)
Determine the "pattern" of a method's return value.- Parameters:
method
- method for whose return value to determine "pattern" value for- Returns:
- "pattern" in a JSON Schema (may be null)
-
resolveNumberInclusiveMinimum
BigDecimal resolveNumberInclusiveMinimum(FieldScope field)
Determine the "minimum" of an object's field/property.- Parameters:
field
- object's field/property to determine "minimum" value for- Returns:
- "minimum" in a JSON Schema (may be null)
-
resolveNumberInclusiveMinimum
BigDecimal resolveNumberInclusiveMinimum(MethodScope method)
Determine the "minimum" of a method's return value.- Parameters:
method
- method for whose return value to determine "minimum" value for- Returns:
- "minimum" in a JSON Schema (may be null)
-
resolveNumberExclusiveMinimum
BigDecimal resolveNumberExclusiveMinimum(FieldScope field)
Determine the "exclusiveMinimum" of an object's field/property.- Parameters:
field
- object's field/property to determine "exclusiveMinimum" value for- Returns:
- "exclusiveMinimum" in a JSON Schema (may be null)
-
resolveNumberExclusiveMinimum
BigDecimal resolveNumberExclusiveMinimum(MethodScope method)
Determine the "exclusiveMinimum" of a method's return value.- Parameters:
method
- method for whose return value to determine "exclusiveMinimum" value for- Returns:
- "exclusiveMinimum" in a JSON Schema (may be null)
-
resolveNumberInclusiveMaximum
BigDecimal resolveNumberInclusiveMaximum(FieldScope field)
Determine the "maximum" of an object's field/property.- Parameters:
field
- object's field/property to determine "maximum" value for- Returns:
- "maximum" in a JSON Schema (may be null)
-
resolveNumberInclusiveMaximum
BigDecimal resolveNumberInclusiveMaximum(MethodScope method)
Determine the "maximum" of a method's return value.- Parameters:
method
- method for whose return value to determine "maximum" value for- Returns:
- "maximum" in a JSON Schema (may be null)
-
resolveNumberExclusiveMaximum
BigDecimal resolveNumberExclusiveMaximum(FieldScope field)
Determine the "exclusiveMaximum" of an object's field/property.- Parameters:
field
- object's field/property to determine "exclusiveMaximum" value for- Returns:
- "exclusiveMaximum" in a JSON Schema (may be null)
-
resolveNumberExclusiveMaximum
BigDecimal resolveNumberExclusiveMaximum(MethodScope method)
Determine the "exclusiveMaximum" of a method's return value.- Parameters:
method
- method for whose return value to determine "exclusiveMaximum" value for- Returns:
- "exclusiveMaximum" in a JSON Schema (may be null)
-
resolveNumberMultipleOf
BigDecimal resolveNumberMultipleOf(FieldScope field)
Determine the "multipleOf" of an object's field/property.- Parameters:
field
- object's field/property to determine "multipleOf" value for- Returns:
- "multipleOf" in a JSON Schema (may be null)
-
resolveNumberMultipleOf
BigDecimal resolveNumberMultipleOf(MethodScope method)
Determine the "multipleOf" of a method's return value.- Parameters:
method
- method for whose return value to determine "multipleOf" value for- Returns:
- "multipleOf" in a JSON Schema (may be null)
-
resolveArrayMinItems
Integer resolveArrayMinItems(FieldScope field)
Determine the "minItems" of an object's field/property.- Parameters:
field
- object's field/property to determine "minItems" value for- Returns:
- "minItems" in a JSON Schema (may be null)
-
resolveArrayMinItems
Integer resolveArrayMinItems(MethodScope method)
Determine the "minItems" of a method's return value.- Parameters:
method
- method for whose return value to determine "minItems" value for- Returns:
- "minItems" in a JSON Schema (may be null)
-
resolveArrayMaxItems
Integer resolveArrayMaxItems(FieldScope field)
Determine the "maxItems" of an object's field/property.- Parameters:
field
- object's field/property to determine "maxItems" value for- Returns:
- "maxItems" in a JSON Schema (may be null)
-
resolveArrayMaxItems
Integer resolveArrayMaxItems(MethodScope method)
Determine the "maxItems" of a method's return value.- Parameters:
method
- method for whose return value to determine "maxItems" value for- Returns:
- "maxItems" in a JSON Schema (may be null)
-
resolveArrayUniqueItems
Boolean resolveArrayUniqueItems(FieldScope field)
Determine the "uniqueItems" of an object's field/property.- Parameters:
field
- object's field/property to determine "uniqueItems" value for- Returns:
- "uniqueItems" in a JSON Schema (may be null)
-
resolveArrayUniqueItems
Boolean resolveArrayUniqueItems(MethodScope method)
Determine the "uniqueItems" of a method's return value.- Parameters:
method
- method for whose return value to determine "uniqueItems" value for- Returns:
- "uniqueItems" in a JSON Schema (may be null)
-
-