@ConfigurableContext public class JsonSchemaGenerator extends BeanTraverseContext
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_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_beanTypePropertyName, BEAN_debug, BEAN_examples, BEAN_excludeProperties, BEAN_fluentSetters, BEAN_ignoreInvocationExceptionsOnGetters, BEAN_ignoreInvocationExceptionsOnSetters, BEAN_ignorePropertiesWithoutSetters, BEAN_ignoreUnknownBeanProperties, BEAN_ignoreUnknownNullBeanProperties, BEAN_implClasses, BEAN_includeProperties, BEAN_locale, BEAN_mediaType, 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_timeZone, BEAN_useEnumNames, BEAN_useInterfaceProxies, BEAN_useJavaBeanIntrospector, DEFAULT_SORTED
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()
Configuration property: Add descriptions to types.
|
protected Set<TypeCategory> |
getAddExamplesTo()
Configuration property: Add examples.
|
protected BeanDefMapper |
getBeanDefMapper()
Configuration property: Bean schema definition mapper.
|
protected Map<String,ObjectMap> |
getDefaultSchemas()
Configuration property: Default schemas.
|
Set<Pattern> |
getIgnoreTypes()
Configuration property: Ignore types from schema definitions.
|
protected boolean |
isAllowNestedDescriptions()
Configuration property: Allow nested descriptions.
|
protected boolean |
isAllowNestedExamples()
Configuration property: Allow nested examples.
|
boolean |
isIgnoredType(ClassMeta<?> cm)
Returns
|
protected boolean |
isUseBeanDefs()
Configuration property: Use bean definitions.
|
ObjectMap |
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, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getExamples, getExcludeProperties, getExcludeProperties, getImplClassConstructor, getImplClasses, getIncludeProperties, getIncludeProperties, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getTimeZone, hasSameCache, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, 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, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceProperty, getInstanceProperty, getInstanceProperty, getIntegerProperty, getListProperty, getListProperty, getLongProperty, getMapProperty, getProperty, getProperty, getPropertyKeys, getPropertyStore, getSetProperty, getSetProperty, getStringProperty, getStringPropertyWithNone, hashCode, identityCode, toString
public static final String 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
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
Identifies whether nested descriptions are allowed in schema definitions.
public static final String JSONSCHEMA_allowNestedExamples
Identifies whether nested examples are allowed in schema definitions.
public static final String 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
Allows you to override or provide custom schema information for particular class types.
Keys are full class names.
public static final String 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
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, ObjectMap)
.
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,ObjectMap> getDefaultSchemas()
JSONSCHEMA_defaultSchemas
public Set<Pattern> getIgnoreTypes()
JSONSCHEMA_ignoreTypes
protected final boolean isUseBeanDefs()
JSONSCHEMA_useBeanDefs
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 ObjectMap toMap()
Context
toMap
in class BeanTraverseContext
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.