@ConfigurableContext public class JsonSchemaGenerator extends BeanTraverseContext implements JsonSchemaMetaProvider
Modifier and Type | Field and Description |
---|---|
static JsonSchemaGenerator |
DEFAULT
Default serializer, all default settings.
|
static String |
JSONSCHEMA_addDescriptionsTo
Configuration property: Add descriptions to types.
|
static String |
JSONSCHEMA_addExamplesTo
Configuration property: Add examples.
|
static String |
JSONSCHEMA_allowNestedDescriptions
Configuration property: Allow nested descriptions.
|
static String |
JSONSCHEMA_allowNestedExamples
Configuration property: Allow nested examples.
|
static String |
JSONSCHEMA_beanDefMapper
Configuration property: Bean schema definition mapper.
|
static String |
JSONSCHEMA_defaultSchemas
Configuration property: Default schemas.
|
static String |
JSONSCHEMA_ignoreTypes
Configuration property: Ignore types from schema definitions.
|
static String |
JSONSCHEMA_useBeanDefs
Configuration property: Use bean definitions.
|
BEANTRAVERSE_detectRecursions, BEANTRAVERSE_ignoreRecursions, BEANTRAVERSE_initialDepth, BEANTRAVERSE_maxDepth
BEAN_annotations, BEAN_beanClassVisibility, BEAN_beanConstructorVisibility, BEAN_beanDictionary, BEAN_beanDictionary_add, BEAN_beanDictionary_remove, BEAN_beanFieldVisibility, BEAN_beanFilters, BEAN_beanFilters_add, BEAN_beanFilters_remove, BEAN_beanMapPutReturnsOldValue, BEAN_beanMethodVisibility, BEAN_beansRequireDefaultConstructor, BEAN_beansRequireSerializable, BEAN_beansRequireSettersForGetters, BEAN_beansRequireSomeProperties, BEAN_bpi, BEAN_bpro, BEAN_bpwo, BEAN_bpx, BEAN_examples, BEAN_excludeProperties, BEAN_fluentSetters, BEAN_ignoreInvocationExceptionsOnGetters, BEAN_ignoreInvocationExceptionsOnSetters, BEAN_ignorePropertiesWithoutSetters, BEAN_ignoreTransientFields, BEAN_ignoreUnknownBeanProperties, BEAN_ignoreUnknownNullBeanProperties, BEAN_implClasses, BEAN_includeProperties, BEAN_notBeanClasses, BEAN_notBeanClasses_add, BEAN_notBeanClasses_remove, BEAN_notBeanPackages, BEAN_notBeanPackages_add, BEAN_notBeanPackages_remove, BEAN_pojoSwaps, BEAN_pojoSwaps_add, BEAN_pojoSwaps_remove, BEAN_propertyNamer, BEAN_sortProperties, BEAN_swaps, BEAN_swaps_add, BEAN_swaps_remove, BEAN_typePropertyName, BEAN_useEnumNames, BEAN_useInterfaceProxies, BEAN_useJavaBeanIntrospector, DEFAULT_SORTED
CONTEXT_debug, CONTEXT_locale, CONTEXT_mediaType, CONTEXT_timeZone
Constructor and Description |
---|
JsonSchemaGenerator(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
JsonSchemaGeneratorBuilder |
builder()
Creates a builder from this context object.
|
static JsonSchemaGeneratorBuilder |
create()
Instantiates a new clean-slate
JsonSerializerBuilder object. |
JsonSchemaGeneratorSession |
createSession()
Create a new bean session based on the properties defined on this context.
|
JsonSchemaGeneratorSession |
createSession(BeanSessionArgs args)
Create a new bean session based on the properties defined on this context combined with the specified
runtime args.
|
protected Set<TypeCategory> |
getAddDescriptionsTo()
Add descriptions to types.
|
protected Set<TypeCategory> |
getAddExamplesTo()
Add examples.
|
protected BeanDefMapper |
getBeanDefMapper()
Bean schema definition mapper.
|
protected Map<String,OMap> |
getDefaultSchemas()
Default schemas.
|
Set<Pattern> |
getIgnoreTypes()
Ignore types from schema definitions.
|
JsonSchemaBeanPropertyMeta |
getJsonSchemaBeanPropertyMeta(BeanPropertyMeta bpm)
Returns the language-specific metadata on the specified bean property.
|
JsonSchemaClassMeta |
getJsonSchemaClassMeta(ClassMeta<?> cm)
Returns the language-specific metadata on the specified class.
|
protected boolean |
isAllowNestedDescriptions()
Allow nested descriptions.
|
protected boolean |
isAllowNestedExamples()
Allow nested examples.
|
boolean |
isIgnoredType(ClassMeta<?> cm)
Returns
|
protected boolean |
isUseBeanDefs()
Use bean definitions.
|
OMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
getInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursions
_class, createBeanSession, createBeanSession, createDefaultBeanSessionArgs, createDefaultSessionArgs, createSession, dumpCacheStats, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getAnnotations, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanToStringSerializer, getBeanTypePropertyName, getBpi, getBpi, getBpro, getBpro, getBpwo, getBpwo, getBpx, getBpx, getClassMeta, getClassMeta, getClassMetaForObject, getDeclaredAnnotations, getDeclaredAnnotations, getExamples, getImplClassConstructor, getImplClasses, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastAnnotation, getLastDeclaredAnnotation, getLastDeclaredAnnotation, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSwaps, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasSameCache, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreTransientFields, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isNotABean, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, object, resolveClassMeta, string
equals, getArrayProperty, getArrayProperty, getBooleanProperty, getCdlProperty, getClassArrayProperty, getClassArrayProperty, getClassArrayProperty, getClassListProperty, getClassListProperty, getClassMapProperty, getClassMapProperty, getClassProperty, getClassSetProperty, getClassSetProperty, getDefaultLocale, getDefaultMediaType, getDefaultTimeZone, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceProperty, getInstanceProperty, getInstanceProperty, getIntegerProperty, getListProperty, getListProperty, getLongProperty, getMapProperty, getProperty, getProperty, getPropertyKeys, getPropertyStore, getSetProperty, getSetProperty, getStringProperty, getStringPropertyWithNone, hashCode, identityCode, isDebug, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAnnotations, getAnnotations, getAnnotations, getAnnotations, getDeclaredAnnotations
public static final String JSONSCHEMA_addDescriptionsTo
JSONSCHEMA_addDescriptionsTo
Identifies which categories of types that descriptions should be automatically added to generated schemas.
The description is the result of calling ClassMeta.getFullName()
.
The format is a comma-delimited list of any of the following values:
public static final String JSONSCHEMA_addExamplesTo
JSONSCHEMA_addExamplesTo
Identifies which categories of types that examples should be automatically added to generated schemas.
The examples come from calling ClassMeta.getExample(BeanSession)
which in turn gets examples
from the following:
The format is a comma-delimited list of any of the following values:
public static final String JSONSCHEMA_allowNestedDescriptions
JSONSCHEMA_allowNestedDescriptions
Identifies whether nested descriptions are allowed in schema definitions.
public static final String JSONSCHEMA_allowNestedExamples
JSONSCHEMA_allowNestedExamples
Identifies whether nested examples are allowed in schema definitions.
public static final String JSONSCHEMA_beanDefMapper
JSONSCHEMA_beanDefMapper
BeanDefMapper
BasicBeanDefMapper
Interface to use for converting Bean classes to definition IDs and URIs.
Used primarily for defining common definition sections for beans in Swagger JSON.
This setting is ignored if JSONSCHEMA_useBeanDefs
is not enabled.
public static final String JSONSCHEMA_defaultSchemas
JSONSCHEMA_defaultSchemas
OMap
>Allows you to override or provide custom schema information for particular class types.
Keys are full class names.
public static final String JSONSCHEMA_ignoreTypes
JSONSCHEMA_ignoreTypes
Defines class name patterns that should be ignored when generating schema definitions in the generated Swagger documentation.
public static final String JSONSCHEMA_useBeanDefs
JSONSCHEMA_useBeanDefs
When enabled, schemas on beans will be serialized as the following:
{
type:
The definitions can then be retrieved from the session using JsonSchemaGeneratorSession.getBeanDefs()
.
Definitions can also be added programmatically using JsonSchemaGeneratorSession.addBeanDef(String, OMap)
.
public static final JsonSchemaGenerator DEFAULT
public JsonSchemaGenerator(PropertyStore ps)
ps
- Initialize with the specified config property store.public JsonSchemaGeneratorBuilder builder()
Context
Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
builder
in class BeanTraverseContext
public static JsonSchemaGeneratorBuilder create()
JsonSerializerBuilder
object.
This is equivalent to simply calling
.
JsonSerializerBuilder
object.public JsonSchemaGeneratorSession createSession()
BeanContext
Use this method for creating sessions if you don't need to override any properties or locale/timezone currently set on this context.
createSession
in class BeanTraverseContext
public JsonSchemaGeneratorSession createSession(BeanSessionArgs args)
BeanContext
Use this method for creating sessions if you don't need to override any properties or locale/timezone currently set on this context.
createSession
in class BeanTraverseContext
args
- The session arguments.protected final Set<TypeCategory> getAddDescriptionsTo()
JSONSCHEMA_addDescriptionsTo
protected final Set<TypeCategory> getAddExamplesTo()
JSONSCHEMA_addExamplesTo
protected final boolean isAllowNestedDescriptions()
JSONSCHEMA_allowNestedDescriptions
protected final boolean isAllowNestedExamples()
JSONSCHEMA_allowNestedExamples
protected final BeanDefMapper getBeanDefMapper()
JSONSCHEMA_beanDefMapper
protected final Map<String,OMap> getDefaultSchemas()
JSONSCHEMA_defaultSchemas
public Set<Pattern> getIgnoreTypes()
JSONSCHEMA_ignoreTypes
protected final boolean isUseBeanDefs()
JSONSCHEMA_useBeanDefs
public JsonSchemaClassMeta getJsonSchemaClassMeta(ClassMeta<?> cm)
JsonSchemaMetaProvider
getJsonSchemaClassMeta
in interface JsonSchemaMetaProvider
cm
- The class to return the metadata on.public JsonSchemaBeanPropertyMeta getJsonSchemaBeanPropertyMeta(BeanPropertyMeta bpm)
JsonSchemaMetaProvider
getJsonSchemaBeanPropertyMeta
in interface JsonSchemaMetaProvider
bpm
- The bean property to return the metadata on.public boolean isIgnoredType(ClassMeta<?> cm)
The type is ignored if it's specified in the JSONSCHEMA_ignoreTypes
setting.
Ignored types return JsonSchemaGeneratorSession.getSchema(ClassMeta)
.
cm
- The type to check.public OMap toMap()
Context
toMap
in class BeanTraverseContext
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.