@Target(value={FIELD,METHOD,PARAMETER,TYPE,ANNOTATION_TYPE}) @Retention(value=RUNTIME) @Inherited public @interface Schema
swagger-core resolver and swagger-jaxrs2 reader engine consider this annotation along with JAX-RS annotations, element type and context as input to resolve the annotated element into an OpenAPI schema definition for such element.
The annotation may be used also to override partly (e.g. the name) or fully (e.g providing a completely different
representation) the schema of an element; for example if a specific class is provided as value of implementation()
,
it will override the element type
The annotation ArraySchema
shall be used for array elements; ArraySchema
and Schema
cannot
coexist
ArraySchema
Modifier and Type | Optional Element and Description |
---|---|
Schema.AccessMode |
accessMode
Allows to specify the access mode (AccessMode.READ_ONLY, READ_WRITE)
AccessMode.READ_ONLY: value will not be written to during a request but may be returned during a response.
|
Class<?>[] |
allOf
Provides an array of java class implementations which can be used to describe multiple acceptable schemas.
|
String[] |
allowableValues
Provides a list of allowable values.
|
Class<?>[] |
anyOf
Provides an array of java class implementations which can be used to describe multiple acceptable schemas.
|
String |
defaultValue
Provides a default value.
|
boolean |
deprecated
Specifies that a schema is deprecated and should be transitioned out of usage.
|
String |
description
A description of the schema.
|
DiscriminatorMapping[] |
discriminatorMapping
Provides discriminator mapping values.
|
String |
discriminatorProperty
Provides a discriminator property value.
|
boolean |
enumAsRef
Allows enums to be resolved as a reference to a scheme added to components section.
|
String |
example
Provides an example of the schema.
|
boolean |
exclusiveMaximum
if true, makes the maximum value exclusive, or a less-than criteria.
|
boolean |
exclusiveMinimum
If true, makes the minimum value exclusive, or a greater-than criteria.
|
Extension[] |
extensions
The list of optional extensions
|
ExternalDocumentation |
externalDocs
Additional external documentation for this schema.
|
String |
format
Provides an optional override for the format.
|
boolean |
hidden
Allows schema to be marked as hidden.
|
Class<?> |
implementation
Provides a java class as implementation for this schema.
|
String |
maximum
Sets the maximum numeric value for a property.
|
int |
maxLength
Sets the maximum length of a string value.
|
int |
maxProperties
Constrains the number of arbitrary properties when additionalProperties is defined.
|
String |
minimum
Sets the minimum numeric value for a property.
|
int |
minLength
Sets the minimum length of a string value.
|
int |
minProperties
Constrains the number of arbitrary properties when additionalProperties is defined.
|
double |
multipleOf
Constrains a value such that when divided by the multipleOf, the remainder must be an integer.
|
String |
name
The name of the schema or property.
|
Class<?> |
not
Provides a java class to be used to disallow matching properties.
|
boolean |
nullable
If true, designates a value as possibly null.
|
Class<?>[] |
oneOf
Provides an array of java class implementations which can be used to describe multiple acceptable schemas.
|
String |
pattern
A pattern that the value must satisfy.
|
boolean |
readOnly
Deprecated.
As of 2.0.0, replaced by
accessMode() |
String |
ref
References a schema definition in an external OpenAPI document.
|
boolean |
required
Mandates that the annotated item is required or not.
|
String[] |
requiredProperties
Allows multiple properties in an object to be marked as required.
|
Class<?>[] |
subTypes
An array of the sub types inheriting from this model.
|
String |
title
A title to explain the purpose of the schema.
|
String |
type
Provides an override for the basic type of the schema.
|
boolean |
writeOnly
Deprecated.
As of 2.0.0, replaced by
accessMode() |
public abstract Class<?> implementation
public abstract Class<?> not
public abstract Class<?>[] oneOf
public abstract Class<?>[] anyOf
public abstract Class<?>[] allOf
public abstract String name
public abstract String title
public abstract double multipleOf
public abstract String maximum
public abstract boolean exclusiveMaximum
public abstract String minimum
public abstract boolean exclusiveMinimum
public abstract int maxLength
public abstract int minLength
public abstract String pattern
public abstract int maxProperties
public abstract int minProperties
public abstract String[] requiredProperties
public abstract boolean required
public abstract String description
public abstract String format
public abstract String ref
public abstract boolean nullable
@Deprecated public abstract boolean readOnly
accessMode()
@Deprecated public abstract boolean writeOnly
accessMode()
public abstract Schema.AccessMode accessMode
public abstract String example
public abstract ExternalDocumentation externalDocs
public abstract boolean deprecated
public abstract String type
public abstract String[] allowableValues
public abstract String defaultValue
public abstract String discriminatorProperty
public abstract DiscriminatorMapping[] discriminatorMapping
public abstract boolean hidden
public abstract boolean enumAsRef
public abstract Class<?>[] subTypes
public abstract Extension[] extensions
Copyright © 2021. All rights reserved.