-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpets_api.yaml
147 lines (147 loc) · 3.64 KB
/
pets_api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
openapi: 3.0.2
info:
title: Pets API
description: A simple API to manage pets
version: 1.0.0
servers:
- url: http://localhost:8080
description: Local server
- url: https://api.example.com
description: Production server
paths:
/cats:
get:
tags:
- Cats
operationId: getCats
summary: Get a list of all cats
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Cat'
examples:
Cats:
value:
- id: "a3b58e17-0a89-4d84-a3d2-89c4bf4ebec3"
name: Fluffy
breed: Persian
age: 2
- id: "8a5e1b27-c7f5-4d46-91b8-25bbce6d3a14"
name: Muffin
breed: Siamese
age: 4
post:
tags:
- Cats
operationId: createCat
summary: Create a new cat
requestBody:
required: true
content:
application/json:
examples:
CreatedCat:
value:
id: "a3b58e17-0a89-4d84-a3d2-89c4bf4ebec3"
name: Fluffy
breed: Persian
age: 2
schema:
$ref: '#/components/schemas/CreatedCat'
responses:
'201':
description: Cat created successfully
content:
application/json:
examples:
CreatedCat:
value:
id: "a3b58e17-0a89-4d84-a3d2-89c4bf4ebec3"
name: Fluffy
breed: Persian
age: 2
/cats/{id}:
get:
tags:
- Cats
operationId: getCat
summary: Get information about a specific cat
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successful response
content:
application/json:
examples:
Cat:
value:
id: "a3b58e17-0a89-4d84-a3d2-89c4bf4ebec3"
name: Fluffy
breed: Persian
age: 2
'404':
description: Cat not found
put:
tags:
- Cats
operationId: updateCat
summary: Update information about a specific cat
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
examples:
UpdatedCat:
value:
id: "a3b58e17-0a89-4d84-a3d2-89c4bf4ebec3"
name: Fluffy
breed: Persian
age: 3
schema:
$ref: '#/components/schemas/UpdatedCat'
responses:
'200':
description: Cat updated successfully
components:
schemas:
Cat:
type: object
required:
- name
- breed
- age
properties:
id:
type: string
format: uuid
readOnly: true
name:
type: string
breed:
type: string
age:
type: integer
CreatedCat:
allOf:
- $ref: '#/components/schemas/Cat'
UpdatedCat:
allOf:
- $ref: '#/components/schemas/Cat'