Class SchemaGeneratorGeneralConfigPart
- java.lang.Object
-
- com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart<TypeScope>
-
- com.github.victools.jsonschema.generator.SchemaGeneratorGeneralConfigPart
-
public class SchemaGeneratorGeneralConfigPart extends SchemaGeneratorTypeConfigPart<TypeScope>
Generic collection of reflection based analysis for populating a JSON Schema targeting a specific type in general.
-
-
Constructor Summary
Constructors Constructor Description SchemaGeneratorGeneralConfigPart()
-
Method Summary
-
Methods inherited from class com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart
getFirstDefinedValue, resolveAdditionalProperties, resolveArrayMaxItems, resolveArrayMinItems, resolveArrayUniqueItems, resolveDefault, resolveDescription, resolveEnum, resolveNumberExclusiveMaximum, resolveNumberExclusiveMinimum, resolveNumberInclusiveMaximum, resolveNumberInclusiveMinimum, resolveNumberMultipleOf, resolvePatternProperties, resolveStringFormat, resolveStringMaxLength, resolveStringMinLength, resolveStringPattern, resolveTitle
-
-
-
-
Method Detail
-
withCustomDefinitionProvider
public SchemaGeneratorGeneralConfigPart withCustomDefinitionProvider(CustomDefinitionProviderV2 definitionProvider)
Adding a custom schema provider – if it returns null for a given type, the next definition provider will be applied.
If all custom schema providers return null (or there is none), then the standard behaviour applies.- Parameters:
definitionProvider
- provider of a custom definition to register, which may return null- Returns:
- this builder instance (for chaining)
-
getCustomDefinitionProviders
public List<CustomDefinitionProviderV2> getCustomDefinitionProviders()
Getter for the applicable custom definition provider.- Returns:
- providers for certain custom definitions by-passing the default schema generation to some extent
-
withSubtypeResolver
public SchemaGeneratorGeneralConfigPart withSubtypeResolver(SubtypeResolver subtypeResolver)
Adding a subtype resolver – if it returns null for a given type, the next subtype resolver will be applied.
If all subtype resolvers return null, there is none or a resolver returns an empty list, then the standard behaviour applies.- Parameters:
subtypeResolver
- resolver for looking up a declared type's subtypes in order to list those specifically- Returns:
- this builder instance (for chaining)
-
getSubtypeResolvers
public List<SubtypeResolver> getSubtypeResolvers()
Getter for the applicable subtype resolvers.- Returns:
- registered subtype resolvers
-
withTypeAttributeOverride
public SchemaGeneratorGeneralConfigPart withTypeAttributeOverride(TypeAttributeOverride override)
Adding an override for type attributes – all of the registered overrides will be applied in the order of having been added.- Parameters:
override
- adding/removing attributes on a JSON Schema node – specifically intended for attributes relating to the type in general.- Returns:
- this builder instance (for chaining)
-
getTypeAttributeOverrides
public List<TypeAttributeOverride> getTypeAttributeOverrides()
Getter for the applicable overrides for type attributes.- Returns:
- registered overrides to be applied in the given order
-
withTitleResolver
public SchemaGeneratorGeneralConfigPart withTitleResolver(ConfigFunction<TypeScope,String> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "title" resolver.- Overrides:
withTitleResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "title" of a JSON Schema- Returns:
- this config part (for chaining)
-
withDescriptionResolver
public SchemaGeneratorGeneralConfigPart withDescriptionResolver(ConfigFunction<TypeScope,String> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "description" resolver.- Overrides:
withDescriptionResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "description" of a JSON Schema- Returns:
- this config part (for chaining)
-
withDefaultResolver
public SchemaGeneratorGeneralConfigPart withDefaultResolver(ConfigFunction<TypeScope,Object> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "default" resolver.- Overrides:
withDefaultResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "default" of a JSON Schema- Returns:
- this config part (for chaining)
-
withEnumResolver
public SchemaGeneratorGeneralConfigPart withEnumResolver(ConfigFunction<TypeScope,Collection<?>> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "enum"/"const" resolver.- Overrides:
withEnumResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "enum"/"const" of a JSON Schema- Returns:
- this config part (for chaining)
-
withAdditionalPropertiesResolver
public SchemaGeneratorGeneralConfigPart withAdditionalPropertiesResolver(ConfigFunction<TypeScope,Type> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "additionalProperties" resolver. If the returned type isVoid
"false" will be set, otherwise an appropriate sub-schema.- Overrides:
withAdditionalPropertiesResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "additionalProperties" of a JSON Schema, returningVoid
will result in "false"- Returns:
- this config part (for chaining)
-
withPatternPropertiesResolver
public SchemaGeneratorGeneralConfigPart withPatternPropertiesResolver(ConfigFunction<TypeScope,Map<String,Type>> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "patternProperties" resolver. The map's keys are representing the patterns and the mapped values their corresponding types.- Overrides:
withPatternPropertiesResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "patternProperties" of a JSON Schema- Returns:
- this config part (for chaining)
-
withStringMinLengthResolver
public SchemaGeneratorGeneralConfigPart withStringMinLengthResolver(ConfigFunction<TypeScope,Integer> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "minLength" resolver.- Overrides:
withStringMinLengthResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "minLength" of a JSON Schema- Returns:
- this config part (for chaining)
-
withStringMaxLengthResolver
public SchemaGeneratorGeneralConfigPart withStringMaxLengthResolver(ConfigFunction<TypeScope,Integer> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "maxLength" resolver.- Overrides:
withStringMaxLengthResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "maxLength" of a JSON Schema- Returns:
- this config part (for chaining)
-
withStringFormatResolver
public SchemaGeneratorGeneralConfigPart withStringFormatResolver(ConfigFunction<TypeScope,String> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "format" resolver.- Overrides:
withStringFormatResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "format" of a JSON Schema- Returns:
- this config part (for chaining)
-
withStringPatternResolver
public SchemaGeneratorGeneralConfigPart withStringPatternResolver(ConfigFunction<TypeScope,String> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "format" resolver.- Overrides:
withStringPatternResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "format" of a JSON Schema- Returns:
- this config part (for chaining)
-
withNumberInclusiveMinimumResolver
public SchemaGeneratorGeneralConfigPart withNumberInclusiveMinimumResolver(ConfigFunction<TypeScope,BigDecimal> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "minimum" resolver.- Overrides:
withNumberInclusiveMinimumResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "minimum" of a JSON Schema- Returns:
- this config part (for chaining)
-
withNumberExclusiveMinimumResolver
public SchemaGeneratorGeneralConfigPart withNumberExclusiveMinimumResolver(ConfigFunction<TypeScope,BigDecimal> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "exclusiveMinimum" resolver.- Overrides:
withNumberExclusiveMinimumResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "exclusiveMinimum" of a JSON Schema- Returns:
- this config part (for chaining)
-
withNumberInclusiveMaximumResolver
public SchemaGeneratorGeneralConfigPart withNumberInclusiveMaximumResolver(ConfigFunction<TypeScope,BigDecimal> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "maximum" resolver.- Overrides:
withNumberInclusiveMaximumResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "maximum" of a JSON Schema- Returns:
- this config part (for chaining)
-
withNumberExclusiveMaximumResolver
public SchemaGeneratorGeneralConfigPart withNumberExclusiveMaximumResolver(ConfigFunction<TypeScope,BigDecimal> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "exclusiveMaximum" resolver.- Overrides:
withNumberExclusiveMaximumResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "exclusiveMaximum" of a JSON Schema- Returns:
- this config part (for chaining)
-
withNumberMultipleOfResolver
public SchemaGeneratorGeneralConfigPart withNumberMultipleOfResolver(ConfigFunction<TypeScope,BigDecimal> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "multipleOf" resolver.- Overrides:
withNumberMultipleOfResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "multipleOf" of a JSON Schema- Returns:
- this config part (for chaining)
-
withArrayMinItemsResolver
public SchemaGeneratorGeneralConfigPart withArrayMinItemsResolver(ConfigFunction<TypeScope,Integer> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "minItems" resolver.- Overrides:
withArrayMinItemsResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "minItems" of a JSON Schema- Returns:
- this config part (for chaining)
-
withArrayMaxItemsResolver
public SchemaGeneratorGeneralConfigPart withArrayMaxItemsResolver(ConfigFunction<TypeScope,Integer> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "maxItems" resolver.- Overrides:
withArrayMaxItemsResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "maxItems" of a JSON Schema- Returns:
- this config part (for chaining)
-
withArrayUniqueItemsResolver
public SchemaGeneratorGeneralConfigPart withArrayUniqueItemsResolver(ConfigFunction<TypeScope,Boolean> resolver)
Description copied from class:SchemaGeneratorTypeConfigPart
Setter for "uniqueItems" resolver.- Overrides:
withArrayUniqueItemsResolver
in classSchemaGeneratorTypeConfigPart<TypeScope>
- Parameters:
resolver
- how to determine the "uniqueItems" of a JSON Schema- Returns:
- this config part (for chaining)
-
-