Class Items
The Items Object is a limited subset of JSON-Schema's items object for Swagger 2.0. 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.
Swagger 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 TypeMethodDescriptionBean property fluent setter:enum .copy()Make a deep copy of this object.<T> TGeneric 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(Swagger swagger, 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 .Bean property setter:enum .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 .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
-
addEnum
Bean property fluent setter:enum .- Parameters:
value- The new value for this property.
String values can be JSON arrays.- 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.
-
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.
-
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.
-
-
getEnum
Bean property getter:enum .- 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.
-
getFormat
Bean property getter:format .The extending format for the previously mentioned
type .- Returns:
- The property value, or
null if it is not set.
-
getItems
Bean property getter:items .Describes the type of items in the array.
- 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.
-
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.
-
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.
-
getRef
Bean property getter:$ref .- Returns:
- The property value, or
null if it is not set.
-
getType
Bean property getter:type .The internal type of the array.
- 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.
-
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.
-
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.
-
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.
-
-
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 setter:enum .- 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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
setRef
Bean property setter:$ref .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
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.
-
setUniqueItems
Bean property setter:uniqueItems .- Parameters:
value- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
strict
Description copied from class:SwaggerElementSets 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.
-