Skip to content
v1.0.0

Example of an OpenAPI document different schemas


Get a tags array

GET
/tags-array

Example of a JSON object with an array of tags using items schema.

Responses

An object containing an array of tags

application/json
object

An object containing arrays of tags and related metadata for categorization and organization

string[]

A collection of string tags used for categorizing content or items

object

Additional information related to the tags including supplementary data

Playground

Samples

cURL
JavaScript
PHP
Python

Get a parent

GET
/circular-reference

Example of a JSON object with a circular reference.

Responses

A parent with a child

application/json
object

A parent object that demonstrates circular references by containing a child that references back to its parent

Unique identifier for the parent object

object

Reference to a child object that belongs to this parent

Playground

Samples

cURL
JavaScript
PHP
Python

Get the root object

GET
/multiple-levels

Example of a JSON object with multiple levels.

Responses

Example of a deeply nested structure

application/json
object

The top level of a deeply nested structure demonstrating how OpenAPI can handle complex hierarchical data

Unique identifier for this level 1 object

object

Reference to the next level in the nested structure (level 2)

Playground

Samples

cURL
JavaScript
PHP
Python

Get a string

GET
/primitive-string

Example of a JSON object with a string.

Responses

A string

application/json

Playground

Samples

cURL
JavaScript
PHP
Python

Get a number

GET
/primitive-number

Example of a JSON object with a number.

Responses

A number

application/json

Playground

Samples

cURL
JavaScript
PHP
Python

Get a boolean

GET
/primitive-boolean

Example of a JSON object with a boolean.

Responses

A boolean

application/json

Playground

Samples

cURL
JavaScript
PHP
Python

Get a nullable object

GET
/nullable-object

Example of a JSON object that can be null.

Responses

A nullable object

application/json
object |null

An object that can be either a valid object with properties or null, demonstrating OpenAPI's support for nullable types

Unique identifier for the object when it's not null

Name or title associated with this object

Detailed text description providing additional information about the object. This field can contain formatted text for better readability.

Playground

Samples

cURL
JavaScript
PHP
Python

Get a tuple array with prefixItems

GET
/tuple-array

Example of a JSON array with prefixItems defining a tuple structure.

Responses

A tuple array with fixed positions

application/json
array

A tuple array with fixed position types using prefixItems. This demonstrates how to create arrays with a specific structure where each position contains a predetermined type.

Min Items5
Max Items5

First element - always a string, typically used for identifiers or names

Second element - always a number, can represent quantities, measurements, or scores

Third element - always a boolean, useful for flags or toggle states

object

Fourth element - a complex object with its own structure and properties

string[]

Fifth element - an array of strings, useful for tags, categories, or other collections

Playground

Samples

cURL
JavaScript
PHP
Python

Get a mixed array with prefixItems and items

GET
/mixed-array

Example of a JSON array with both prefixItems and items schemas.

Responses

An array with fixed positions followed by additional items

application/json
array

An array with both prefixItems and items schemas, demonstrating a hybrid approach to array definition. This combines fixed position elements at the beginning with variable additional elements of the same type.

Min Items2

First element - always a string identifier that uniquely identifies the entire array data structure

object

Second element - user metadata containing basic information about the user associated with this data

object

Additional elements - data entries that can appear in any quantity after the fixed prefix items. Each represents a discrete data point with timestamp and value.

Playground

Samples

cURL
JavaScript
PHP
Python

Test complex schema with oneOf and anyOf

POST
/complex-schema

Example of a complex request and response schema using oneOf and anyOf.

Request Body

application/json
object

A complex request object demonstrating advanced OpenAPI features including oneOf and anyOf schemas. This represents a flexible API request that can handle multiple data types.

Example:

{
  "id": "req-12345",
  "timestamp": "2023-05-20T15:30:45Z",
  "data": {
    "type": "order",
    "order": {
      "id": "order-123",
      "customer": {
        "id": "cust-456",
        "name": "John Doe"
      },
      "items": [
        {
          "productId": "prod-456",
          "quantity": 2,
          "unitPrice": 599.99
        }
      ],
      "totalAmount": 1199.98
    }
  },
  "metadata": { "source": "web", "priority": "high", "tags": ["important", "sales"] } }

Unique identifier for the request, used for tracking and reference purposes

When the request was created, in ISO 8601 format with timezone information

Format"date-time"
object
Required

The main data payload that can be one of several types, using the oneOf discriminator pattern to support multiple object structures

object

Additional metadata that can include any combination of these fields using the anyOf schema pattern. This allows for flexible metadata combinations where one or more of these objects can be included.

Responses

Complex response with oneOf and anyOf schemas

application/json
object

A complex response object demonstrating advanced OpenAPI features including nested oneOf and anyOf schemas. This represents a flexible API response that can return different result types based on the operation outcome.

Example:

{
  "id": "resp-67890",
  "status": "success",
  "result": {
    "type": "success",
    "data": {
      "transaction": {
        "id": "txn-123456",
        "amount": 1299.99,
        "currency": "USD",
        "paymentMethod": {
          "type": "card",
          "card": {
            "last4": "4242",
            "brand": "visa",
            "expiryMonth": 12,
            "expiryYear": 2025
          }
        }
      }
    }
  },
  "metadata": { "processingTime": 235.45, "region": "us-west-1", "version": "v2.3.1"  } }

Unique identifier for the response that can be used for tracking and debugging purposes. This correlates with the request ID.

Overall status of the operation indicating whether it succeeded, partially succeeded, or failed. This field helps clients quickly determine the outcome without parsing the entire response.

Valid values"success""partial""error"
object
Required

The result data with nested oneOf and anyOf patterns, providing a flexible response structure that can adapt to different scenarios and operation outcomes.

object

Additional metadata with anyOf pattern, providing supplementary information about the response. This allows for flexible combinations of metadata fields to be included based on the context.

Playground

Body

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI