Class JsonSchemaGenerator.Builder
- Enclosing class:
- JsonSchemaGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JsonParser.Builder<?>protected final JsonSerializer.Builder<?> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor, default settings.protectedBuilder(JsonSchemaGenerator copyFrom) Copy constructor.protectedBuilder(JsonSchemaGenerator.Builder copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddDescriptionsTo(TypeCategory... values) Add descriptions.addExamplesTo(TypeCategory... values) Add examples.Allow nested descriptions.allowNestedDescriptions(boolean value) Same asallowNestedDescriptions()but allows you to explicitly specify the value.Allow nested examples.allowNestedExamples(boolean value) Same asallowNestedExamples()but allows you to explicitly specify the value.beanDefMapper(Class<? extends MarshallingDefMapper> value) Schema definition mapper.build()Build the object.copy()Copy creator.Gives access to the inner JSON parser builder if you want to modify the parser settings.Gives access to the inner JSON serializer builder if you want to modify the serializer settings.hashKey()Returns the hashkey of this builder.ignoreTypes(String... values) Ignore types from schema definitions.Use bean definitions.useBeanDefs(boolean value) Same asuseBeanDefs()but allows you to explicitly specify the value.Methods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext.Builder
detectRecursions, detectRecursions, ignoreRecursions, ignoreRecursions, initialDepth, maxDepthMethods inherited from class org.apache.juneau.marshall.MarshallingContextable.Builder
activeView, annotations, beanClassVisibility, beanConstructorVisibility, beanDictionary, beanFieldVisibility, beanInterceptor, beanMapPutReturnsOldValue, beanMethodVisibility, beanProperties, beanProperties, beanProperties, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, bigNumberFormat, binaryFormat, bitSetFormat, booleanFormat, calendarFormat, classFormat, classLoader, currencyFormat, dateFormat, debug, dictionaryOn, disableBeansRequireSomeProperties, disableDefaultViewInclusion, disableIgnoreMissingSetters, disableIgnoreTransientFields, disableIgnoreUnknownNullBeanProperties, disableInterfaceProxies, durationFormat, enumFormat, example, example, findFluentSetters, findFluentSetters, floatFormat, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignoreUnknownBeanProperties, ignoreUnknownEnumValues, implClass, implClasses, interfaceClass, interfaces, locale, localeFormat, marshallingContext, marshallingContext, marshallingContext, marshallingContext, mediaType, notBeanClasses, notBeanPackages, periodFormat, propertyNamer, propertyNamer, recordComponentOrder, stopClass, swap, swap, swaps, swaps, temporalFormat, timeZone, timeZoneFormat, typeName, typePropertyName, typePropertyName, unsortedProperties, unsortedProperties, useJavaBeanIntrospector, uuidFormat, validateSchema, validateSchemaMethods inherited from class org.apache.juneau.marshall.Context.Builder
annotations, apply, applyAnnotations, applyAnnotations, asSubtype, build, cache, canApply, copyOrNull, debug, getApplied, getType, impl, isDebug, registerBuilders, self, type
-
Field Details
-
jsonParserBuilder
-
jsonSerializerBuilder
-
-
Constructor Details
-
Builder
protected Builder()Constructor, default settings. -
Builder
Copy constructor.- Parameters:
copyFrom- The builder to copy from.
Cannot benull .
-
Builder
Copy constructor.- Parameters:
copyFrom- The bean to copy from.
Cannot benull .
-
-
Method Details
-
addDescriptionsTo
Add descriptions.Identifies which categories of types that descriptions should be automatically added to generated schemas. The description is the result of calling
ClassInfo.getName(). The format is a comma-delimited list of any of the following values:- Parameters:
values- The values to add to this setting.
The default is an empty string.
Cannot containnull values.- Returns:
- This object.
-
addExamplesTo
Add examples.Identifies which categories of types that examples should be automatically added to generated schemas.
The examples come from calling
ClassMeta.getExample(MarshallingSession,JsonParserSession)which in turn gets examples from the following:The format is a comma-delimited list of any of the following values:
- Parameters:
values- The values to add to this setting.
The default is an empty string.
Cannot containnull values.- Returns:
- This object.
-
allowNestedDescriptions
Allow nested descriptions.Identifies whether nested descriptions are allowed in schema definitions.
- Returns:
- This object.
-
allowNestedDescriptions
Same asallowNestedDescriptions()but allows you to explicitly specify the value.- Parameters:
value- The value for this setting.- Returns:
- This object.
-
allowNestedExamples
Allow nested examples.Identifies whether nested examples are allowed in schema definitions.
- Returns:
- This object.
-
allowNestedExamples
Same asallowNestedExamples()but allows you to explicitly specify the value.- Parameters:
value- The value for this setting.- Returns:
- This object.
-
beanDefMapper
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.
This setting is ignored if
useBeanDefs()is not enabled.- Parameters:
value- The new value for this setting.
The default isBasicBeanDefMapper.
Cannot benull .- Returns:
- This object.
-
build
Description copied from class:Context.BuilderBuild the object.- Overrides:
buildin classContext.Builder<JsonSchemaGenerator.Builder>- Returns:
- The built object.
-
copy
Description copied from class:Context.BuilderCopy creator.- Specified by:
copyin classMarshallingContextable.Builder<JsonSchemaGenerator.Builder>- Returns:
- A new mutable copy of this builder.
-
getJsonParserBuilder
Gives access to the inner JSON parser builder if you want to modify the parser settings.- Returns:
- The JSON serializer builder.
-
getJsonSerializerBuilder
Gives access to the inner JSON serializer builder if you want to modify the serializer settings.- Returns:
- The JSON serializer builder.
-
hashKey
Description copied from class:Context.BuilderReturns the hashkey of this builder.Used to return previously instantiated context beans that have matching hashkeys. The
HashKeyobject is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if theHashKey.equals(Object)method is the same.- Overrides:
hashKeyin classMarshallingTraverseContext.Builder<JsonSchemaGenerator.Builder>- Returns:
- The hashkey of this builder.
-
ignoreTypes
Ignore types from schema definitions.Description:
Defines class name patterns that should be ignored when generating schema definitions in the generated Swagger documentation.
Example:
// Don't generate schema for any prototype packages or the class named 'Swagger'. @JsonSchemaConfig ( ignoreTypes="Swagger,*.proto.*" )public class MyResource {...}- Parameters:
values- The values to add.
Cannot containnull values.- Returns:
- This object.
-
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).- Returns:
- This object.
-
useBeanDefs
Same asuseBeanDefs()but allows you to explicitly specify the value.- Parameters:
value- The value for this setting.- Returns:
- This object.
-