org.eclipse.microprofile.openapi.annotations.media

## Annotation Type SchemaProperty

    @Retention(value=RUNTIME)
     @Inherited
    public @interface SchemaProperty

The SchemaProperty Object allows the definition of input and output data types nested within the `properties` attribute of a `Schema` annotation. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00.

Since:
  2.0
See Also:
  OpenAPI Specification Schema Object

### Required Element Summary

Required Elements
`String` `name` The name of the property.

### Optional Element Summary

Optional Elements
`Class<?>[]` `allOf` Provides an array of java class implementations which can be used to describe multiple acceptable schemas.
`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` An array of discriminator mappings.
`String` `discriminatorProperty` Provides a discriminator property value.
`String[]` `enumeration` Provides a list of enum values.
`String` `example` A free-form property to include an example of an instance for this 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.
`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` `maxItems` Only applicable if type=array.
`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` `minItems` Only applicable if type=array.
`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.
`Class<?>` `not` Provides a java class to be used to disallow matching properties.
`boolean` `nullable` Allows sending a null value for the defined schema.
`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` Relevant only for Schema "properties" definitions.
`String` `ref` Reference value to a Schema definition.
`String[]` `requiredProperties` Allows multiple properties in an object to be marked as required.
`String` `title` A title to explain the purpose of the schema.
`SchemaType` `type` Provides an override for the basic type of the schema.
`boolean` `uniqueItems` Only applicable if type=array.
`boolean` `writeOnly` Relevant only for Schema "properties" definitions.

### Element Detail

#### name

    public abstract String name

The name of the property.

The name will be used as the key to add this schema to the parent schema's 'properties' map.

Returns:
  the name of the schema

#### implementation

    public abstract Class<?> implementation

Provides a java class as implementation for this schema. When provided, additional information in the Schema annotation (except for type information) will augment the java class after introspection.

Returns:
  a class that implements this schema

Default:
  java.lang.Void.class

#### not

    public abstract Class<?> not

Provides a java class to be used to disallow matching properties. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Returns:
  a class with disallowed properties

Default:
  java.lang.Void.class

#### oneOf

    public abstract Class<?>[] oneOf

Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If more than one match the derived schemas, a validation error will occur.

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Returns:
  the list of possible classes for a single match

Default:
  {}

#### anyOf

    public abstract Class<?>[] anyOf

Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If any match, the schema will be considered valid.

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Returns:
  the list of possible class matches

Default:
  {}

#### allOf

    public abstract Class<?>[] allOf

Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If all match, the schema will be considered valid.

Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.

Returns:
  the list of classes to match

Default:
  {}

#### title

    public abstract String title

A title to explain the purpose of the schema.

Returns:
  the title of the schema

Default:
  ""

#### multipleOf

    public abstract double multipleOf

Constrains a value such that when divided by the multipleOf, the remainder must be an integer. Ignored if the value is 0.

Returns:
  the multiplier constraint of the schema

Default:
  0.0

#### maximum

    public abstract String maximum

Sets the maximum numeric value for a property. Value must be a valid number. Ignored if the value is an empty string or not a number.

Returns:
  the maximum value for this schema

Default:
  ""

#### exclusiveMaximum

    public abstract boolean exclusiveMaximum

If true, makes the maximum value exclusive, or a less-than criteria.

Returns:
  the exclusive maximum value for this schema

Default:
  false

#### minimum

    public abstract String minimum

Sets the minimum numeric value for a property. Value must be a valid number. Ignored if the value is an empty string or not a number.

Returns:
  the minimum value for this schema

Default:
  ""

#### exclusiveMinimum

    public abstract boolean exclusiveMinimum

If true, makes the minimum value exclusive, or a greater-than criteria.

Returns:
  the exclusive minimum value for this schema

Default:
  false

#### maxLength

    public abstract int maxLength

Sets the maximum length of a string value. Ignored if the value is negative.

Returns:
  the maximum length of this schema

Default:
  2147483647

#### minLength

    public abstract int minLength

Sets the minimum length of a string value. Ignored if the value is negative.

Returns:
  the minimum length of this schema

Default:
  0

#### pattern

    public abstract String pattern

A pattern that the value must satisfy. Ignored if the value is an empty string.

Returns:
  the pattern of this schema

Default:
  ""

#### maxProperties

    public abstract int maxProperties

Constrains the number of arbitrary properties when additionalProperties is defined. Ignored if value is 0.

Returns:
  the maximum number of properties for this schema

Default:
  0

#### minProperties

    public abstract int minProperties

Constrains the number of arbitrary properties when additionalProperties is defined. Ignored if value is 0.

Returns:
  the minimum number of properties for this schema

Default:
  0

#### requiredProperties

    public abstract String[] requiredProperties

Allows multiple properties in an object to be marked as required.

Returns:
  the list of required schema properties

Default:
  {}

#### description

    public abstract String description

A description of the schema.

Returns:
  this schema's description

Default:
  ""

#### format

    public abstract String format

Provides an optional override for the format.

If a consumer is unaware of the meaning of the format, they shall fall back to using the basic type without format. For example, if \"type: integer, format: int128\" were used to designate a very large integer, most consumers will not understand how to handle it, and fall back to simply \"type: integer\"

Returns:
  this schema's format

Default:
  ""

#### ref

    public abstract String ref

Reference value to a Schema definition.

This property provides a reference to an object defined elsewhere. This property and all other properties are mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined.

Returns:
  a reference to a schema definition

Default:
  ""

#### nullable

    public abstract boolean nullable

Allows sending a null value for the defined schema.

Returns:
  whether or not this schema is nullable

Default:
  false

#### readOnly

    public abstract boolean readOnly

Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request.

If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true.

Returns:
  whether or not this schema is read only

Default:
  false

#### writeOnly

    public abstract boolean writeOnly

Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response.

If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true.

Returns:
  whether or not this schema is write only

Default:
  false

#### example

    public abstract String example

A free-form property to include an example of an instance for this schema.

To represent examples that cannot be naturally represented in JSON or YAML, a string value is used to contain the example with escaping where necessary.

When associated with a specific media type, the example string shall be parsed by the consumer to be treated as an object or an array.

Returns:
  an example of this schema

Default:
  ""

#### externalDocs

    public abstract ExternalDocumentation externalDocs

Additional external documentation for this schema.

Returns:
  additional schema documentation

Default:
  @org.eclipse.microprofile.openapi.annotations.ExternalDocumentation

#### deprecated

    public abstract boolean deprecated

Specifies that a schema is deprecated and SHOULD be transitioned out of usage.

Returns:
  whether or not this schema is deprecated

Default:
  false

#### type

    public abstract SchemaType type

Provides an override for the basic type of the schema.

Value MUST be a string. Multiple types via an array are not supported.

MUST be a valid type per the OpenAPI Specification.

Returns:
  the type of this schema

Default:
  org.eclipse.microprofile.openapi.annotations.enums.SchemaType.DEFAULT

#### enumeration

    public abstract String[] enumeration

Provides a list of enum values. Corresponds to the enum property in the OAS schema and the enumeration property in the schema model.

Returns:
  a list of allowed schema values

Default:
  {}

#### defaultValue

    public abstract String defaultValue

Provides a default value. The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided.

Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level.

For example, if type is string, then default can be "foo" but cannot be 1.

Returns:
  the default value of this schema

Default:
  ""

#### discriminatorProperty

    public abstract String discriminatorProperty

Provides a discriminator property value. Adds support for polymorphism.

The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description.

Returns:
  the discriminator property

Default:
  ""

#### discriminatorMapping

    public abstract DiscriminatorMapping[] discriminatorMapping

An array of discriminator mappings.

Returns:
  the discriminator mappings for this schema

Default:
  {}

#### hidden

    public abstract boolean hidden

Allows schema to be marked as hidden.

Returns:
  whether or not this schema is hidden

Default:
  false

#### maxItems

    public abstract int maxItems

Only applicable if type=array. Sets the maximum number of items in an array. This integer MUST be greater than, or equal to, 0.

An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.

Ignored if value is Integer.MIN_VALUE.

Returns:
  the maximum number of items in this array

Default:
  -2147483648

#### minItems

    public abstract int minItems

Only applicable if type=array. Sets the minimum number of items in an array. This integer MUST be greater than, or equal to, 0.

An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.

Ignored if value is Integer.MAX_VALUE.

Returns:
  the minimum number of items in this array

Default:
  2147483647

#### uniqueItems

    public abstract boolean uniqueItems

Only applicable if type=array. Determines if the items in the array SHOULD be unique.

If false, the instance validates successfully. If true, the instance validates successfully if all of its elements are unique.

Returns:
  whether the items in this array are unique

Default:
  false