Skip to content

Commit 8108dfd

Browse files
author
sbmsr
committed
update swagger docs
1 parent dfc8a32 commit 8108dfd

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

src/docs/swagger.yaml

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,26 @@ paths:
2424
responses:
2525
"200":
2626
description: Returns Pokemon with id of {id}
27+
content:
28+
application/json:
29+
example:
30+
{
31+
id: 482,
32+
name: { english: "Azelf", japanese: "アグノム", chinese: "亚克诺姆", french: "Créfadet" },
33+
type: ["Psychic"],
34+
base: { HP: 75, Attack: 125, Defense: 70, "Sp. Attack": 125, "Sp. Defense": 70, Speed: 115 },
35+
}
2736
"400":
2837
description: Invalid ID. Id must be number.
38+
content:
39+
application/json:
40+
example: { error: "Invalid ID" }
41+
2942
"404":
3043
description: Pokemon not found with id of {id}
44+
content:
45+
application/json:
46+
example: { error: "Not found" }
3147
/pokemon/name/{name}:
3248
get:
3349
description: "get pokemon by name"
@@ -41,8 +57,20 @@ paths:
4157
responses:
4258
"200":
4359
description: Returns Pokemon with name of {name}
60+
content:
61+
application/json:
62+
example:
63+
{
64+
id: 151,
65+
name: { english: "Mew", japanese: "ミュウ", chinese: "梦幻", french: "Mew" },
66+
type: ["Psychic"],
67+
base: { HP: 100, Attack: 100, Defense: 100, "Sp. Attack": 100, "Sp. Defense": 100, Speed: 100 },
68+
}
4469
"404":
4570
description: Pokemon not found with name of {name}
71+
content:
72+
application/json:
73+
example: { error: "Not found" }
4674
/pokemon/type/{type}:
4775
get:
4876
description: "get pokemon by type"
@@ -77,10 +105,28 @@ paths:
77105
responses:
78106
"200":
79107
description: Returns all Pokemon with type of {type}
108+
content:
109+
application/json:
110+
example:
111+
[
112+
{
113+
id: 35,
114+
name: { english: "Clefairy", japanese: "ピッピ", chinese: "皮皮", french: "Mélofée" },
115+
type: ["Fairy"],
116+
base: { HP: 70, Attack: 45, Defense: 48, "Sp. Attack": 60, "Sp. Defense": 65, Speed: 35 },
117+
},
118+
// more values ...,
119+
]
80120
"400":
81121
description: Invalid type provided.
82-
"404":
83-
description: Pokemon not found with type of {type}
122+
content:
123+
application/json:
124+
schema:
125+
type: object
126+
properties:
127+
error:
128+
type: string
129+
example: { error: "Bad request" }
84130
/pokemon/hp:
85131
get:
86132
description: "get pokemon, filtered by hp"
@@ -130,7 +176,33 @@ paths:
130176
responses:
131177
"200":
132178
description: Returns all Pokemon, filtered by HP
179+
content:
180+
application/json:
181+
example:
182+
{
183+
id: 242,
184+
name: { english: "Blissey", japanese: "ハピナス", chinese: "幸福蛋", french: "Leuphorie" },
185+
type: ["Normal"],
186+
base: { HP: 255, Attack: 10, Defense: 10, "Sp. Attack": 75, "Sp. Defense": 135, Speed: 55 },
187+
}
133188
"400":
134189
description: Invalid HP Filter(s) provided
190+
content:
191+
application/json:
192+
schema:
193+
type: object
194+
properties:
195+
error:
196+
type: string
197+
example: { error: 'Invalid Operator. Must be one of ["gt","gte","lt","lte"]' }
198+
135199
"404":
136200
description: No pokemon found for given filter(s)
201+
content:
202+
application/json:
203+
schema:
204+
type: object
205+
properties:
206+
error:
207+
type: string
208+
example: { error: "Not found" }

0 commit comments

Comments
 (0)