OpenAPI Specification Schemas: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject =Internal= * OpenAPI Specification =Overview=") |
|||
Line 4: | Line 4: | ||
* [[OpenAPI_Specification#schemas|OpenAPI Specification]] | * [[OpenAPI_Specification#schemas|OpenAPI Specification]] | ||
=Overview= | =Overview= | ||
The <code>/components/schemas</code> section of the OpenAPI specification defines reusable objects a client or server code generator creates programming language types for. | |||
=Example= | |||
<syntaxhighlight lang='yaml'> | |||
components: | |||
schemas: | |||
Pet: | |||
allOf: | |||
- $ref: '#/components/schemas/NewPet' | |||
- type: object | |||
required: | |||
- id | |||
properties: | |||
id: | |||
type: integer | |||
format: int64 | |||
NewPet: | |||
type: object | |||
required: | |||
- name | |||
properties: | |||
name: | |||
type: string | |||
tag: | |||
type: string | |||
Error: | |||
type: object | |||
required: | |||
- code | |||
- message | |||
properties: | |||
code: | |||
type: integer | |||
format: int32 | |||
message: | |||
type: string | |||
</syntaxhighlight> |
Revision as of 01:26, 26 January 2024
External
Internal
Overview
The /components/schemas
section of the OpenAPI specification defines reusable objects a client or server code generator creates programming language types for.
Example
components:
schemas:
Pet:
allOf:
- $ref: '#/components/schemas/NewPet'
- type: object
required:
- id
properties:
id:
type: integer
format: int64
NewPet:
type: object
required:
- name
properties:
name:
type: string
tag:
type: string
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string