| 1 |
# Example from https://deliveroo.engineering/2022/06/27/openapi-design-first.html |
| 2 |
# © All-Rights-Reserved |
| 3 |
openapi: 3.1.0 |
| 4 |
info: |
| 5 |
title: Care Request API |
| 6 |
version: 0.1.0 |
| 7 |
paths: |
| 8 |
"/requests/{request-id}": |
| 9 |
get: |
| 10 |
summary: Get all requests |
| 11 |
operationId: getRequest |
| 12 |
parameters: |
| 13 |
- $ref: '#/components/parameters/RequestId' |
| 14 |
- $ref: '#/components/parameters/TracingId' |
| 15 |
responses: |
| 16 |
'200': |
| 17 |
description: 'Completed successfully' |
| 18 |
content: |
| 19 |
application/json: |
| 20 |
schema: |
| 21 |
$ref: '#/components/schemas/CareRequest' |
| 22 |
'404': |
| 23 |
description: 'The resource could not be found' |
| 24 |
content: {} |
| 25 |
# we'd also add other response options here too |
| 26 |
components: |
| 27 |
parameters: |
| 28 |
RequestId: |
| 29 |
name: request-id |
| 30 |
in: path |
| 31 |
required: true |
| 32 |
schema: |
| 33 |
$ref: '#/components/schemas/RequestId' |
| 34 |
x-go-name: RequestIdParameter |
| 35 |
TracingId: |
| 36 |
description: A unique tracing ID that can be used for end-to-end tracing |
| 37 |
name: tracing-id |
| 38 |
in: header |
| 39 |
required: false |
| 40 |
schema: |
| 41 |
type: string |
| 42 |
format: uuid |
| 43 |
pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}" |
| 44 |
schemas: |
| 45 |
CareRequest: |
| 46 |
type: object |
| 47 |
properties: |
| 48 |
id: |
| 49 |
$ref: '#/components/schemas/RequestId' |
| 50 |
status: |
| 51 |
$ref: '#/components/schemas/RequestStatus' |
| 52 |
required: |
| 53 |
- id |
| 54 |
- status |
| 55 |
RequestId: |
| 56 |
type: string |
| 57 |
format: uuid |
| 58 |
pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}" |
| 59 |
RequestStatus: |
| 60 |
type: string |
| 61 |
enum: |
| 62 |
- active |
| 63 |
- completed |