Skip to content
84 changes: 74 additions & 10 deletions __tests__/__snapshots__/openapi-schema.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ exports[`Example > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -232,6 +233,7 @@ exports[`Example > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand All @@ -242,7 +244,7 @@ exports[`Example > OpenAPI 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
Expand All @@ -260,6 +262,19 @@ exports[`Example > OpenAPI 1`] = `
},
{},
],
"servers": [
{
"url": "https://api.example.com/",
},
],
"tags": [
{
"name": "user",
},
{
"name": "random",
},
],
}
`;

Expand Down Expand Up @@ -579,6 +594,7 @@ exports[`Example > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -763,6 +779,7 @@ exports[`Example > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -812,7 +829,7 @@ exports[`Example > Swagger Parser validate 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
Expand All @@ -830,6 +847,19 @@ exports[`Example > Swagger Parser validate 1`] = `
},
{},
],
"servers": [
{
"url": "https://api.example.com/",
},
],
"tags": [
{
"name": "user",
},
{
"name": "random",
},
],
}
`;

Expand Down Expand Up @@ -1072,6 +1102,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -1123,11 +1154,11 @@ exports[`Note Taking > OpenAPI 1`] = `
"responses": {
"204": {
"content": {},
"description": "",
"description": "Successful response",
},
"404": {
"content": {},
"description": "",
"description": "Successful response",
},
},
"security": [
Expand All @@ -1151,6 +1182,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand All @@ -1161,14 +1193,15 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
},
},
"/users/{userId}/notes": {
"get": {
"description": "List all of the notes",
"operationId": "listNotesCommand",
"responses": {
"200": {
Expand All @@ -1182,6 +1215,7 @@ exports[`Note Taking > OpenAPI 1`] = `
"description": "Notes 200 response",
},
},
"summary": "List notes",
"tags": [
"user",
],
Expand All @@ -1192,6 +1226,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
],
"post": {
"deprecated": true,
"operationId": "createNoteCommand",
"requestBody": {
"content": {
Expand All @@ -1202,6 +1237,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -1267,6 +1303,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand All @@ -1277,7 +1314,7 @@ exports[`Note Taking > OpenAPI 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
Expand All @@ -1300,6 +1337,16 @@ exports[`Note Taking > OpenAPI 1`] = `
],
},
],
"servers": [
{
"url": "https://api.example.com/",
},
],
"tags": [
{
"name": "user",
},
],
}
`;

Expand Down Expand Up @@ -1715,6 +1762,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -1838,11 +1886,11 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
"responses": {
"204": {
"content": {},
"description": "",
"description": "Successful response",
},
"404": {
"content": {},
"description": "",
"description": "Successful response",
},
},
"security": [
Expand Down Expand Up @@ -1897,6 +1945,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -1941,14 +1990,15 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
},
},
"/users/{userId}/notes": {
"get": {
"description": "List all of the notes",
"operationId": "listNotesCommand",
"responses": {
"200": {
Expand Down Expand Up @@ -1987,6 +2037,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
"description": "Notes 200 response",
},
},
"summary": "List notes",
"tags": [
"user",
],
Expand All @@ -2004,6 +2055,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
],
"post": {
"deprecated": true,
"operationId": "createNoteCommand",
"requestBody": {
"content": {
Expand Down Expand Up @@ -2035,6 +2087,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -2174,6 +2227,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
"description": "",
"required": true,
},
"responses": {
"200": {
Expand Down Expand Up @@ -2205,7 +2259,7 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
},
},
},
"description": "",
"description": "Successful response",
},
},
"tags": [],
Expand All @@ -2228,5 +2282,15 @@ exports[`Note Taking > Swagger Parser validate 1`] = `
],
},
],
"servers": [
{
"url": "https://api.example.com/",
},
],
"tags": [
{
"name": "user",
},
],
}
`;
4 changes: 4 additions & 0 deletions __tests__/fixtures/apis/note-taking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ new Path(noteTakingApi, {
})
.addOperation(HttpMethods.GET, {
operationId: 'listNotesCommand',
description: 'List all of the notes',
summary: 'List notes',
responses: {
200: new Response(noteTakingApi, 'ListNotesResponse', {
description: 'Notes 200 response',
Expand All @@ -284,7 +286,9 @@ new Path(noteTakingApi, {
})
.addOperation(HttpMethods.POST, {
operationId: 'createNoteCommand',
deprecated: true,
requestBody: {
required: true,
content: {
contentType: 'application/json',
schema: createNoteRequest,
Expand Down
Loading