Class SimpleTypeModule
java.lang.Object
com.github.victools.jsonschema.generator.impl.module.SimpleTypeModule
- All Implemented Interfaces:
Module
Default module being included for the
Option.ADDITIONAL_FIXED_TYPES.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApply this module to the given configuration builder instance.static SimpleTypeModuleFactory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counterparts (e.g.static SimpleTypeModuleFactory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counter parts (e.g.final SimpleTypeModulewithBooleanType(Class<?> javaType) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_BOOLEAN".final SimpleTypeModulewithEmptySchema(Class<?> javaType) Add the given mapping for a (simple) java class that should be represented by an empty schema.final SimpleTypeModulewithIntegerType(Class<?> javaType) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".final SimpleTypeModulewithIntegerType(Class<?> javaType, String openApiFormat) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".final SimpleTypeModulewithNumberType(Class<?> javaType) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.final SimpleTypeModulewithNumberType(Class<?> javaType, String openApiFormat) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.final SimpleTypeModulewithObjectType(Class<?> javaType) Deprecated.final SimpleTypeModulewithStandardStringType(Class<?> javaType, String standardFormat) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".final SimpleTypeModulewithStringType(Class<?> javaType) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".final SimpleTypeModulewithStringType(Class<?> javaType, String openApiFormat) Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".
-
Constructor Details
-
SimpleTypeModule
public SimpleTypeModule()
-
-
Method Details
-
forPrimitiveTypes
Factory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counter parts (e.g.booleanandBoolean).- Returns:
- created module instance
- See Also:
-
forPrimitiveAndAdditionalTypes
Factory method: creating an instance of theSimpleTypeModulecontaining mappings for various primitive types and their non-primitive counterparts (e.g.booleanandBoolean) as well as other classes that are normally serialised in a JSON as non-objects, e.g.BigDecimal,BigInteger,UUID,LocalDate,LocalDateTime, and a number of other date-time types.- Returns:
- created module instance
- See Also:
-
withEmptySchema
Add the given mapping for a (simple) java class that should be represented by an empty schema.- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withObjectType
Deprecated.rather usewithEmptySchema(Class)instead to really allow any valueAdd the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_OBJECT".- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withStringType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withStringType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".- Parameters:
javaType- java class to map to a fixed JSON schema definitionopenApiFormat- optionalSchemaKeyword.TAG_FORMATvalue, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
withStandardStringType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_STRING".- Parameters:
javaType- java class to map to a fixed JSON schema definitionstandardFormat- optionalSchemaKeyword.TAG_FORMATvalue, to set if one of the respective Options is enabled- Returns:
- this module instance (for chaining)
-
withBooleanType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_BOOLEAN".- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withIntegerType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withIntegerType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attribute: "SchemaKeyword.TAG_TYPE_INTEGER".- Parameters:
javaType- java class to map to a fixed JSON schema definitionopenApiFormat- optionalSchemaKeyword.TAG_FORMATvalue, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
withNumberType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.- Parameters:
javaType- java class to map to a fixed JSON schema definition- Returns:
- this module instance (for chaining)
-
withNumberType
Add the given mapping for a (simple) java class to its JSON schema equivalent "type" attributeSchemaKeyword.TAG_TYPE_NUMBER.- Parameters:
javaType- java class to map to a fixed JSON schema definitionopenApiFormat- optionalSchemaKeyword.TAG_FORMATvalue, to set if respective Option is enabled- Returns:
- this module instance (for chaining)
-
applyToConfigBuilder
Description copied from interface:ModuleApply this module to the given configuration builder instance.- Specified by:
applyToConfigBuilderin interfaceModule- Parameters:
builder- configuration builder instance to which to apply this module
-
withEmptySchema(Class)instead to really allow any value