@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 |
collectionFormat
|
String[] |
description
|
String |
discriminator
|
String[] |
example
|
String[] |
examples
|
boolean |
exclusiveMaximum
|
boolean |
exclusiveMinimum
|
ExternalDocs |
externalDocs
|
String |
format
|
boolean |
ignore
Specifies that schema information for this part should not be shown in the generated Swagger documentation.
|
Items |
items
|
String |
maximum
|
long |
maxItems
|
long |
maxLength
|
long |
maxProperties
|
String |
minimum
|
long |
minItems
|
long |
minLength
|
long |
minProperties
|
String |
multipleOf
|
String |
pattern
|
String[] |
properties
|
boolean |
readOnly
|
boolean |
required
|
String |
title
|
String |
type
|
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[] _default
public abstract String multipleOf
public abstract String maximum
public abstract boolean exclusiveMaximum
public abstract String minimum
public abstract boolean exclusiveMinimum
public abstract long maxLength
public abstract long minLength
public abstract String pattern
public abstract long maxItems
public abstract long minItems
public abstract boolean uniqueItems
public abstract long maxProperties
public abstract long minProperties
public abstract boolean required
Determines whether this parameter is mandatory.
The property MAY be included and its default value is false.
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[] allOf
public abstract String[] properties
public abstract String[] additionalProperties
public abstract String discriminator
public abstract boolean 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[] examples
This is a JSON object whose keys are media types and values are string representations of that value.
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:
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.