Skip to content

Commit 6cb2177

Browse files
authored
Merge pull request #3 from maxholman/oai31
Small feature release
2 parents 8149f4a + dd27d2e commit 6cb2177

15 files changed

Lines changed: 482 additions & 235 deletions

File tree

__tests__/__snapshots__/openapi-schema.test.ts.snap

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ exports[`Example > OpenAPI 1`] = `
159159
},
160160
},
161161
"description": "",
162+
"required": true,
162163
},
163164
"responses": {
164165
"200": {
@@ -232,6 +233,7 @@ exports[`Example > OpenAPI 1`] = `
232233
},
233234
},
234235
"description": "",
236+
"required": true,
235237
},
236238
"responses": {
237239
"200": {
@@ -242,7 +244,7 @@ exports[`Example > OpenAPI 1`] = `
242244
},
243245
},
244246
},
245-
"description": "",
247+
"description": "Successful response",
246248
},
247249
},
248250
"tags": [],
@@ -260,6 +262,19 @@ exports[`Example > OpenAPI 1`] = `
260262
},
261263
{},
262264
],
265+
"servers": [
266+
{
267+
"url": "https://api.example.com/",
268+
},
269+
],
270+
"tags": [
271+
{
272+
"name": "user",
273+
},
274+
{
275+
"name": "random",
276+
},
277+
],
263278
}
264279
`;
265280

@@ -579,6 +594,7 @@ exports[`Example > Swagger Parser validate 1`] = `
579594
},
580595
},
581596
"description": "",
597+
"required": true,
582598
},
583599
"responses": {
584600
"200": {
@@ -763,6 +779,7 @@ exports[`Example > Swagger Parser validate 1`] = `
763779
},
764780
},
765781
"description": "",
782+
"required": true,
766783
},
767784
"responses": {
768785
"200": {
@@ -812,7 +829,7 @@ exports[`Example > Swagger Parser validate 1`] = `
812829
},
813830
},
814831
},
815-
"description": "",
832+
"description": "Successful response",
816833
},
817834
},
818835
"tags": [],
@@ -830,6 +847,19 @@ exports[`Example > Swagger Parser validate 1`] = `
830847
},
831848
{},
832849
],
850+
"servers": [
851+
{
852+
"url": "https://api.example.com/",
853+
},
854+
],
855+
"tags": [
856+
{
857+
"name": "user",
858+
},
859+
{
860+
"name": "random",
861+
},
862+
],
833863
}
834864
`;
835865

@@ -1072,6 +1102,7 @@ exports[`Note Taking > OpenAPI 1`] = `
10721102
},
10731103
},
10741104
"description": "",
1105+
"required": true,
10751106
},
10761107
"responses": {
10771108
"200": {
@@ -1123,11 +1154,11 @@ exports[`Note Taking > OpenAPI 1`] = `
11231154
"responses": {
11241155
"204": {
11251156
"content": {},
1126-
"description": "",
1157+
"description": "Successful response",
11271158
},
11281159
"404": {
11291160
"content": {},
1130-
"description": "",
1161+
"description": "Successful response",
11311162
},
11321163
},
11331164
"security": [
@@ -1151,6 +1182,7 @@ exports[`Note Taking > OpenAPI 1`] = `
11511182
},
11521183
},
11531184
"description": "",
1185+
"required": true,
11541186
},
11551187
"responses": {
11561188
"200": {
@@ -1161,14 +1193,15 @@ exports[`Note Taking > OpenAPI 1`] = `
11611193
},
11621194
},
11631195
},
1164-
"description": "",
1196+
"description": "Successful response",
11651197
},
11661198
},
11671199
"tags": [],
11681200
},
11691201
},
11701202
"/users/{userId}/notes": {
11711203
"get": {
1204+
"description": "List all of the notes",
11721205
"operationId": "listNotesCommand",
11731206
"responses": {
11741207
"200": {
@@ -1182,6 +1215,7 @@ exports[`Note Taking > OpenAPI 1`] = `
11821215
"description": "Notes 200 response",
11831216
},
11841217
},
1218+
"summary": "List notes",
11851219
"tags": [
11861220
"user",
11871221
],
@@ -1192,6 +1226,7 @@ exports[`Note Taking > OpenAPI 1`] = `
11921226
},
11931227
],
11941228
"post": {
1229+
"deprecated": true,
11951230
"operationId": "createNoteCommand",
11961231
"requestBody": {
11971232
"content": {
@@ -1202,6 +1237,7 @@ exports[`Note Taking > OpenAPI 1`] = `
12021237
},
12031238
},
12041239
"description": "",
1240+
"required": true,
12051241
},
12061242
"responses": {
12071243
"200": {
@@ -1267,6 +1303,7 @@ exports[`Note Taking > OpenAPI 1`] = `
12671303
},
12681304
},
12691305
"description": "",
1306+
"required": true,
12701307
},
12711308
"responses": {
12721309
"200": {
@@ -1277,7 +1314,7 @@ exports[`Note Taking > OpenAPI 1`] = `
12771314
},
12781315
},
12791316
},
1280-
"description": "",
1317+
"description": "Successful response",
12811318
},
12821319
},
12831320
"tags": [],
@@ -1300,6 +1337,16 @@ exports[`Note Taking > OpenAPI 1`] = `
13001337
],
13011338
},
13021339
],
1340+
"servers": [
1341+
{
1342+
"url": "https://api.example.com/",
1343+
},
1344+
],
1345+
"tags": [
1346+
{
1347+
"name": "user",
1348+
},
1349+
],
13031350
}
13041351
`;
13051352

@@ -1715,6 +1762,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
17151762
},
17161763
},
17171764
"description": "",
1765+
"required": true,
17181766
},
17191767
"responses": {
17201768
"200": {
@@ -1838,11 +1886,11 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
18381886
"responses": {
18391887
"204": {
18401888
"content": {},
1841-
"description": "",
1889+
"description": "Successful response",
18421890
},
18431891
"404": {
18441892
"content": {},
1845-
"description": "",
1893+
"description": "Successful response",
18461894
},
18471895
},
18481896
"security": [
@@ -1897,6 +1945,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
18971945
},
18981946
},
18991947
"description": "",
1948+
"required": true,
19001949
},
19011950
"responses": {
19021951
"200": {
@@ -1941,14 +1990,15 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
19411990
},
19421991
},
19431992
},
1944-
"description": "",
1993+
"description": "Successful response",
19451994
},
19461995
},
19471996
"tags": [],
19481997
},
19491998
},
19501999
"/users/{userId}/notes": {
19512000
"get": {
2001+
"description": "List all of the notes",
19522002
"operationId": "listNotesCommand",
19532003
"responses": {
19542004
"200": {
@@ -1987,6 +2037,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
19872037
"description": "Notes 200 response",
19882038
},
19892039
},
2040+
"summary": "List notes",
19902041
"tags": [
19912042
"user",
19922043
],
@@ -2004,6 +2055,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
20042055
},
20052056
],
20062057
"post": {
2058+
"deprecated": true,
20072059
"operationId": "createNoteCommand",
20082060
"requestBody": {
20092061
"content": {
@@ -2035,6 +2087,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
20352087
},
20362088
},
20372089
"description": "",
2090+
"required": true,
20382091
},
20392092
"responses": {
20402093
"200": {
@@ -2174,6 +2227,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
21742227
},
21752228
},
21762229
"description": "",
2230+
"required": true,
21772231
},
21782232
"responses": {
21792233
"200": {
@@ -2205,7 +2259,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
22052259
},
22062260
},
22072261
},
2208-
"description": "",
2262+
"description": "Successful response",
22092263
},
22102264
},
22112265
"tags": [],
@@ -2228,5 +2282,15 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
22282282
],
22292283
},
22302284
],
2285+
"servers": [
2286+
{
2287+
"url": "https://api.example.com/",
2288+
},
2289+
],
2290+
"tags": [
2291+
{
2292+
"name": "user",
2293+
},
2294+
],
22312295
}
22322296
`;

__tests__/fixtures/apis/note-taking.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ new Path(noteTakingApi, {
272272
})
273273
.addOperation(HttpMethods.GET, {
274274
operationId: 'listNotesCommand',
275+
description: 'List all of the notes',
276+
summary: 'List notes',
275277
responses: {
276278
200: new Response(noteTakingApi, 'ListNotesResponse', {
277279
description: 'Notes 200 response',
@@ -284,7 +286,9 @@ new Path(noteTakingApi, {
284286
})
285287
.addOperation(HttpMethods.POST, {
286288
operationId: 'createNoteCommand',
289+
deprecated: true,
287290
requestBody: {
291+
required: true,
288292
content: {
289293
contentType: 'application/json',
290294
schema: createNoteRequest,

0 commit comments

Comments
 (0)