Schema
in package
implements
OpenApiAttributeInterface
The attribute may be used to define a Schema for a set of elements of the OpenAPI spec, and/or to define additional properties for the schema. It is applicable e.g. to parameters, schema classes (aka "models"), properties of such models, request and response content, header.
The attribute ArraySchema shall be used for array elements; ArraySchema and Schema cannot coexist
Interfaces, Classes, Traits and Enums
Table of Contents
- $accessMode : AccessMode
- $allOf : array<string|int, mixed>
- $allowableValues : array<string|int, mixed>
- $anyOf : array<string|int, mixed>
- $defaultValue : string
- $deprecated : bool
- $description : string
- $discriminatorMapping : array<string|int, mixed>
- $discriminatorProperty : string
- $enumAsRef : bool
- $example : string
- $exclusiveMaximum : bool
- $exclusiveMinimum : bool
- $extensions : array<string|int, mixed>
- $externalDocs : ExternalDocumentation|null
- $format : string
- $hidden : bool
- $implementation : string|null
- $maximum : string
- $maxLength : int
- $maxProperties : int
- $minimum : string
- $minLength : int
- $minProperties : int
- $multipleOf : float
- $name : string
- $not : string|null
- $nullable : bool
- $oneOf : array<string|int, mixed>
- $pattern : string
- $ref : string
- $required : bool
- $requiredProperties : array<string|int, mixed>
- $subTypes : array<string|int, mixed>
- $title : string
- $type : string
- __construct() : mixed
Properties
$accessMode
public
AccessMode
$accessMode
= AccessMode::AUTO
$allOf
public
array<string|int, mixed>
$allOf
= []
$allowableValues
public
array<string|int, mixed>
$allowableValues
= []
$anyOf
public
array<string|int, mixed>
$anyOf
= []
$defaultValue
public
string
$defaultValue
= ""
$deprecated
public
bool
$deprecated
= false
$description
public
string
$description
= ""
$discriminatorMapping
public
array<string|int, mixed>
$discriminatorMapping
= []
$discriminatorProperty
public
string
$discriminatorProperty
= ""
$enumAsRef
public
bool
$enumAsRef
= false
$example
public
string
$example
= ""
$exclusiveMaximum
public
bool
$exclusiveMaximum
= false
$exclusiveMinimum
public
bool
$exclusiveMinimum
= false
$extensions
public
array<string|int, mixed>
$extensions
= []
$externalDocs
public
ExternalDocumentation|null
$externalDocs
= null
$format
public
string
$format
= ""
$hidden
public
bool
$hidden
= false
$implementation
public
string|null
$implementation
= null
$maximum
public
string
$maximum
= ""
$maxLength
public
int
$maxLength
= PHP_INT_MAX
$maxProperties
public
int
$maxProperties
= 0
$minimum
public
string
$minimum
= ""
$minLength
public
int
$minLength
= 0
$minProperties
public
int
$minProperties
= 0
$multipleOf
public
float
$multipleOf
= 0
$name
public
string
$name
= ""
$not
public
string|null
$not
= null
$nullable
public
bool
$nullable
= false
$oneOf
public
array<string|int, mixed>
$oneOf
= []
$pattern
public
string
$pattern
= ""
$ref
public
string
$ref
= ""
$required
public
bool
$required
= false
$requiredProperties
public
array<string|int, mixed>
$requiredProperties
= []
$subTypes
public
array<string|int, mixed>
$subTypes
= []
$title
public
string
$title
= ""
$type
public
string
$type
= ""
Methods
__construct()
public
__construct([class-string|null $implementation = null ][, class-string|null $not = null ][, array<string|int, class-string> $oneOf = [] ][, array<string|int, class-string> $anyOf = [] ][, array<string|int, class-string> $allOf = [] ][, string $name = "" ][, string $title = "" ], float|int $multipleOf[, string $maximum = "" ][, bool $exclusiveMaximum = false ][, string $minimum = "" ][, bool $exclusiveMinimum = false ][, int $maxLength = PHP_INT_MAX ], int $minLength[, string $pattern = "" ], int $maxProperties, int $minProperties[, array<string|int, string> $requiredProperties = [] ][, bool $required = false ][, string $description = "" ][, string $format = "" ][, string $ref = "" ][, bool $nullable = false ][, AccessMode $accessMode = AccessMode::AUTO ][, string $example = "" ][, ExternalDocumentation|null $externalDocs = null ][, bool $deprecated = false ][, string $type = "" ][, array<string|int, string> $allowableValues = [] ][, string $defaultValue = "" ][, string $discriminatorProperty = "" ][, array<string|int, DiscriminatorMapping> $discriminatorMapping = [] ][, bool $hidden = false ][, bool $enumAsRef = false ][, array<string|int, class-string> $subTypes = [] ][, array<string|int, Extension> $extensions = [] ]) : mixed
Parameters
- $implementation : class-string|null = null
-
Provides a PHP class as implementation for this schema. When provided, additional information in the Schema attribute (except for type information) will augment the PHP class after introspection.
- $not : class-string|null = null
-
Provides a PHP class to be used to disallow matching properties.
- $oneOf : array<string|int, class-string> = []
-
Provides an array of PHP class implementations which can be used to describe multiple acceptable schemas. If more than one match the derived schemas, a validation error will occur.
- $anyOf : array<string|int, class-string> = []
-
Provides an array of PHP class implementations which can be used to describe multiple acceptable schemas. If any match, the schema will be considered valid.
- $allOf : array<string|int, class-string> = []
-
Provides an array of PHP class implementations which can be used to describe multiple acceptable schemas. If all match, the schema will be considered valid
- $name : string = ""
-
The name of the schema or property.
- $title : string = ""
-
A title to explain the purpose of the schema.
- $multipleOf : float|int
-
Constrains a value such that when divided by the multipleOf, the remainder must be an integer. Ignored if the value is 0.
- $maximum : string = ""
-
Sets the maximum numeric value for a property. Ignored if the value is an empty string.
- $exclusiveMaximum : bool = false
-
If true, makes the maximum value exclusive, or a less-than criteria.
- $minimum : string = ""
-
Sets the minimum numeric value for a property. Ignored if the value is an empty string or not a number.
- $exclusiveMinimum : bool = false
-
If true, makes the minimum value exclusive, or a greater-than criteria.
- $maxLength : int = PHP_INT_MAX
-
Sets the maximum length of a string value. Ignored if the value is negative.
- $minLength : int
-
Sets the minimum length of a string value. Ignored if the value is negative.
- $pattern : string = ""
-
A pattern that the value must satisfy. Ignored if the value is an empty string.
- $maxProperties : int
-
Constrains the number of arbitrary properties when additionalProperties is defined. Ignored if value is 0.
- $minProperties : int
-
Constrains the number of arbitrary properties when additionalProperties is defined. Ignored if value is 0.
- $requiredProperties : array<string|int, string> = []
-
Allows multiple properties in an object to be marked as required.
- $required : bool = false
-
Mandates that the annotated item is required or not.
- $description : string = ""
-
A description of the schema.
- $format : string = ""
-
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"
- $ref : string = ""
-
References a schema definition in an external OpenAPI document.
- $nullable : bool = false
-
If true, designates a value as possibly null.
- $accessMode : AccessMode = AccessMode::AUTO
-
Allows to specify the access mode (READ_ONLY, WRITE_ONLY, READ_WRITE) AccessMode::READ_ONLY: value will not be written to during a request but may be returned during a response. AccessMode::WRITE_ONLY: value will only be written to during a request but not returned during a response. AccessMode::READ_WRITE: value will be written to during a request and returned during a response.
- $example : string = ""
-
Provides an example of the schema. 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.
- $externalDocs : ExternalDocumentation|null = null
-
Additional external documentation for this schema.
- $deprecated : bool = false
-
Specifies that a schema is deprecated and should be transitioned out of usage.
- $type : string = ""
-
Provides an override for the basic type of the schema. Must be a valid type per the OpenAPI Specification.
- $allowableValues : array<string|int, string> = []
-
Provides a list of allowable values. This field map to the enum property in the OAS schema.
- $defaultValue : string = ""
-
Provides a default value.
- $discriminatorProperty : string = ""
-
Provides a discriminator property value.
- $discriminatorMapping : array<string|int, DiscriminatorMapping> = []
-
Provides discriminator mapping values.
- $hidden : bool = false
-
Allows schema to be marked as hidden.
- $enumAsRef : bool = false
-
Allows enums to be resolved as a reference to a scheme added to components section.
- $subTypes : array<string|int, class-string> = []
-
An array of the sub types inheriting from this model.
- $extensions : array<string|int, Extension> = []
-
The list of optional extensions.