Annotation Interface Schema
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This annotation is based on the JSON Schema Specification and supports multiple versions:
- JSON Schema Draft 04 - Core properties (via Swagger 2.0/OpenAPI 3.0)
- JSON Schema Draft 2020-12 - Extended properties and updated semantics
For backward compatibility, all Swagger 2.0 and OpenAPI 3.0 properties are supported. New Draft 2020-12 properties are opt-in and can be used alongside existing properties.
Used to populate the auto-generated Swagger documentation and UI for server-side
Also used to define OpenAPI schema information for POJOs serialized through OpenApiSerializer and parsed through OpenApiParser.
Examples:
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]$comment field of the JSON Schema.String[]$defs field of the JSON Schema.$id field of the JSON Schema.$ref field of the Swagger Schema Object.String[]additionalProperties field of the Swagger Schema Object.booleanSynonym forallowEmptyValue().String[]allOf field of the Swagger Schema Object.booleanallowEmptyValue field of the Swagger Parameter Object.Synonym forcollectionFormat().collectionFormat field.String[]const field of the JSON Schema.contentEncoding field of the JSON Schema.contentMediaType field of the JSON Schema.String[]Synonym fordescription().String[]default field of the Swagger Schema Object.String[]dependentRequired field of the JSON Schema.String[]dependentSchemas field of the JSON Schema.booleandeprecated field of the JSON Schema.String[]description field of the Swagger Schema Object.String[]Synonym fordefault_().discriminator field of the Swagger Schema Object.String[]Synonym forenum_().String[]else field of the JSON Schema.booleanSynonym forexclusiveMaximum().booleanSynonym forexclusiveMinimum().String[]enum field of the Swagger Schema Object.String[]examples field of the JSON Schema.booleanDeprecated.exclusiveMaximum field of the JSON Schema (Draft 2020-12 numeric value).booleanDeprecated.UseexclusiveMinimumValue()for JSON Schema Draft 2020-12 compliance.exclusiveMinimum field of the JSON Schema (Draft 2020-12 numeric value).externalDocs field of the Swagger Schema Object.Synonym forformat().format field of the Swagger Schema Object.String[]if field of the JSON Schema.booleanSpecifies that schema information for this part should not be shown in the generated Swagger documentation.items field of the Swagger Schema Object.Synonym formaximum().longSynonym formaxItems().maximum field of the Swagger Schema Object.longmaxItems field of the Swagger Schema Object.longSynonym formaxLength().longmaxLength field of the Swagger Schema Object.longSynonym formaxProperties().longmaxProperties field of the Swagger Schema Object.Synonym forminimum().longSynonym forminItems().minimum field of the Swagger Schema Object.longminItems field of the Swagger Schema Object.longSynonym forminLength().longminLength field of the Swagger Schema Object.longSynonym forminProperties().longminProperties field of the Swagger Schema Object.Synonym formultipleOf().multipleOf field of the Swagger Schema Object.String[]Dynamically apply this annotation to the specified classes/methods/fields.Class<?>[]Dynamically apply this annotation to the specified classes.Synonym forpattern().pattern field of the Swagger Schema Object.String[]prefixItems field of the JSON Schema.String[]properties field of the Swagger Schema Object.booleanSynonym forrequired().booleanreadOnly field of the Swagger Schema Object.booleanrequired field of the Swagger Schema Object.booleanSynonym forreadOnly().booleanSynonym forskipIfEmpty().booleanSkips this value during serialization if it's an empty string or empty collection/array.Synonym fortype().String[]then field of the JSON Schema.title field of the Swagger Schema Object.type field of the Swagger Schema Object.booleanSynonym foruniqueItems().String[]unevaluatedItems field of the JSON Schema.String[]unevaluatedProperties field of the JSON Schema.booleanuniqueItems field of the Swagger Schema Object.String[]xml field of the Swagger Schema Object.
-
Element Details
-
const_
const field of the JSON Schema.The value of this keyword MAY be of any type, including null. An instance validates successfully against this keyword if its value is equal to the value of this keyword.
This is a JSON Schema Draft 2020-12 property.
Examples:
// A constant string value @Schema (const_="fixed-value" )public String getStatus() {...}// A constant numeric value @Schema (const_="42" )public int getMagicNumber() {...}Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
default_
default field of the Swagger Schema Object.Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request.
(Note: "default" has no meaning for required parameters.)Additionally, this value is used to create instances of POJOs that are then serialized as language-specific examples in the generated Swagger documentation if the examples are not defined in some other way.
The format of this value is a string.
Multiple lines are concatenated with newlines.Examples:
public Order placeOrder(@Header ("X-PetId" )@Schema (default_="100" )long petId ,@Header ("X-AdditionalInfo" )@Schema (format="uon" , default_="(rushOrder=false)" ) AdditionalInfoadditionalInfo ,@Header ("X-Flags" )@Schema (collectionFormat="uon" , default_="@(new-customer)" ) String[]flags ) {...}Used for:
- Server-side schema-based parsing.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing.
- Returns:
- The annotation value.
- Default:
- {}
-
else_
else field of the JSON Schema.This keyword's value MUST be a valid JSON Schema. When "if" is present, and the instance fails to validate against its subschema, then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema.
This is a JSON Schema Draft 2020-12 property that provides conditional schema validation.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
enum_
enum field of the Swagger Schema Object.If specified, the input validates successfully if it is equal to one of the elements in this array.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).The format is either individual values or a comma-delimited list.
Multiple lines are concatenated with newlines.Examples:
// Comma-delimited list public Collection<Pet> findPetsByStatus(@Header ("X-Status" )@Schema (enum_="AVAILABLE,PENDING,SOLD" ) PetStatusstatus ) {...}Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- {}
-
if_
if field of the JSON Schema.This keyword's value MUST be a valid JSON Schema. This validation outcome of this keyword's subschema has no direct effect on the overall validation result. Rather, it controls which of the "then" or "else" keywords are evaluated.
This is a JSON Schema Draft 2020-12 property that provides conditional schema validation.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
then_
then field of the JSON Schema.This keyword's value MUST be a valid JSON Schema. When "if" is present, and the instance successfully validates against its subschema, then validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema.
This is a JSON Schema Draft 2020-12 property that provides conditional schema validation.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
$comment
$comment field of the JSON Schema.This keyword reserves a location for comments from schema authors to readers or maintainers of the schema. The value of this keyword MUST be a string. Implementations MUST NOT present this string to end users. Tools for editing schemas SHOULD support displaying and editing this keyword.
This is a JSON Schema Draft 2020-12 property.
Examples:
@Schema ( type="string" , $comment="This field is deprecated but maintained for backward compatibility" )public String getLegacyField() {...}See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
$defs
$defs field of the JSON Schema.The "$defs" keyword reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema. The value of this keyword MUST be an object. Each value of this object MUST be a valid JSON Schema.
This is a JSON Schema Draft 2020-12 property that replaces the older "definitions" keyword.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
$id
$id field of the JSON Schema.The "$id" keyword defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.
This is a JSON Schema Draft 2020-12 property.
Examples:
@Schema ( $id="https://example.com/schemas/person.json" , type="object" )public class Person {...}See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
$ref
$ref field of the Swagger Schema Object.A JSON reference to the schema definition.
Notes:
- The format is a JSON Reference.
- Returns:
- The annotation value.
- Default:
- ""
-
additionalProperties
additionalProperties field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-swagger-v2 object.
-
aev
boolean aevSynonym forallowEmptyValue().- Returns:
- The annotation value.
- Default:
- false
-
allOf
allOf field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-swagger-v2 object.
-
allowEmptyValue
boolean allowEmptyValueallowEmptyValue field of the Swagger Parameter Object.Sets the ability to pass empty-valued heaver values.
Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
Note: This is technically only valid for either query or formData parameters, but support is provided anyway for backwards compatability.
- Returns:
- The annotation value.
- Default:
- false
-
cf
Synonym forcollectionFormat().- Returns:
- The annotation value.
- Default:
- ""
-
collectionFormat
collectionFormat field.Note that this field isn't part of the Swagger 2.0 specification, but the specification does not specify how items are supposed to be represented.
Determines the format of the array if
type "array" is used.
Can only be used iftype is"array" .Static strings are defined in
CollectionFormatType.Note that for collections/arrays parameters with POJO element types, the input is broken into a string array before being converted into POJO elements.
Used for:
- Server-side schema-based parsing.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing.
Note that for collections/arrays parameters with POJO element types, the input is broken into a string array before being converted into POJO elements.
"csv" (default) - Comma-separated values (e.g."foo,bar" )."ssv" - Space-separated values (e.g."foo bar" )."tsv" - Tab-separated values (e.g."foo\tbar" )."pipes - Pipe-separated values (e.g."foo|bar" )."multi" - Corresponds to multiple parameter instances instead of multiple values for a single instance (e.g."foo=bar&foo=baz" )."uon" - UON notation (e.g."@(foo,bar)" ).
- Returns:
- The annotation value.
- Default:
- ""
-
contentEncoding
contentEncoding field of the JSON Schema.If the instance is a string, this property defines the encoding used to store the contents. Common values: "base64", "quoted-printable", "7bit", "8bit", "binary"
This is a JSON Schema Draft 2020-12 property.
Examples:
// A base64-encoded binary string @Schema ( type="string" , contentEncoding="base64" , contentMediaType="image/png" )public String getImageData() {...}Used for:
- Server-side generated Swagger documentation.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
contentMediaType
contentMediaType field of the JSON Schema.If the instance is a string, this property defines the MIME type of the contents of the string.
This is a JSON Schema Draft 2020-12 property.
Examples:
// A string containing JSON data @Schema ( type="string" , contentMediaType="application/json" )public String getJsonData() {...}Used for:
- Server-side generated Swagger documentation.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
d
Synonym fordescription().- Returns:
- The annotation value.
- Default:
- {}
-
dependentRequired
dependentRequired field of the JSON Schema.This keyword specifies properties that are required if a specific other property is present. The value of this keyword MUST be an object where each value is an array of strings.
This is a JSON Schema Draft 2020-12 property.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
dependentSchemas
dependentSchemas field of the JSON Schema.This keyword specifies subschemas that are evaluated if the instance is an object and contains a certain property. The value of this keyword MUST be an object where each value is a valid JSON Schema.
This is a JSON Schema Draft 2020-12 property.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
deprecatedProperty
boolean deprecatedPropertydeprecated field of the JSON Schema.The value of this keyword MUST be a boolean. When true, applications SHOULD refrain from usage of the declared property. It may mean the property is going to be removed in the future.
This is a JSON Schema Draft 2020-12 property.
Examples:
@Schema (deprecated=true )@Deprecated public String getOldMethod() {...}Used for:
- Server-side generated Swagger documentation.
See Also:
- Returns:
- The annotation value.
- Default:
- false
-
description
description field of the Swagger Schema Object.A brief description of the body. This could contain examples of use.
Examples:
// Used on parameter @RestPost public void addPet(@Content @Schema (description="Pet object to add to the store" ) Petinput ) {...}// Used on class @RestPost public void addPet(Petinput ) {...}@Content @Schema (description="Pet object to add to the store" )public class Pet {...}Notes:
-
The format is plain text.
Multiple lines are concatenated with newlines. -
Supports SVL Variables (e.g.
"$L{my.localized.variable}" ) for the swagger generator.
- Returns:
- The annotation value.
- Default:
- {}
-
The format is plain text.
-
df
Synonym fordefault_().- Returns:
- The annotation value.
- Default:
- {}
-
discriminator
discriminator field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- ""
-
The format is a juneau-bean-swagger-v2 object.
-
e
Synonym forenum_().- Returns:
- The annotation value.
- Default:
- {}
-
emax
boolean emaxSynonym forexclusiveMaximum().- Returns:
- The annotation value.
- Default:
- false
-
emin
boolean eminSynonym forexclusiveMinimum().- Returns:
- The annotation value.
- Default:
- false
-
examples
examples field of the JSON Schema.The value of this keyword MUST be an array. There are no restrictions on the values within the array. When multiple examples are applicable, an array of examples can be used.
This is a JSON Schema Draft 2020-12 property.
Examples:
// Multiple examples of valid values @Schema ( type="string" , examples={"red" ,"green" ,"blue" } )public String getColor() {...}Used for:
- Server-side generated Swagger documentation.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
exclusiveMaximum
Deprecated.UseexclusiveMaximumValue()for JSON Schema Draft 2020-12 compliance.exclusiveMaximum field of the Swagger Schema Object.Defines whether the maximum is matched exclusively.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"integer" ,"number" .
Iftrue , must be accompanied withmaximum .Notes:
-
Deprecated in JSON Schema Draft 2020-12: This boolean format is from Swagger 2.0/OpenAPI 3.0 and JSON Schema Draft 04.
Consider using
exclusiveMaximumValue()for Draft 2020-12 compliance, which uses a numeric value instead. For backward compatibility, ifexclusiveMaximumValue()is set, it takes precedence over this property.
Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- false
-
Deprecated in JSON Schema Draft 2020-12: This boolean format is from Swagger 2.0/OpenAPI 3.0 and JSON Schema Draft 04.
Consider using
-
exclusiveMaximumValue
exclusiveMaximum field of the JSON Schema (Draft 2020-12 numeric value).The value of this keyword MUST be a number. The instance is valid if it is strictly less than (not equal to) the value specified by this keyword.
This is a JSON Schema Draft 2020-12 property that replaces the boolean
exclusiveMaximum(). For backward compatibility, both properties are supported. If this property is specified, it takes precedence over the boolean version.Examples:
// A number that must be strictly less than 100 @Schema ( type="number" , exclusiveMaximumValue="100" )public Double getPercentage() {...}Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
exclusiveMinimum
Deprecated.UseexclusiveMinimumValue()for JSON Schema Draft 2020-12 compliance.exclusiveMinimum field of the Swagger Schema Object.Defines whether the minimum is matched exclusively.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"integer" ,"number" .
Iftrue , must be accompanied withminimum .Notes:
-
Deprecated in JSON Schema Draft 2020-12: This boolean format is from Swagger 2.0/OpenAPI 3.0 and JSON Schema Draft 04.
Consider using
exclusiveMinimumValue()for Draft 2020-12 compliance, which uses a numeric value instead. For backward compatibility, ifexclusiveMinimumValue()is set, it takes precedence over this property.
Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- false
-
Deprecated in JSON Schema Draft 2020-12: This boolean format is from Swagger 2.0/OpenAPI 3.0 and JSON Schema Draft 04.
Consider using
-
exclusiveMinimumValue
exclusiveMinimum field of the JSON Schema (Draft 2020-12 numeric value).The value of this keyword MUST be a number. The instance is valid if it is strictly greater than (not equal to) the value specified by this keyword.
This is a JSON Schema Draft 2020-12 property that replaces the boolean
exclusiveMinimum(). For backward compatibility, both properties are supported. If this property is specified, it takes precedence over the boolean version.Examples:
// A number that must be strictly greater than 0 @Schema ( type="number" , exclusiveMinimumValue="0" )public Double getPositiveNumber() {...}Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
externalDocs
externalDocs field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- @org.apache.juneau.annotation.ExternalDocs
-
The format is a juneau-bean-swagger-v2 object.
-
f
Synonym forformat().- Returns:
- The annotation value.
- Default:
- ""
-
format
format field of the Swagger Schema Object.The extending format for the previously mentioned parameter type.
Static strings are defined in
FormatType.Examples:
// Used on parameter @RestPut public void setAge(@Content @Schema (type="integer" , format="int32" ) Stringinput ) {...}Used for:
- Server-side schema-based parsing.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing.
-
"int32" - Signed 32 bits.
Only valid with type"integer" . -
"int64" - Signed 64 bits.
Only valid with type"integer" . -
"float" - 32-bit floating point number.
Only valid with type"number" . -
"double" - 64-bit floating point number.
Only valid with type"number" . -
"byte" - BASE-64 encoded characters.
Only valid with type"string" .
Parameters of type POJO convertible from string are converted after the string has been decoded. -
"binary" - Hexadecimal encoded octets (e.g."00FF" ).
Only valid with type"string" .
Parameters of type POJO convertible from string are converted after the string has been decoded. -
"date" - An RFC3339 full-date.
Only valid with type"string" . -
"date-time" - An RFC3339 date-time.
Only valid with type"string" . -
"password" - Used to hint UIs the input needs to be obscured.
This format does not affect the serialization or parsing of the parameter. -
"uon" - UON notation (e.g."(foo=bar,baz=@(qux,123))" ).
Only valid with type"object" .
If not specified, then the input is interpreted as plain-text and is converted to a POJO directly.
Notes:
- The format is plain text.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
ignore
boolean ignoreSpecifies that schema information for this part should not be shown in the generated Swagger documentation.- Returns:
- The annotation value.
- Default:
- false
-
items
items field of the Swagger Schema Object.Describes the type of items in the array.
Required if
type is"array" .
Can only be used iftype is"array" .Used for:
- Server-side schema-based parsing and parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing and serializing validation.
- Returns:
- The annotation value.
- Default:
- @org.apache.juneau.annotation.Items
-
max
Synonym formaximum().- Returns:
- The annotation value.
- Default:
- ""
-
maxi
long maxiSynonym formaxItems().- Returns:
- The annotation value.
- Default:
- -1L
-
maximum
maximum field of the Swagger Schema Object.Defines the maximum value for a parameter of numeric types.
The value must be a valid JSON number.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"integer" ,"number" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- ""
-
maxItems
long maxItemsmaxItems field of the Swagger Schema Object.An array or collection is valid if its size is less than, or equal to, the value of this keyword.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"array" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- -1L
-
maxl
long maxlSynonym formaxLength().- Returns:
- The annotation value.
- Default:
- -1L
-
maxLength
long maxLengthmaxLength field of the Swagger Schema Object.A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 4627.
The value-1 is always ignored.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"string" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- -1L
-
maxp
long maxpSynonym formaxProperties().- Returns:
- The annotation value.
- Default:
- -1L
-
maxProperties
long maxPropertiesmaxProperties field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- -1L
-
The format is a juneau-bean-swagger-v2 object.
-
min
Synonym forminimum().- Returns:
- The annotation value.
- Default:
- ""
-
mini
long miniSynonym forminItems().- Returns:
- The annotation value.
- Default:
- -1L
-
minimum
minimum field of the Swagger Schema Object.Defines the minimum value for a parameter of numeric types.
The value must be a valid JSON number.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"integer" ,"number" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- ""
-
minItems
long minItemsminItems field of the Swagger Schema Object.An array or collection is valid if its size is greater than, or equal to, the value of this keyword.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"array" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- -1L
-
minl
long minlSynonym forminLength().- Returns:
- The annotation value.
- Default:
- -1L
-
minLength
long minLengthminLength field of the Swagger Schema Object.A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
The length of a string instance is defined as the number of its characters as defined by RFC 4627.
The value-1 is always ignored.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"string" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- -1L
-
minp
long minpSynonym forminProperties().- Returns:
- The annotation value.
- Default:
- -1L
-
minProperties
long minPropertiesminProperties field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- -1L
-
The format is a juneau-bean-swagger-v2 object.
-
mo
Synonym formultipleOf().- Returns:
- The annotation value.
- Default:
- ""
-
multipleOf
multipleOf field of the Swagger Schema Object.A numeric instance is valid if the result of the division of the instance by this keyword's value is an integer.
The value must be a valid JSON number.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Only allowed for the following types:
"integer" ,"number" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- ""
-
on
Dynamically apply this annotation to the specified classes/methods/fields.Used in conjunction with
BeanContext.Builder.applyAnnotations(Class...)to dynamically apply an annotation to an existing class/method/field. It is ignored when the annotation is applied directly to classes/methods/fields.Valid patterns:
- Classes:
- Fully qualified:
"com.foo.MyClass"
- Fully qualified inner class:
"com.foo.MyClass$Inner1$Inner2"
- Simple:
"MyClass"
- Simple inner:
"MyClass$Inner1$Inner2" "Inner1$Inner2" "Inner2"
- Fully qualified:
- Methods:
- Fully qualified with args:
"com.foo.MyClass.myMethod(String,int)" "com.foo.MyClass.myMethod(java.lang.String,int)" "com.foo.MyClass.myMethod()"
- Fully qualified:
"com.foo.MyClass.myMethod"
- Simple with args:
"MyClass.myMethod(String,int)" "MyClass.myMethod(java.lang.String,int)" "MyClass.myMethod()"
- Simple:
"MyClass.myMethod"
- Simple inner class:
"MyClass$Inner1$Inner2.myMethod" "Inner1$Inner2.myMethod" "Inner2.myMethod"
- Fully qualified with args:
- Fields:
- Fully qualified:
"com.foo.MyClass.myField"
- Simple:
"MyClass.myField"
- Simple inner class:
"MyClass$Inner1$Inner2.myField" "Inner1$Inner2.myField" "Inner2.myField"
- Fully qualified:
- A comma-delimited list of anything on this list.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
- Classes:
-
onClass
Dynamically apply this annotation to the specified classes.Identical to
on()except allows you to specify class objects instead of a strings.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
p
Synonym forpattern().- Returns:
- The annotation value.
- Default:
- ""
-
pattern
pattern field of the Swagger Schema Object.A string input is valid if it matches the specified regular expression pattern.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Example:
@RestPut public void doPut(@Content @Schema (pattern="/\\w+\\.\\d+/" ) Stringinput ) {...}Only allowed for the following types:
"string" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- ""
-
prefixItems
prefixItems field of the JSON Schema.The value of "prefixItems" MUST be a non-empty array of valid JSON Schemas. Validation succeeds if each element of the instance validates against the schema at the same position, if any.
This is a JSON Schema Draft 2020-12 property that provides tuple validation for arrays.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
properties
properties field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-swagger-v2 object.
-
r
boolean rSynonym forrequired().- Returns:
- The annotation value.
- Default:
- false
-
readOnly
boolean readOnlyreadOnly field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- false
-
The format is a juneau-bean-swagger-v2 object.
-
required
boolean requiredrequired field of the Swagger Schema Object.Determines whether the parameter is mandatory.
If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).Examples:
// Used on parameter @RestPost public void addPet(@Content @Schema (required=true ) Petinput ) {...}// Used on class @RestPost public void addPet(Petinput ) {...}@Content (required=true )public class Pet {...}Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- false
-
ro
boolean roSynonym forreadOnly().- Returns:
- The annotation value.
- Default:
- false
-
sie
boolean sieSynonym forskipIfEmpty().- Returns:
- The annotation value.
- Default:
- false
-
skipIfEmpty
boolean skipIfEmptySkips this value during serialization if it's an empty string or empty collection/array.Note that
null values are already ignored.Used for:
- Client-side schema-based serializing.
- Returns:
- The annotation value.
- Default:
- false
-
t
Synonym fortype().- Returns:
- The annotation value.
- Default:
- ""
-
title
- Returns:
- The annotation value.
- Default:
- ""
-
type
type field of the Swagger Schema Object.The type of the parameter.
Examples:
// Used on parameter @RestPost public void addPet(@Content @Schema (type="object" ) Petinput ) {...}// Used on class @RestPost public void addPet(Petinput ) {...}@Content @Schema (type="object" )public class Pet {...}Used for:
- Server-side schema-based parsing.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing.
-
"string"
Parameter must be a string or a POJO convertible from a string. -
"number"
Parameter must be a number primitive or number object.
If parameter isObject , creates either aFloat orDouble depending on the size of the number. -
"integer"
Parameter must be a integer/long primitive or integer/long object.
If parameter isObject , creates either aShort ,Integer , orLong depending on the size of the number. -
"boolean"
Parameter must be a boolean primitive or object. -
"array"
Parameter must be an array or collection.
Elements must be strings or POJOs convertible from strings.
If parameter isObject , creates anJsonList. -
"object"
Parameter must be a map or bean.
If parameter isObject , creates anJsonMap.
Note that this is an extension of the OpenAPI schema as Juneau allows for arbitrarily-complex POJOs to be serialized as HTTP parts. -
"file"
This type is currently not supported.
Notes:
- Static strings are defined in
ParameterType.
See Also:
- Returns:
- The annotation value.
- Default:
- ""
-
ui
boolean uiSynonym foruniqueItems().- Returns:
- The annotation value.
- Default:
- false
-
unevaluatedItems
unevaluatedItems field of the JSON Schema.The value of "unevaluatedItems" MUST be a valid JSON Schema. This schema applies to array items that were not evaluated by "items", "prefixItems", "contains", etc.
This is a JSON Schema Draft 2020-12 property.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
unevaluatedProperties
unevaluatedProperties field of the JSON Schema.The value of "unevaluatedProperties" MUST be a valid JSON Schema. This schema applies to object properties that were not evaluated by "properties", "patternProperties", etc.
This is a JSON Schema Draft 2020-12 property.
Notes:
-
The format is a juneau-bean-jsonschema object.
Multiple lines are concatenated with newlines.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-jsonschema object.
-
uniqueItems
boolean uniqueItemsuniqueItems field of the Swagger Schema Object.If
true the input validates successfully if all of its elements are unique.If validation fails during serialization or parsing, the part serializer/parser will throw a
SchemaValidationException.
On the client-side, this gets converted to aRestCallException which is thrown before the connection is made.
On the server-side, this gets converted to aBadRequest (400).If the parameter type is a subclass of
Set, this validation is skipped (since a set can only contain unique items anyway).
Otherwise, the collection or array is checked for duplicate items.Only allowed for the following types:
"array" .Used for:
- Server-side schema-based parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing validation.
- Returns:
- The annotation value.
- Default:
- false
-
xml
xml field of the Swagger Schema Object.Notes:
-
The format is a juneau-bean-swagger-v2 object.
Multiple lines are concatenated with newlines.
- Returns:
- The annotation value.
- Default:
- {}
-
The format is a juneau-bean-swagger-v2 object.
-
exclusiveMaximumValue()for JSON Schema Draft 2020-12 compliance.