UNPKG

@readme/oas-examples

Version:

A collection of example OpenAPI 3.x and Swagger 2.0 documents.

251 lines (250 loc) 6.15 kB
openapi: 3.0.3 info: title: Responses with various schema formats description: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#schema-object version: '1.0' servers: - url: https://httpbin.org paths: '/anything/array-of-primitives': get: summary: Array of primitives responses: '200': description: OK content: application/json: schema: type: array items: type: string '/anything/object': get: summary: Object (also demonstrates readonly/writeonly) requestBody: content: application/json: schema: '$ref': '#/components/schemas/Object' responses: '200': description: OK content: application/json: schema: '$ref': '#/components/schemas/Object' '/anything/markdown': get: summary: Markdown responses: '200': description: |- Test - Bullet one - Bullet two *italics* content: application/json: schema: '$ref': '#/components/schemas/Object' '400': description: OK content: application/json: schema: '$ref': '#/components/schemas/Object' '/anything/array-of-objects': get: summary: Array of objects responses: '200': description: OK content: application/json: schema: type: array items: '$ref': '#/components/schemas/Object' '/anything/polymorphism': get: summary: Polymorphism responses: '200': description: OK content: application/json: schema: oneOf: - type: string title: first object - '$ref': '#/components/schemas/Pet' - type: string '/anything/recursive': get: summary: Recursive $ref lookup responses: '200': description: OK content: application/json: schema: type: array items: '$ref': '#/components/schemas/Node' '/anything/returns-as-json-but-is-actually-string': get: summary: Returns as JSON, but is actually a simple string description: This example is to ensure that we don't hard fail out on attempting to parse a non-JSON string as JSON, and instead fallback to the standard syntax highlighter. responses: '200': description: OK content: application/json: schema: format: uuid type: string examples: response: value: 96fab4bb-ff68-43e2-94d8-7046f3173d9c '/multiple-responses/object': get: summary: Object responses: '200': description: OK content: application/json: schema: type: object properties: hello: type: string there: type: string '400': description: A 400 error response content: application/json: schema: type: object properties: obi: type: string wan: type: string components: schemas: Node: type: object properties: children: type: array items: '$ref': '#/components/schemas/Node' Object: type: object properties: primitive: type: string title: primitive title read-only: type: string readOnly: true write-only: type: string writeOnly: true object: type: object properties: primitive: type: boolean array: type: array items: type: object properties: primitive: type: boolean pets: type: array items: '$ref': '#/components/schemas/Pet' Pet: type: object required: - name - photoUrls properties: id: type: integer format: int64 name: type: string example: doggie name2: type: string example: doggie name3: type: string example: doggie name4: type: string example: doggie name5: type: string example: doggie name6: type: string example: doggie name7: type: string example: doggie name8: type: string example: doggie name9: type: string example: doggie name10: type: string example: doggie name11: type: string example: doggie name12: type: string example: doggie name13: type: string example: doggie name14: type: string example: doggie name15: type: string example: doggie name16: type: string example: doggie name17: type: string example: doggie name18: type: string example: doggie name19: type: string example: doggie photoUrls: type: array items: type: string status: type: string description: pet status in the store enum: - available - pending - sold