Annotation Type JsonSchemaConfig
JsonSchemaGenerator
.
Used primarily for specifying bean configuration properties on REST classes and methods.
See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionAdd descriptions to types.Add examples.Allow nested descriptions.Allow nested examples.Class<? extends BeanDefMapper>
Bean schema definition mapper.Automatically detect POJO recursions.Ignore recursion errors.Ignore types from schema definitions.Initial depth.Max traversal depth.int
Optional rank for this config.Use bean definitions.
-
Element Details
-
rank
int rankOptional rank for this config.Can be used to override default ordering and application of config annotations.
- Returns:
- The annotation value.
- Default:
- 0
-
addDescriptionsTo
Add descriptions to types.Identifies which categories of types that descriptions should be automatically added to generated schemas.
The description is the result of calling
ClassMeta.getFullName()
.Notes:
-
The format is a comma-delimited list of any of the following values:
"BEAN" "COLLECTION" "ARRAY" "MAP" "STRING" "NUMBER" "BOOLEAN" "ANY" "OTHER"
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
The format is a comma-delimited list of any of the following values:
-
addExamplesTo
Add examples.Identifies which categories of types that examples should be automatically added to generated schemas.
The examples come from calling
ClassMeta.getExample(BeanSession,JsonParserSession)
which in turn gets examples from the following:Notes:
-
The format is a comma-delimited list of any of the following values:
"BEAN" "COLLECTION" "ARRAY" "MAP" "STRING" "NUMBER" "BOOLEAN" "ANY" "OTHER"
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
The format is a comma-delimited list of any of the following values:
-
allowNestedDescriptions
Allow nested descriptions.Identifies whether nested descriptions are allowed in schema definitions.
"true" "false" (default)
Notes:
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
allowNestedExamples
Allow nested examples.Identifies whether nested examples are allowed in schema definitions.
"true" "false" (default)
Notes:
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
beanDefMapper
Class<? extends BeanDefMapper> beanDefMapperBean schema definition mapper.Interface to use for converting Bean classes to definition IDs and URIs.
Used primarily for defining common definition sections for beans in Swagger JSON.
Notes:
-
This setting is ignored if
JsonSchemaGenerator.Builder.useBeanDefs()
is not enabled.
See Also:
- Returns:
- The annotation value.
- Default:
- org.apache.juneau.jsonschema.BeanDefMapper.Void.class
-
This setting is ignored if
-
ignoreTypes
Ignore types from schema definitions.Defines class name patterns that should be ignored when generating schema definitions in the generated Swagger documentation.
Notes:
- Format: Comma-delimited list of patterns
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
useBeanDefs
Use bean definitions.When enabled, schemas on beans will be serialized as the following:
{ type:
'object' ,'$ref' :'#/definitions/TypeId' }The definitions can then be retrieved from the session using
JsonSchemaGeneratorSession.getBeanDefs()
.Definitions can also be added programmatically using
JsonSchemaGeneratorSession.addBeanDef(String, JsonMap)
."true" "false" (default)
Notes:
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
detectRecursions
Automatically detect POJO recursions.Specifies that recursions should be checked for during traversal.
Recursions can occur when traversing models that aren't true trees but rather contain loops.
In general, unchecked recursions cause stack-overflow-errors.
These show up asParseExceptions
with the message"Depth too deep. Stack overflow occurred." .The behavior when recursions are detected depends on the value for
BeanTraverseContext.Builder.ignoreRecursions()
.For example, if a model contains the links A->B->C->A, then the JSON generated will look like the following when
BEANTRAVERSE_ignoreRecursions istrue ...{A:{B:{C:
null }}}"true" "false" (default)
Notes:
- Checking for recursion can cause a small performance penalty.
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
ignoreRecursions
Ignore recursion errors.Used in conjunction with
BeanTraverseContext.Builder.detectRecursions()
.
Setting is ignored ifBEANTRAVERSE_detectRecursions is"false" .If
"true" , when we encounter the same object when traversing a tree, we set the value tonull .
Otherwise, aBeanRecursionException
is thrown with the message"Recursion occurred, stack=..." ."true" "false" (default)
Notes:
-
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
initialDepth
Initial depth.The initial indentation level at the root.
Useful when constructing document fragments that need to be indented at a certain level.Notes:
- Format: integer
-
Default value:
"0" -
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
maxDepth
Max traversal depth.Abort traversal if specified depth is reached in the POJO tree.
If this depth is exceeded, an exception is thrown.Notes:
- Format: integer
-
Default value:
"100" -
Supports VarResolver.DEFAULT (e.g.
"$C{myConfigVar}" ).
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-