Home

Awesome

Zerotoprod\DataModelOpenapi30

Repo GitHub Actions Workflow Status Packagist Downloads Packagist Version License

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

TestStatus
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 NameTypeStatus
openapistring:white_check_mark:
infoInfo Object:white_check_mark:
servers[Server Object]:white_check_mark:
pathsPaths Object:white_check_mark:
componentsComponents Object:white_check_mark:
securitySecurity Requirement Object:white_check_mark:
tags[Tag Object]:white_check_mark:
externalDocsExternal Documentation Object:white_check_mark:

4.7.2 Info Object

The object provides metadata about the API.

4.7.2.1 Fixed Fields

Field NameTypeStatus
titlestring:white_check_mark:
descriptionstring:white_check_mark:
termsOfServicestring:white_check_mark:
contactContact Object:white_check_mark:
licenseLicense Object:white_check_mark:
versionstring:white_check_mark:

4.7.3 Contact Object

Contact information for the exposed API.

4.7.3.1 Fixed Fields

FieldTypeStatus
namestring:white_check_mark:
urlstring:white_check_mark:
emailemail:white_check_mark:

4.7.4 License Object

License information for the exposed API.

4.7.4.1 Fixed Fields

FieldTypeStatus
namestring:white_check_mark:
urlstring:white_check_mark:

4.7.5 Server Object

An object representing a Server.

4.7.5.1 Fixed Fields

Field NameTypeStatus
urlstring:white_check_mark:
descriptionstring:white_check_mark:
variablesMap[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 NameTypeStatus
enum[string]:white_check_mark:
defaultstring:white_check_mark:
descriptionstring: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 NameTypeStatus
schemasMap[string, Schema Object | Reference Object]:white_check_mark:
responsesMap[string, Response Object | Reference Object]:white_check_mark:
parametersMap[string, Parameter Object | Reference Object]:white_check_mark:
examplesMap[string, Example Object | Reference Object]:white_check_mark:
requestBodiesMap[string, Request Body Object | Reference Object]:white_check_mark:
headersMap[string, Header Object | Reference Object]:white_check_mark:
securitySchemesMap[string, Security Scheme Object | Reference Object]:white_check_mark:
linksMap[string, Link Object | Reference Object]:white_check_mark:
callbacksMap[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 NameTypeStatus
/{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 NameTypeStatus
$refstring:white_check_mark:
summarystring:white_check_mark:
descriptionstring:white_check_mark:
getOperation Object:white_check_mark:
putOperation Object:white_check_mark:
postOperation Object:white_check_mark:
deleteOperation Object:white_check_mark:
optionsOperation Object:white_check_mark:
headOperation Object:white_check_mark:
patchOperation Object:white_check_mark:
traceOperation Object:white_check_mark:
serversServer 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 NameTypeStatus
tags[string]:white_check_mark:
summarystring:white_check_mark:
descriptionstring:white_check_mark:
externalDocsExternal Documentation Object:white_check_mark:
operationIdstring:white_check_mark:
parameters[Parameter Object | Reference Object]:white_check_mark:
requestBodyRequest Body Object | Reference Object:white_check_mark:
responsesResponses Object:white_check_mark:
callbacksMap[string, Callback Object | Reference Object]:white_check_mark:
deprecatedboolean: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 NameTypeStatus
descriptionstring:white_check_mark:
urlstring: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 NameTypeStatus
namestring:white_check_mark:
instring:white_check_mark:
descriptionstring:white_check_mark:
requiredboolean:white_check_mark:
deprecatedboolean: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 NameTypeStatus
stylestring:white_check_mark:
explodeboolean:white_check_mark:
allowReservedboolean:white_check_mark:
schemaSchema Object | Reference Object:white_check_mark:
exampleAny:white_check_mark:
examplesMap[ string, Example Object | Reference Object]:white_check_mark:
4.7.12.2.3 Fixed Fields for use with content
Field NameTypeStatus
contentMap[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 NameTypeStatus
descriptionstring:white_check_mark:
contentMap[string, Media Type Object]:white_check_mark:
requiredboolean: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 NameTypeStatus
schemaSchema Object | Reference Object:white_check_mark:
exampleAny:white_check_mark:
examplesMap[string, Example Object | Reference Object]:white_check_mark:
encodingMap[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 NameTypeStatus
contentTypestring:white_check_mark:
headersMap[string, Header Object | Reference Object]:white_check_mark:
4.7.15.1.2 Fixed Fields for RFC6570-style Serialization
Field NameTypeStatus
stylestring:white_check_mark:
explodeboolean:white_check_mark:
allowReservedboolean: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 NameTypeStatus
defaultResponse Object | Reference Object:white_check_mark:

4.7.16.2 Patterned Fields

Field NameTypeStatus
HTTP Status CodeResponse 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 NameTypeStatus
descriptionstring:white_check_mark:
headersMap[string, Header Object | Reference Object]:white_check_mark:
contentMap[string, Media Type Object]:white_check_mark:
linksMap[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 NameTypeStatus
summarystring:white_check_mark:
descriptionstring:white_check_mark:
valueAny:white_check_mark:
externalValuestring: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 NameTypeStatus
operationRefstring:white_check_mark:
operationIdstring:white_check_mark:
parametersMap[string, Any | {expression}]:white_check_mark:
requestBodyAny | {expression}:white_check_mark:
descriptionstring:white_check_mark:
serverServer 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 NameTypeStatus
descriptionstring:white_check_mark:
requiredboolean:white_check_mark:
deprecatedboolean: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 NameTypeStatus
stylestring:white_check_mark:
explodeboolean:white_check_mark:
schemaSchema Object | Reference Object:white_check_mark:
exampleAny:white_check_mark:
examplesMap[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 NameTypeStatus
contentMap[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

FieldTypeStatus
namestring:white_check_mark:
descriptionstring:white_check_mark:
descriptionExternal 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

FieldTypeStatus
$refstring: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 NameTypeStatus
titlestring:white_check_mark:
multipleOfnumber:white_check_mark:
maximumnumber:white_check_mark:
exclusiveMaximumboolean:white_check_mark:
minimumnumber:white_check_mark:
exclusiveMinimumboolean:white_check_mark:
maxLengthinteger:white_check_mark:
minLengthinteger:white_check_mark:
patternstring:white_check_mark:
maxItemsinteger:white_check_mark:
minItemsinteger:white_check_mark:
uniqueItemsboolean:white_check_mark:
maxPropertiesinteger:white_check_mark:
minPropertiesinteger:white_check_mark:
requiredarray:white_check_mark:
enumarray:white_check_mark:
typestring:white_check_mark:
allOfReference Object | Schema Object:white_check_mark:
oneOfReference Object | Schema Object:white_check_mark:
anyOfReference Object | Schema Object:white_check_mark:
notReference Object | Schema Object:white_check_mark:
itemsReference Object | Schema Object:white_check_mark:
propertiesReference Object | Schema Object:white_check_mark:
additionalPropertiesboolean |Reference Object | Schema Object:white_check_mark:
descriptionstring:white_check_mark:
formatstring:white_check_mark:
formatAny:white_check_mark:

4.7.24.2 Fixed Fields

Field NameTypeStatus
nullableboolean:white_check_mark:
discriminatorDiscriminator Object:white_check_mark:
readOnlyboolean:white_check_mark:
writeOnlyboolean:white_check_mark:
xmlXML Object:white_check_mark:
externalDocsExternal Documentation Object:white_check_mark:
exampleAny:white_check_mark:
deprecatedboolean: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 NameTypeStatus
propertyNamestring:white_check_mark:
mappingMap[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 NameTypeStatus
namestring:white_check_mark:
namespacestring:white_check_mark:
prefixstring:white_check_mark:
attributeboolean:white_check_mark:
wrappedboolean: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 NameTypeStatus
typestring:white_check_mark:
descriptionstring:white_check_mark:
namestring:white_check_mark:
instring:white_check_mark:
schemestring:white_check_mark:
bearerFormatstring:white_check_mark:
flowsstring:white_check_mark:
openIdConnectUrlstring:white_check_mark:

4.7.28 OAuth Flows Object

Allows configuration of the supported OAuth Flows.

4.7.28.1 Fixed Fields

Field NameTypeStatus
implicitOAuth Flow Object:white_check_mark:
passwordOAuth Flow Object:white_check_mark:
clientCredentialsOAuth Flow Object:white_check_mark:
authorizationCodeOAuth 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 NameTypeStatus
authorizationUrlstring:white_check_mark:
tokenUrlstring:white_check_mark:
refreshUrlstring:white_check_mark:
scopesMap[string, string]:white_check_mark: