Previous: The OpenAPI structure and custom attributes | Next: Base, mini, standard, and full API resources
Response schemas are located in the content/responses/
folder. Every response
is written as a YAML file.
- Determine the type of the
resource
, either arequest
response
error
callback
- or generic
schema
- Based on that answer, create a file in
content/requests/*
content/responses/*
content/errors/*
,content/callbacks/*
- or
content/schemas/*
- An example would be
content/responses/file.yml
.
- Add the default content to the file:
- A short
title
to give the resource a short human-readable name. Please do not usea
,an
, orthe
in the title. - A
description
to further elaborate on the title. - A
type
, which in most cases is either anobject
or anarray
. - A unique
x-box-resource-id
if you want the schema to be listed in the public developer documentation. Omitting this will hide the resource. - A a list of
properties
for each of the fields of the resource.
- A short
---
title: File
description: The information about a file
type: object
x-box-resource-id: file
properties:
id:
type: string
description: The unique identifier for this file
example: "11446498"
type:
description: |-
The type of this file, which is always `file`.
type: string
example: file
enum:
- file
Almost every schema has a list of properties
. Please make sure that every
property:
- has a
type
and optionalformat
, for examplestring
anddate-time
. - has a
description
and a realisticexample
- has an
enum
of values if the returned values are only a limited list - is separated by a new line to improve readability
To learn more about the OpenAPI specification and creating schemas, we recommend reading the following resources.