zero-to-prod/data-model-openapi30

DataModels for OpenAPI 3.0.*

v0.1.4 2024-11-26 02:28 UTC

This package is auto-updated.

Last update: 2024-11-26 02:28:42 UTC


README

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

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

4.7.2 Info Object

The object provides metadata about the API.

4.7.2.1 Fixed Fields

4.7.3 Contact Object

Contact information for the exposed API.

4.7.3.1 Fixed Fields

4.7.4 License Object

License information for the exposed API.

4.7.4.1 Fixed Fields

4.7.5 Server Object

An object representing a Server.

4.7.5.1 Fixed Fields

4.7.6 Server Object

An object representing a Server Variable for server URL template substitution.

4.7.6.1 Fixed Fields

4.7.7 Components Object

Holds a set of reusable objects for different aspects of the OAS.

4.7.7.1 Fixed Fields

4.7.8 Paths Object

Holds the relative paths to the individual endpoints and their operations.

4.7.8.1 Patterned Fields

4.7.9 Path Item Object

Describes the operations available on a single path.

4.7.9.1 Fixed Fields

4.7.10 Operation Object

Describes a single API operation on a path.

4.7.10.1 Fixed Fields

4.7.11 External Documentation Object

Allows referencing an external resource for extended documentation.

4.7.11.1 Fixed Fields

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.

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.

4.7.12.2.3 Fixed Fields for use with content

4.7.13 Request Body Object

Describes a single request body.

4.7.13.1 Fixed Fields

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

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.

4.7.15.1.2 Fixed Fields for RFC6570-style Serialization

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

4.7.16.2 Patterned Fields

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

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

4.7.20 Link Object

The Link Object represents a possible design-time link for a response.

4.7.20.1 Fixed Fields

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.

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.

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.

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

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

4.7.24 Schema Object

The Schema Object allows the definition of input and output data types.

4.7.24.1 JSON Schema Keywords

4.7.24.2 Fixed Fields

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

4.7.26 XML Object

A metadata object that allows for more fine-tuned XML model definitions.

4.7.26.1 Fixed Fields

4.7.27 Security Scheme Object

Defines a security scheme that can be used by the operations.

4.7.27.1 Fixed Fields

4.7.28 OAuth Flows Object

Allows configuration of the supported OAuth Flows.

4.7.28.1 Fixed Fields

4.7.29 OAuth Flow Object

Defines a security scheme that can be used by the operations.

4.7.29.1 Fixed Fields