Package org.apache.juneau.jsonschema
Class JsonSchemaGeneratorSession
java.lang.Object
org.apache.juneau.ContextSession
org.apache.juneau.BeanSession
org.apache.juneau.BeanTraverseSession
org.apache.juneau.jsonschema.JsonSchemaGeneratorSession
Session object that lives for the duration of a single use of
JsonSchemaSerializer
.
Notes:
- This class is not thread safe and is typically discarded after one use.
See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.apache.juneau.BeanTraverseSession
indent
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddBeanDef
(String id, JsonMap def) Adds a schema definition to this session.Creates a new builder for this object.protected final Set<TypeCategory>
Add descriptions to types.protected final Set<TypeCategory>
Add examples.getBeanDefId
(ClassMeta<?> cm) Returns the definition ID for the specified class.protected final BeanDefMapper
Bean schema definition mapper.Returns the definitions that were gathered during this session.getBeanDefUri
(String id) Returns the definition URI for the specified class.getBeanDefUri
(ClassMeta<?> cm) Returns the definition URI for the specified class.Ignore types from schema definitions.Returns the language-specific metadata on the specified bean property.getJsonSchemaClassMeta
(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.Returns the JSON-schema for the specified object.Returns the JSON-schema for the specified type.Returns the JSON-schema for the specified type.protected final boolean
Allow nested descriptions.protected final boolean
Allow nested examples.protected final boolean
Use bean definitions.Methods inherited from class org.apache.juneau.BeanTraverseSession
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, onError, pop, properties, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurse
Methods inherited from class org.apache.juneau.BeanSession
_class, addWarning, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, create, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getLocale, getMediaType, getNamePropertyName, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, newGenericMap, object, string, toArray, toBeanMap, toBeanMap, toBeanMap
Methods inherited from class org.apache.juneau.ContextSession
checkForWarnings, getContext, getSessionProperties, getWarnings, isDebug, toString
-
Constructor Details
-
JsonSchemaGeneratorSession
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx
- The context creating this session.- Returns:
- A new builder.
-
getSchema
Returns the JSON-schema for the specified object.- Parameters:
o
- The object.
Can either be a POJO or aClass /Type .- Returns:
- The schema for the type.
- Throws:
BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.
-
getSchema
Returns the JSON-schema for the specified type.- Parameters:
type
- The object type.- Returns:
- The schema for the type.
- Throws:
BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.
-
getSchema
Returns the JSON-schema for the specified type.- Parameters:
cm
- The object type.- Returns:
- The schema for the type.
- Throws:
BeanRecursionException
- Bean recursion occurred.SerializeException
- Error occurred.
-
getBeanDefId
Returns the definition ID for the specified class.- Parameters:
cm
- The class to get the definition ID of.- Returns:
- The definition ID for the specified class.
-
getBeanDefUri
Returns the definition URI for the specified class.- Parameters:
cm
- The class to get the definition URI of.- Returns:
- The definition URI for the specified class.
-
getBeanDefUri
Returns the definition URI for the specified class.- Parameters:
id
- The definition ID to get the definition URI of.- Returns:
- The definition URI for the specified class.
-
getBeanDefs
Returns the definitions that were gathered during this session.This map is modifiable and affects the map in the session.
- Returns:
- The definitions that were gathered during this session, or
null ifJsonSchemaGenerator.Builder.useBeanDefs()
was not enabled.
-
addBeanDef
Adds a schema definition to this session.- Parameters:
id
- The definition ID.def
- The definition schema.- Returns:
- This object.
-
getAddDescriptionsTo
Add descriptions to types.- Returns:
- Set of categories of types that descriptions should be automatically added to generated schemas.
- See Also:
-
getAddExamplesTo
Add examples.- Returns:
- Set of categories of types that examples should be automatically added to generated schemas.
- See Also:
-
isAllowNestedDescriptions
Allow nested descriptions.- Returns:
true if nested descriptions are allowed in schema definitions.- See Also:
-
isAllowNestedExamples
Allow nested examples.- Returns:
true if nested examples are allowed in schema definitions.- See Also:
-
getBeanDefMapper
Bean schema definition mapper.- Returns:
- Interface to use for converting Bean classes to definition IDs and URIs.
- See Also:
-
getIgnoreTypes
Ignore types from schema definitions.- Returns:
- Custom schema information for particular class types.
- See Also:
-
isUseBeanDefs
Use bean definitions.- Returns:
true if schemas on beans will be serialized with'$ref' tags.- See Also:
-
getJsonSchemaClassMeta
Returns the language-specific metadata on the specified class.- Parameters:
cm
- The class to return the metadata on.- Returns:
- The metadata.
-
getJsonSchemaBeanPropertyMeta
Returns the language-specific metadata on the specified bean property.- Parameters:
bpm
- The bean property to return the metadata on.- Returns:
- The metadata.
-