@Documented @Retention(value=RUNTIME) public @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 object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
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
.
Modifier and Type | Optional Element and Description |
---|---|
String[] |
_default
|
String[] |
_enum
|
String |
$ref
|
String[] |
additionalProperties
|
String[] |
allOf
|
String |
cf
Synonym for
collectionFormat() . |
String |
collectionFormat
|
String[] |
d
Synonym for
description() . |
String[] |
description
|
String[] |
df
Synonym for
_default() . |
String |
discriminator
|
String[] |
e
Synonym for
_enum() . |
boolean |
emax
Synonym for
exclusiveMaximum() . |
boolean |
emin
Synonym for
exclusiveMinimum() . |
String[] |
ex
Synonym for
readOnly() . |
String[] |
example
|
String[] |
examples
|
boolean |
exclusiveMaximum
|
boolean |
exclusiveMinimum
|
String[] |
exs
Synonym for
examples() . |
ExternalDocs |
externalDocs
|
String |
f
Synonym for
format() . |
String |
format
|
boolean |
ignore
Specifies that schema information for this part should not be shown in the generated Swagger documentation.
|
Items |
items
|
String |
max
Synonym for
maximum() . |
long |
maxi
Synonym for
maxItems() . |
String |
maximum
|
long |
maxItems
|
long |
maxl
Synonym for
maxLength() . |
long |
maxLength
|
long |
maxp
Synonym for
maxProperties() . |
long |
maxProperties
|
String |
min
Synonym for
minimum() . |
long |
mini
Synonym for
minItems() . |
String |
minimum
|
long |
minItems
|
long |
minl
Synonym for
minLength() . |
long |
minLength
|
long |
minp
Synonym for
minProperties() . |
long |
minProperties
|
String |
mo
Synonym for
multipleOf() . |
String |
multipleOf
|
String |
on
Dynamically apply this annotation to the specified classes/methods/fields.
|
String |
p
Synonym for
pattern() . |
String |
pattern
|
String[] |
properties
|
boolean |
r
Synonym for
required() . |
boolean |
readOnly
|
boolean |
required
|
boolean |
ro
Synonym for
readOnly() . |
String |
t
Synonym for
type() . |
String |
title
|
String |
type
|
boolean |
ui
Synonym for
uniqueItems() . |
boolean |
uniqueItems
|
String[] |
value
Free-form value for the Swagger Schema Object.
|
String[] |
xml
|
public abstract String $ref
A JSON reference to the schema definition.
public abstract String format
public abstract String title
public abstract String[] description
A brief description of the body. This could contain examples of use.
public abstract String[] d
description()
.public abstract String[] _default
public abstract String[] df
_default()
.public abstract String multipleOf
public abstract String mo
multipleOf()
.public abstract String maximum
public abstract boolean exclusiveMaximum
public abstract boolean emax
exclusiveMaximum()
.public abstract String minimum
public abstract boolean exclusiveMinimum
public abstract boolean emin
exclusiveMinimum()
.public abstract long maxLength
public abstract long maxl
maxLength()
.public abstract long minLength
public abstract long minl
minLength()
.public abstract String pattern
public abstract long maxItems
public abstract long maxi
maxItems()
.public abstract long minItems
public abstract long mini
minItems()
.public abstract boolean uniqueItems
public abstract boolean ui
uniqueItems()
.public abstract long maxProperties
public abstract long maxp
maxProperties()
.public abstract long minProperties
public abstract long minp
minProperties()
.public abstract boolean required
Determines whether this parameter is mandatory.
The property MAY be included and its default value is false.
public abstract boolean r
required()
.public abstract String[] _enum
public abstract String type
public abstract Items items
public abstract String collectionFormat
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
Can only be used if
Possible values are:
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.
public abstract String cf
collectionFormat()
.public abstract String[] allOf
public abstract String[] properties
public abstract String[] additionalProperties
public abstract String discriminator
public abstract boolean readOnly
public abstract boolean ro
readOnly()
.public abstract String[] xml
public abstract ExternalDocs externalDocs
public abstract String[] example
A free-form property to include an example of an instance for this schema.
This attribute defines a JSON representation of the body value that is used by
public abstract String[] ex
readOnly()
.public abstract String[] examples
This is a JSON object whose keys are media types and values are string representations of that value.
public abstract String[] exs
examples()
.public abstract boolean ignore
public abstract String[] value
This is a JSON object that makes up the swagger information for this field.
The following are completely equivalent ways of defining the swagger description of a Schema object:
The reasons why you may want to use this field include:
public abstract String on
Used in conjunction with the JsonSchemaConfig.applySchema()
.
It is ignored when the annotation is applied directly to classes/methods/fields.
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.