Class SchemaInfo
The Schema Object allows the definition of input and output data types for Swagger 2.0, including objects, primitives, and arrays. This object is an extended subset of the JSON Schema Specification Draft 4, with additional extensions provided by the Swagger Specification to allow for more complete documentation.
Swagger Specification:
The Schema Object supports all properties from JSON Schema Draft 4, including but not limited to:
type (string) - The data type. Values:"string" ,"number" ,"integer" ,"boolean" ,"array" ,"object" ,"file" format (string) - The format modifier (e.g.,"int32" ,"int64" ,"float" ,"double" ,"date" ,"date-time" )title (string) - A short title for the schemadescription (string) - A description of the schemadefault (any) - The default valuemultipleOf (number) - Must be a multiple of this valuemaximum (number) - Maximum value (inclusive by default)exclusiveMaximum (boolean) - If true, maximum is exclusiveminimum (number) - Minimum value (inclusive by default)exclusiveMinimum (boolean) - If true, minimum is exclusivemaxLength (integer) - Maximum string lengthminLength (integer) - Minimum string lengthpattern (string) - Regular expression pattern the string must matchmaxItems (integer) - Maximum array lengthminItems (integer) - Minimum array lengthuniqueItems (boolean) - If true, array items must be uniquemaxProperties (integer) - Maximum number of object propertiesminProperties (integer) - Minimum number of object propertiesrequired (array of string) - Required property namesenum (array) - Possible values for this schemaproperties (map ofSchemaInfo) - Object property definitionsitems (Items) - Schema for array itemsallOf (array ofSchemaInfo) - Must validate against all schemasdiscriminator (string) - Property name for polymorphism (Swagger extension)readOnly (boolean) - Relevant only for Schema properties (Swagger extension)xml (Xml) - XML representation details (Swagger extension)externalDocs (ExternalDocumentation) - Additional external documentation (Swagger extension)example (any) - Example value (Swagger extension)
Example:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllOf(Collection<SchemaInfo> values) Bean property fluent setter:allOf .addAllOf(SchemaInfo... values) Bean property appender:allOf .Bean property appender:enum .addEnum(Collection<Object> values) Bean property fluent setter:enum .addProperty(String key, SchemaInfo value) Bean property appender:properties .addRequiredProperties(String... value) Bean property appender:requiredProperties .addRequiredProperties(Collection<String> values) Bean property fluent setter:requiredProperties .copy()Make a deep copy of this object.<T> TGeneric property getter.Bean property getter:additionalProperties .getAllOf()Bean property getter:allOf .Bean property getter:default .Bean property getter:description .Bean property getter:discriminator .getEnum()Bean property getter:enum .Bean property getter:example .Bean property getter:exclusiveMaximum .Bean property getter:exclusiveMinimum .Bean property getter:externalDocs .Bean property getter:format .getItems()Bean property getter:items .Bean property getter:maximum .Bean property getter:maxItems .Bean property getter:maxLength .Bean property getter:maxProperties .Bean property getter:minimum .Bean property getter:minItems .Bean property getter:minLength .Bean property getter:minProperties .Bean property getter:multipleOf .Bean property getter:pattern .Bean property getter:properties .Bean property getter:readOnly .getRef()Bean property getter:$ref .Bean property getter:required .Bean property getter:requiredProperties .getTitle()Bean property getter:title .getType()Bean property getter:type .Bean property getter:uniqueItems .getXml()Bean property getter:xml .keySet()Returns all the keys on this element.resolveRefs(Swagger swagger, Deque<String> refStack, int maxDepth) Resolves any"$ref" attributes in this element.Generic property setter.Bean property setter:additionalProperties .setAllOf(Collection<SchemaInfo> value) Bean property setter:allOf .setAllOf(SchemaInfo... value) Bean property fluent setter:allOf .setDefault(Object value) Bean property setter:default .setDescription(String value) Bean property setter:description .setDiscriminator(String value) Bean property setter:discriminator .Bean property fluent setter:enum .setEnum(Collection<Object> value) Bean property setter:enum .setExample(Object value) Bean property setter:example .setExclusiveMaximum(Boolean value) Bean property setter:exclusiveMaximum .setExclusiveMinimum(Boolean value) Bean property setter:exclusiveMinimum .Bean property setter:externalDocs .Bean property setter:format .Bean property setter:items .setMaximum(Number value) Bean property setter:maximum .setMaxItems(Integer value) Bean property setter:maxItems .setMaxLength(Integer value) Bean property setter:maxLength .setMaxProperties(Integer value) Bean property setter:maxProperties .setMinimum(Number value) Bean property setter:minimum .setMinItems(Integer value) Bean property setter:minItems .setMinLength(Integer value) Bean property setter:minLength .setMinProperties(Integer value) Bean property setter:minProperties .setMultipleOf(Number value) Bean property setter:multipleOf .setPattern(String value) Bean property setter:pattern .setProperties(Map<String, SchemaInfo> value) Bean property setter:properties .setReadOnly(Boolean value) Bean property setter:readOnly .Bean property setter:$ref .setRequired(Boolean value) Bean property setter:required .setRequiredProperties(String... value) Bean property fluent setter:requiredProperties .setRequiredProperties(Collection<String> value) Bean property setter:requiredProperties .Bean property setter:title .Bean property setter:type .setUniqueItems(Boolean value) Bean property setter:uniqueItems .Bean property setter:xml .strict()Sets strict mode on this bean.Sets strict mode on this bean.
-
Constructor Details
-
SchemaInfo
public SchemaInfo()Default constructor. -
SchemaInfo
Copy constructor.- Parameters:
copyFrom- The object to copy.
-
-
Method Details
-
addAllOf
Bean property fluent setter:allOf .Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
- Parameters:
values- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addAllOf
Bean property appender:allOf .- Parameters:
values- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addEnum
Bean property fluent setter:enum .An enumeration of possible values.
- Parameters:
values- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addEnum
Bean property appender:enum .- Parameters:
value- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addProperty
Bean property appender:properties .- Parameters:
key- The property key. Must not benull .value- The property value. Must not benull .- Returns:
- This object.
-
addRequiredProperties
Bean property fluent setter:requiredProperties .Takes an array of strings that define the required properties.
- Parameters:
values- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
addRequiredProperties
Bean property appender:requiredProperties .The list of required properties.
- Parameters:
value- The values to add to this property.
Ignored ifnull .- Returns:
- This object.
-
copy
Make a deep copy of this object.- Returns:
- A deep copy of this object.
-
get
Description copied from class:SwaggerElementGeneric property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
getin classSwaggerElement- Type Parameters:
T- The datatype to cast the value to.- Parameters:
property- The property name to retrieve.type- The datatype to cast the value to.- Returns:
- The property value, or
null if the property does not exist or is not set.
-
getAdditionalProperties
Bean property getter:additionalProperties .- Returns:
- The property value, or
null if it is not set.
-
getAllOf
Bean property getter:allOf .- Returns:
- The property value, or
null if it is not set.
-
getDefault
Bean property getter:default .Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
- Returns:
- The property value, or
null if it is not set.
-
getDescription
Bean property getter:description .- Returns:
- The property value, or
null if it is not set.
-
getDiscriminator
Bean property getter:discriminator .- Returns:
- The property value, or
null if it is not set.
-
getEnum
Bean property getter:enum .- Returns:
- The property value, or
null if it is not set.
-
getExample
Bean property getter:example .- Returns:
- The property value, or
null if it is not set.
-
getExclusiveMaximum
Bean property getter:exclusiveMaximum .- Returns:
- The property value, or
null if it is not set.
-
getExclusiveMinimum
Bean property getter:exclusiveMinimum .- Returns:
- The property value, or
null if it is not set.
-
getExternalDocs
Bean property getter:externalDocs .- Returns:
- The property value, or
null if it is not set.
-
getFormat
Bean property getter:format .- Returns:
- The property value, or
null if it is not set.
-
getItems
Bean property getter:items .- Returns:
- The property value, or
null if it is not set.
-
getMaximum
Bean property getter:maximum .- Returns:
- The property value, or
null if it is not set.
-
getMaxItems
Bean property getter:maxItems .- Returns:
- The property value, or
null if it is not set.
-
getMaxLength
Bean property getter:maxLength .- Returns:
- The property value, or
null if it is not set.
-
getMaxProperties
Bean property getter:maxProperties .- Returns:
- The property value, or
null if it is not set.
-
getMinimum
Bean property getter:minimum .- Returns:
- The property value, or
null if it is not set.
-
getMinItems
Bean property getter:minItems .- Returns:
- The property value, or
null if it is not set.
-
getMinLength
Bean property getter:minLength .- Returns:
- The property value, or
null if it is not set.
-
getMinProperties
Bean property getter:minProperties .- Returns:
- The property value, or
null if it is not set.
-
getMultipleOf
Bean property getter:multipleOf .- Returns:
- The property value, or
null if it is not set.
-
getPattern
Bean property getter:pattern .- Returns:
- The property value, or
null if it is not set.
-
getProperties
Bean property getter:properties .- Returns:
- The property value, or
null if it is not set.
-
getReadOnly
Bean property getter:readOnly .- Returns:
- The property value, or
null if it is not set.
-
getRef
Bean property getter:$ref .- Returns:
- The property value, or
null if it is not set.
-
getRequired
Bean property getter:required .- Returns:
- The property value, or
null if it is not set.
-
getRequiredProperties
Bean property getter:requiredProperties .The list of required properties.
- Returns:
- The property value, or
null if it is not set.
-
getTitle
Bean property getter:title .- Returns:
- The property value, or
null if it is not set.
-
getType
Bean property getter:type .- Returns:
- The property value, or
null if it is not set.
-
getUniqueItems
Bean property getter:uniqueItems .- Returns:
- The property value, or
null if it is not set.
-
getXml
Bean property getter:xml .- Returns:
- The property value, or
null if it is not set.
-
keySet
Description copied from class:SwaggerElementReturns all the keys on this element.- Overrides:
keySetin classSwaggerElement- Returns:
- All the keys on this element.
Nevernull .
-
resolveRefs
Resolves any"$ref" attributes in this element.- Parameters:
swagger- The swagger document containing the definitions.refStack- Keeps track of previously-visited references so that we don't cause recursive loops.maxDepth- The maximum depth to resolve references.
After that level is reached,$ref references will be left alone.
Useful if you have very complex models and you don't want your swagger page to be overly-complex.- Returns:
- This object with references resolved.
May or may not be the same object.
-
set
Description copied from class:SwaggerElementGeneric property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
setin classSwaggerElement- Parameters:
property- The property name to set. Must not benull .value- The new value for the property.- Returns:
- This object.
-
setAdditionalProperties
Bean property setter:additionalProperties .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setAllOf
Bean property setter:allOf .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setAllOf
Bean property fluent setter:allOf .- Parameters:
value- The new value for this property.
Strings can contains JSON arrays.
Valid types:- Returns:
- This object.
-
setDefault
Bean property setter:default .Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setDescription
Bean property setter:description .- Parameters:
value- The new value for this property.
GFM syntax can be used for rich text representation.
Can benull to unset the property.- Returns:
- This object.
-
setDiscriminator
Bean property setter:discriminator .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setEnum
Bean property setter:enum .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setEnum
Bean property fluent setter:enum .- Parameters:
value- The new value for this property.
Strings can be JSON arrays.- Returns:
- This object.
-
setExample
Bean property setter:example .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setExclusiveMaximum
Bean property setter:exclusiveMaximum .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setExclusiveMinimum
Bean property setter:exclusiveMinimum .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setExternalDocs
Bean property setter:externalDocs .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setFormat
Bean property setter:format .- Parameters:
value- The new value for this property.
Can benull to unset the property.
Formats defined by the OAS include:"int32" "int64" "float" "double" "byte" "binary" "date" "date-time" "password"
- Returns:
- This object.
-
setItems
Bean property setter:items .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMaximum
Bean property setter:maximum .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMaxItems
Bean property setter:maxItems .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMaxLength
Bean property setter:maxLength .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMaxProperties
Bean property setter:maxProperties .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMinimum
Bean property setter:minimum .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMinItems
Bean property setter:minItems .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMinLength
Bean property setter:minLength .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMinProperties
Bean property setter:minProperties .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setMultipleOf
Bean property setter:multipleOf .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setPattern
Bean property setter:pattern .- Parameters:
value- The new value for this property.
This string SHOULD be a valid regular expression.
Can benull to unset the property.- Returns:
- This object.
-
setProperties
Bean property setter:properties .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setReadOnly
Bean property setter:readOnly .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setRef
Bean property setter:$ref .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setRequired
Bean property setter:required .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setRequiredProperties
Bean property setter:requiredProperties .The list of required properties.
- Parameters:
value- The new value for this property.
Valid values:"http" "https" "ws" "wss"
Can benull to unset the property.- Returns:
- This object.
-
setRequiredProperties
Bean property fluent setter:requiredProperties .- Parameters:
value- The new value for this property.- Returns:
- This object.
-
setTitle
Bean property setter:title .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setType
Bean property setter:type .- Parameters:
value- The new value for this property.
Can benull to unset the property.
Possible values include:"object" "string" "number" "integer" "boolean" "array" "file"
- Returns:
- This object.
-
setUniqueItems
Bean property setter:uniqueItems .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setXml
Bean property setter:xml .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
strict
Sets strict mode on this bean.- Overrides:
strictin classSwaggerElement- Returns:
- This object.
-
strict
Sets strict mode on this bean.- Overrides:
strictin classSwaggerElement- Parameters:
value- The new value for this property.
Non-boolean values will be converted to boolean usingBoolean..valueOf (value.toString())
Can benull (interpreted asfalse ).- Returns:
- This object.
-