Class Items
The Items Object is a limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located in "body" to describe the type of items in an array. This is particularly useful for query parameters, path parameters, and header parameters that accept arrays.
OpenAPI Specification:
The Items Object supports the following fields from JSON Schema:
type (string, REQUIRED) - The data type. Values:"string" ,"number" ,"integer" ,"boolean" ,"array" format (string) - The format modifier (e.g.,"int32" ,"int64" ,"float" ,"double" ,"date" ,"date-time" )items (Items
) - Required if type is"array" . Describes the type of items in the arraycollectionFormat (string) - How multiple values are formatted. Values:"csv" ,"ssv" ,"tsv" ,"pipes" ,"multi" default (any) - The default valuemaximum (number),exclusiveMaximum (boolean),minimum (number),exclusiveMinimum (boolean) - Numeric constraintsmaxLength (integer),minLength (integer),pattern (string) - String constraintsmaxItems (integer),minItems (integer),uniqueItems (boolean) - Array constraintsenum (array) - Possible values for this itemmultipleOf (number) - Must be a multiple of this value
Example:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds one or more values to theenum property.copy()
Make a deep copy of this object.<T> T
Generic property getter.Bean property getter:collectionFormat .Bean property getter:default .getEnum()
Bean property getter:enum .Bean property getter:exclusiveMaximum .Bean property getter:exclusiveMinimum .Bean property getter:format .getItems()
Bean property getter:items .Bean property getter:maximum .Bean property getter:maxItems .Bean property getter:maxLength .Bean property getter:minimum .Bean property getter:minItems .Bean property getter:minLength .Bean property getter:multipleOf .Bean property getter:pattern .getRef()
Bean property getter:$ref .getType()
Bean property getter:type .Bean property getter:uniqueItems .keySet()
Returns all the keys on this element.resolveRefs
(OpenApi openApi, Deque<String> refStack, int maxDepth) Resolves any"$ref" attributes in this element.Generic property setter.setCollectionFormat
(String value) Bean property setter:collectionFormat .setDefault
(Object value) Bean property setter:default .Adds one or more values to theenum property.setEnum
(Collection<Object> value) Bean property setter:enum .setExclusiveMaximum
(Boolean value) Bean property setter:exclusiveMaximum .setExclusiveMinimum
(Boolean value) Bean property setter:exclusiveMinimum .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 .setMinimum
(Number value) Bean property setter:minimum .setMinItems
(Integer value) Bean property setter:minItems .setMinLength
(Integer value) Bean property setter:minLength .setMultipleOf
(Number value) Bean property setter:multipleOf .setPattern
(String value) Bean property setter:pattern .Bean property setter:$ref .Bean property setter:type .setUniqueItems
(Boolean value) Bean property setter:uniqueItems .protected Items
strict()
Sets strict mode on this bean.Sets strict mode on this bean.
-
Constructor Details
-
Items
public Items()Default constructor. -
Items
Copy constructor.- Parameters:
copyFrom
- The object to copy.
-
-
Method Details
-
copy
Make a deep copy of this object.- Returns:
- A deep copy of this object.
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- Returns:
- This object
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- 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
-
getType
Bean property getter:type .The internal type of the array.
- Returns:
- The property value, or
null if it is not set.
-
setType
Bean property setter:type .The internal type of the array.
- Parameters:
value
- The new value for this property.
Valid values:"string" "number" "integer" "boolean" "array"
Property value is required.
Can benull to unset the property.- Returns:
- This object
-
getFormat
Bean property getter:format .The extending format for the previously mentioned
type
.- Returns:
- The property value, or
null if it is not set.
-
setFormat
Bean property setter:format .The extending format for the previously mentioned
type
.- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getItems
Bean property getter:items .Describes the type of items in the array.
- Returns:
- The property value, or
null if it is not set.
-
setItems
Bean property setter:items .Describes the type of items in the array.
- Parameters:
value
- The new value for this property.
Property value is required iftype
is"array" .
Can benull to unset the property.- Returns:
- This object
-
getCollectionFormat
Bean property getter:collectionFormat .Determines the format of the array if type array is used.
- Returns:
- The property value, or
null if it is not set.
-
setCollectionFormat
Bean property setter:collectionFormat .Determines the format of the array if type array is used.
- Parameters:
value
- The new value for this property.
Valid values:"csv" (default) - comma separated valuesfoo,bar
."ssv" - space separated valuesfoo bar
."tsv" - tab separated valuesfoo\tbar
."pipes" - pipe separated valuesfoo|bar
.
Can benull to unset the property.- Returns:
- This object
-
getDefault
Bean property getter:default .Declares the value of the item that the server will use if none is provided.
Notes:
-
"default" has no meaning for required items. -
Unlike JSON Schema this value MUST conform to the defined
type
for the data type.
- Returns:
- The property value, or
null if it is not set.
-
-
setDefault
Bean property setter:default .Declares the value of the item that the server will use if none is provided.
Notes:
-
"default" has no meaning for required items. -
Unlike JSON Schema this value MUST conform to the defined
type
for the data type.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
-
getMaximum
Bean property getter:maximum .- Returns:
- The property value, or
null if it is not set.
-
setMaximum
Bean property setter:maximum .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getExclusiveMaximum
Bean property getter:exclusiveMaximum .- Returns:
- The property value, or
null if it is not set.
-
setExclusiveMaximum
Bean property setter:exclusiveMaximum .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getMinimum
Bean property getter:minimum .- Returns:
- The property value, or
null if it is not set.
-
setMinimum
Bean property setter:minimum .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getExclusiveMinimum
Bean property getter:exclusiveMinimum .- Returns:
- The property value, or
null if it is not set.
-
setExclusiveMinimum
Bean property setter:exclusiveMinimum .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getMaxLength
Bean property getter:maxLength .- Returns:
- The property value, or
null if it is not set.
-
setMaxLength
Bean property setter:maxLength .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getMinLength
Bean property getter:minLength .- Returns:
- The property value, or
null if it is not set.
-
setMinLength
Bean property setter:minLength .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getPattern
Bean property getter:pattern .- Returns:
- The property value, or
null if it is not set.
-
setPattern
Bean property setter:pattern .This string SHOULD be a valid regular expression.
- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getMaxItems
Bean property getter:maxItems .- Returns:
- The property value, or
null if it is not set.
-
setMaxItems
Bean property setter:maxItems .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getMinItems
Bean property getter:minItems .- Returns:
- The property value, or
null if it is not set.
-
setMinItems
Bean property setter:minItems .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getUniqueItems
Bean property getter:uniqueItems .- Returns:
- The property value, or
null if it is not set.
-
setUniqueItems
Bean property setter:uniqueItems .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getEnum
Bean property getter:enum .- Returns:
- The property value, or
null if it is not set.
-
setEnum
Bean property setter:enum .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
addEnum
Adds one or more values to theenum property.- Parameters:
values
- The values to add to this property.
Ignored ifnull .- Returns:
- This object
-
setEnum
Adds one or more values to theenum property.- Parameters:
values
- The values to add to this property.
Valid types:Object
Collection<Object>
String
- JSON array representation ofCollection<Object>
Example:
_enum(
"['foo','bar']" );String
- Individual valuesExample:
_enum(
"foo" ,"bar" );
Ignored ifnull .- Returns:
- This object
-
getMultipleOf
Bean property getter:multipleOf .- Returns:
- The property value, or
null if it is not set.
-
setMultipleOf
Bean property setter:multipleOf .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
getRef
Bean property getter:$ref .- Returns:
- The property value, or
null if it is not set.
-
setRef
Bean property setter:$ref .- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object
-
get
Description copied from class:OpenApiElement
Generic property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
get
in classOpenApiElement
- 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.
-
set
Description copied from class:OpenApiElement
Generic property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
set
in classOpenApiElement
- Parameters:
property
- The property name to set. Must not benull .value
- The new value for the property.- Returns:
- This object
-
keySet
Description copied from class:OpenApiElement
Returns all the keys on this element.- Overrides:
keySet
in classOpenApiElement
- Returns:
- All the keys on this element.
Nevernull .
-
resolveRefs
Resolves any"$ref" attributes in this element.- Parameters:
openApi
- 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.
-