Awesome
Zerotoprod\DataModelOpenapi30
DataModels for OpenAPI 3.0.* specification.
Usage
use Zerotoprod\DataModelOpenapi30\OpenApi;
$OpenApi = OpenApi::from(json_decode($json, true));
$OpenApi->components->schemas['pet']->description;
Testing
./vendor/bin/phpunit
Acceptance Tests
Test | Status |
---|---|
4.7.2.2 Info Object Example | :white_check_mark: |
4.7.3.2 Contact Object Example | :white_check_mark: |
4.7.4.2 License Object Example | :white_check_mark: |
4.7.5.2 Server Object Example | :white_check_mark: |
4.7.7.2 Components Object Example | :white_check_mark: |
4.7.8.3 Paths Object Example | :white_check_mark: |
4.7.9.2 Path Item Object Example | :white_check_mark: |
4.7.10.2 Operation Object Example | :white_check_mark: |
4.7.11.2 External Documentation Object Example | :white_check_mark: |
4.7.12.5 Parameter Object Examples | :white_check_mark: |
4.7.13.2 Request Body Examples | :white_check_mark: |
4.7.14.2 Media Type Examples | :white_check_mark: |
Properties
4.0 Specification
4.7 Schema
This section describes the structure of the OpenAPI Description format
4.7.1 OpenAPI Object
This is the root object of the OpenAPI Description.
4.7.1.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
openapi | string | :white_check_mark: |
info | Info Object | :white_check_mark: |
servers | [Server Object] | :white_check_mark: |
paths | Paths Object | :white_check_mark: |
components | Components Object | :white_check_mark: |
security | Security Requirement Object | :white_check_mark: |
tags | [Tag Object ] | :white_check_mark: |
externalDocs | External Documentation Object | :white_check_mark: |
4.7.2 Info Object
The object provides metadata about the API.
4.7.2.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
title | string | :white_check_mark: |
description | string | :white_check_mark: |
termsOfService | string | :white_check_mark: |
contact | Contact Object | :white_check_mark: |
license | License Object | :white_check_mark: |
version | string | :white_check_mark: |
4.7.3 Contact Object
Contact information for the exposed API.
4.7.3.1 Fixed Fields
Field | Type | Status |
---|---|---|
name | string | :white_check_mark: |
url | string | :white_check_mark: |
email | :white_check_mark: |
4.7.4 License Object
License information for the exposed API.
4.7.4.1 Fixed Fields
Field | Type | Status |
---|---|---|
name | string | :white_check_mark: |
url | string | :white_check_mark: |
4.7.5 Server Object
An object representing a Server.
4.7.5.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
url | string | :white_check_mark: |
description | string | :white_check_mark: |
variables | Map[string , Server Variable Object ] | :white_check_mark: |
4.7.6 Server Object
An object representing a Server Variable for server URL template substitution.
4.7.6.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
enum | [string ] | :white_check_mark: |
default | string | :white_check_mark: |
description | string | :white_check_mark: |
4.7.7 Components Object
Holds a set of reusable objects for different aspects of the OAS.
4.7.7.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
schemas | Map[string , Schema Object | Reference Object ] | :white_check_mark: |
responses | Map[string , Response Object | Reference Object ] | :white_check_mark: |
parameters | Map[string , Parameter Object | Reference Object ] | :white_check_mark: |
examples | Map[string , Example Object | Reference Object ] | :white_check_mark: |
requestBodies | Map[string , Request Body Object | Reference Object ] | :white_check_mark: |
headers | Map[string , Header Object | Reference Object ] | :white_check_mark: |
securitySchemes | Map[string , Security Scheme Object | Reference Object ] | :white_check_mark: |
links | Map[string , Link Object | Reference Object ] | :white_check_mark: |
callbacks | Map[string , Callback Object | Reference Object ] | :white_check_mark: |
4.7.8 Paths Object
Holds the relative paths to the individual endpoints and their operations.
4.7.8.1 Patterned Fields
Field Name | Type | Status |
---|---|---|
/{path} | Path Item Object | :white_check_mark: |
4.7.9 Path Item Object
Describes the operations available on a single path.
4.7.9.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
$ref | string | :white_check_mark: |
summary | string | :white_check_mark: |
description | string | :white_check_mark: |
get | Operation Object | :white_check_mark: |
put | Operation Object | :white_check_mark: |
post | Operation Object | :white_check_mark: |
delete | Operation Object | :white_check_mark: |
options | Operation Object | :white_check_mark: |
head | Operation Object | :white_check_mark: |
patch | Operation Object | :white_check_mark: |
trace | Operation Object | :white_check_mark: |
servers | Server Object | :white_check_mark: |
parameters | [Parameter Object | Reference Object ] | :white_check_mark: |
4.7.10 Operation Object
Describes a single API operation on a path.
4.7.10.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
tags | [string ] | :white_check_mark: |
summary | string | :white_check_mark: |
description | string | :white_check_mark: |
externalDocs | External Documentation Object | :white_check_mark: |
operationId | string | :white_check_mark: |
parameters | [Parameter Object | Reference Object ] | :white_check_mark: |
requestBody | Request Body Object | Reference Object | :white_check_mark: |
responses | Responses Object | :white_check_mark: |
callbacks | Map[string , Callback Object | Reference Object ] | :white_check_mark: |
deprecated | boolean | :white_check_mark: |
security | [Security Requirement Object ] | :white_check_mark: |
servers | [Server Object ] | :white_check_mark: |
4.7.11 External Documentation Object
Allows referencing an external resource for extended documentation.
4.7.11.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
description | string | :white_check_mark: |
url | string | :white_check_mark: |
4.7.12 Parameter Object
Describes a single operation parameter.
4.7.12.2 Fixed Fields
The rules for serialization of the parameter are specified in one of two ways. Parameter Objects MUST include either a content
field or a schema
field, but not both.
4.7.12.2.1 Common Fixed Fields
These fields MAY be used with either content
or schema
.
Field Name | Type | Status |
---|---|---|
name | string | :white_check_mark: |
in | string | :white_check_mark: |
description | string | :white_check_mark: |
required | boolean | :white_check_mark: |
deprecated | boolean | :white_check_mark: |
allowEmptyValue | [boolean ] | :white_check_mark: |
4.7.12.2.2 Fixed Fields for use with schema
For simpler scenarios, a schema
and style
can describe the structure and syntax of the parameter.
Field Name | Type | Status |
---|---|---|
style | string | :white_check_mark: |
explode | boolean | :white_check_mark: |
allowReserved | boolean | :white_check_mark: |
schema | Schema Object | Reference Object | :white_check_mark: |
example | Any | :white_check_mark: |
examples | Map[ string , Example Object | Reference Object ] | :white_check_mark: |
4.7.12.2.3 Fixed Fields for use with content
Field Name | Type | Status |
---|---|---|
content | Map[string , Media Type Object ] | :white_check_mark: |
4.7.13 Request Body Object
Describes a single request body.
4.7.13.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
description | string | :white_check_mark: |
content | Map[string , Media Type Object ] | :white_check_mark: |
required | boolean | :white_check_mark: |
4.7.14 Media Type Object
Each Media Type Object provides schema and examples for the media type identified by its key.
4.7.14.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
schema | Schema Object | Reference Object | :white_check_mark: |
example | Any | :white_check_mark: |
examples | Map[string , Example Object | Reference Object ] | :white_check_mark: |
encoding | Map[string , Encoding Object ] | :white_check_mark: |
4.7.15 Encoding Object
A single encoding definition applied to a single schema property.
4.7.15.1 Fixed Fields
4.7.15.1.1 Common Fixed Fields
These fields MAY be used either with or without the RFC6570-style serialization fields defined in the next section below.
Field Name | Type | Status |
---|---|---|
contentType | string | :white_check_mark: |
headers | Map[string , Header Object | Reference Object ] | :white_check_mark: |
4.7.15.1.2 Fixed Fields for RFC6570-style Serialization
Field Name | Type | Status |
---|---|---|
style | string | :white_check_mark: |
explode | boolean | :white_check_mark: |
allowReserved | boolean | :white_check_mark: |
4.7.16 Responses Object
A container for the expected responses of an operation. The container maps an HTTP response code to the expected response.
4.7.16.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
default | Response Object | Reference Object | :white_check_mark: |
4.7.16.2 Patterned Fields
Field Name | Type | Status |
---|---|---|
HTTP Status Code | Response Object | Reference Object | :white_check_mark: |
4.7.17 Response Object
Describes a single response from an API operation, including design-time, static links to operations based on the response.
4.7.17.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
description | string | :white_check_mark: |
headers | Map[string , Header Object | Reference Object] | :white_check_mark: |
content | Map[string , Media Type Object] | :white_check_mark: |
links | Map[string , Link Object | Reference Object] | :white_check_mark: |
4.7.19 Example Object
An object grouping an internal or external example value with basic summary
and description
metadata.
4.7.19.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
summary | string | :white_check_mark: |
description | string | :white_check_mark: |
value | Any | :white_check_mark: |
externalValue | string | :white_check_mark: |
4.7.20 Link Object
The Link Object represents a possible design-time link for a response.
4.7.20.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
operationRef | string | :white_check_mark: |
operationId | string | :white_check_mark: |
parameters | Map[string , Any | {expression}] | :white_check_mark: |
requestBody | Any | {expression} | :white_check_mark: |
description | string | :white_check_mark: |
server | Server Object | :white_check_mark: |
4.7.21 Header Object
Describes a single header for HTTP responses and for individual parts in multipart representations.
4.7.21.1 Fixed Fields
4.7.21.1.1 Common Fixed Fields
These fields MAY be used with either content
or schema
.
Field Name | Type | Status |
---|---|---|
description | string | :white_check_mark: |
required | boolean | :white_check_mark: |
deprecated | boolean | :white_check_mark: |
4.7.21.1.2 Fixed Fields for use with schema
For simpler scenarios, a schema and style can describe the structure and syntax of the header.
Field Name | Type | Status |
---|---|---|
style | string | :white_check_mark: |
explode | boolean | :white_check_mark: |
schema | Schema Object | Reference Object | :white_check_mark: |
example | Any | :white_check_mark: |
examples | Map[string , Example Object | Reference Object ] | :white_check_mark: |
4.7.21.1.3 Fixed Fields for use with content
For more complex scenarios, the content field can define the media type and schema of the header, as well as give examples of its use.
Field Name | Type | Status |
---|---|---|
content | Map[string , Media Type Object ] | :white_check_mark: |
4.7.22 Tag Object
Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
4.7.22.1 Fixed Fields
Field | Type | Status |
---|---|---|
name | string | :white_check_mark: |
description | string | :white_check_mark: |
description | External Documentation Object | :white_check_mark: |
4.7.23 Reference Object
A simple object to allow referencing other components in the OpenAPI Description, internally and externally.
4.7.23.1 Fixed Fields
Field | Type | Status |
---|---|---|
$ref | string | :white_check_mark: |
4.7.24 Schema Object
The Schema Object allows the definition of input and output data types.
4.7.24.1 JSON Schema Keywords
Field Name | Type | Status |
---|---|---|
title | string | :white_check_mark: |
multipleOf | number | :white_check_mark: |
maximum | number | :white_check_mark: |
exclusiveMaximum | boolean | :white_check_mark: |
minimum | number | :white_check_mark: |
exclusiveMinimum | boolean | :white_check_mark: |
maxLength | integer | :white_check_mark: |
minLength | integer | :white_check_mark: |
pattern | string | :white_check_mark: |
maxItems | integer | :white_check_mark: |
minItems | integer | :white_check_mark: |
uniqueItems | boolean | :white_check_mark: |
maxProperties | integer | :white_check_mark: |
minProperties | integer | :white_check_mark: |
required | array | :white_check_mark: |
enum | array | :white_check_mark: |
type | string | :white_check_mark: |
allOf | Reference Object | Schema Object | :white_check_mark: |
oneOf | Reference Object | Schema Object | :white_check_mark: |
anyOf | Reference Object | Schema Object | :white_check_mark: |
not | Reference Object | Schema Object | :white_check_mark: |
items | Reference Object | Schema Object | :white_check_mark: |
properties | Reference Object | Schema Object | :white_check_mark: |
additionalProperties | boolean |Reference Object | Schema Object | :white_check_mark: |
description | string | :white_check_mark: |
format | string | :white_check_mark: |
format | Any | :white_check_mark: |
4.7.24.2 Fixed Fields
Field Name | Type | Status |
---|---|---|
nullable | boolean | :white_check_mark: |
discriminator | Discriminator Object | :white_check_mark: |
readOnly | boolean | :white_check_mark: |
writeOnly | boolean | :white_check_mark: |
xml | XML Object | :white_check_mark: |
externalDocs | External Documentation Object | :white_check_mark: |
example | Any | :white_check_mark: |
deprecated | boolean | :white_check_mark: |
4.7.25 Discriminator Object
When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a hint about the expected schema of the document.
4.7.25.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
propertyName | string | :white_check_mark: |
mapping | Map[string , string ] | :white_check_mark: |
4.7.26 XML Object
A metadata object that allows for more fine-tuned XML model definitions.
4.7.26.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
name | string | :white_check_mark: |
namespace | string | :white_check_mark: |
prefix | string | :white_check_mark: |
attribute | boolean | :white_check_mark: |
wrapped | boolean | :white_check_mark: |
4.7.27 Security Scheme Object
Defines a security scheme that can be used by the operations.
4.7.27.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
type | string | :white_check_mark: |
description | string | :white_check_mark: |
name | string | :white_check_mark: |
in | string | :white_check_mark: |
scheme | string | :white_check_mark: |
bearerFormat | string | :white_check_mark: |
flows | string | :white_check_mark: |
openIdConnectUrl | string | :white_check_mark: |
4.7.28 OAuth Flows Object
Allows configuration of the supported OAuth Flows.
4.7.28.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
implicit | OAuth Flow Object | :white_check_mark: |
password | OAuth Flow Object | :white_check_mark: |
clientCredentials | OAuth Flow Object | :white_check_mark: |
authorizationCode | OAuth Flow Object | :white_check_mark: |
4.7.29 OAuth Flow Object
Defines a security scheme that can be used by the operations.
4.7.29.1 Fixed Fields
Field Name | Type | Status |
---|---|---|
authorizationUrl | string | :white_check_mark: |
tokenUrl | string | :white_check_mark: |
refreshUrl | string | :white_check_mark: |
scopes | Map[string , string ] | :white_check_mark: |