Skip to content

Commit 01654f0

Browse files
authored
Merge pull request #650 from postmanlabs/feat/deprecatedOption
Feat/deprecated option
2 parents 941823d + c92f37f commit 01654f0

26 files changed

+3390
-74
lines changed

OPTIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ disableOptionalParameters|boolean|-|false|Whether to set optional parameters as
2323
keepImplicitHeaders|boolean|-|false|Whether to keep implicit headers from the OpenAPI specification, which are removed by default.|CONVERSION
2424
includeWebhooks|boolean|-|false|Select whether to include Webhooks in the generated collection|CONVERSION
2525
includeReferenceMap|boolean|-|false|Whether or not to include reference map or not as part of output|BUNDLE
26+
includeDeprecated|boolean|-|true|Select whether to include deprecated operations, parameters, and properties in generated collection or not|CONVERSION, VALIDATION

lib/options.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,17 @@ module.exports = {
308308
external: false,
309309
usage: ['BUNDLE'],
310310
supportedIn: [VERSION20, VERSION30, VERSION31]
311+
},
312+
{
313+
name: 'Include deprecated properties',
314+
id: 'includeDeprecated',
315+
type: 'boolean',
316+
default: true,
317+
description: 'Select whether to include deprecated operations, parameters,' +
318+
' and properties in generated collection or not',
319+
external: true,
320+
usage: ['CONVERSION', 'VALIDATION'],
321+
supportedIn: [VERSION20, VERSION30, VERSION31]
311322
}
312323
];
313324

lib/schemaUtils.js

Lines changed: 104 additions & 56 deletions
Large diffs are not rendered by default.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"version": "1.0.0",
5+
"title": "Swagger Petstore",
6+
"license": {
7+
"name": "MIT"
8+
}
9+
},
10+
"servers": [
11+
{
12+
"url": "http://petstore.swagger.io/v1"
13+
}
14+
],
15+
"paths": {
16+
"/pets": {
17+
"post": {
18+
"summary": "Create a pet",
19+
"operationId": "createPets",
20+
"tags": [
21+
"pets"
22+
],
23+
"requestBody": {
24+
"content": {
25+
"application/json": {
26+
"schema": {
27+
"type": "object",
28+
"properties": {
29+
"a": {
30+
"type": "string",
31+
"deprecated": true
32+
},
33+
"b": {
34+
"type": "string",
35+
"example": "example-b"
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"responses": {
43+
"201": {
44+
"description": "Null response"
45+
},
46+
"default": {
47+
"description": "unexpected error",
48+
"content": {
49+
"application/json": {
50+
"schema": {
51+
"$ref": "#/components/schemas/Error"
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}
58+
}
59+
},
60+
"components": {
61+
"schemas": {
62+
"Error": {
63+
"type": "object",
64+
"properties": {
65+
"ErrorData": {
66+
"type": "object",
67+
"properties": {
68+
"code": {
69+
"type": "integer",
70+
"format": "int32"
71+
},
72+
"message": {
73+
"type": "string"
74+
},
75+
"errorCode": {
76+
"type": "string",
77+
"deprecated": true,
78+
"default": "<string>"
79+
}
80+
}
81+
}
82+
}
83+
}
84+
}
85+
}
86+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"version": "1.0.0",
5+
"title": "Swagger Petstore",
6+
"license": {
7+
"name": "MIT"
8+
}
9+
},
10+
"servers": [
11+
{
12+
"url": "http://petstore.swagger.io/v1"
13+
}
14+
],
15+
"paths": {
16+
"/pets": {
17+
"get": {
18+
"summary": "List all pets",
19+
"operationId": "listPets",
20+
"requestBody": {
21+
"content": {
22+
"application/json": {
23+
"schema": {
24+
"properties": {
25+
"key1": {
26+
"$ref":"#/components/schemas/RequestBody"
27+
},
28+
"key2": {
29+
"$ref":"#/components/schemas/RequestBody"
30+
}
31+
}
32+
}
33+
}
34+
}
35+
},
36+
"responses": {
37+
"200": {
38+
"description": "An paged array of pets",
39+
"content": {
40+
"application/json": {
41+
"schema": {
42+
"properties":{
43+
"key1": {
44+
"$ref": "#/components/schemas/ResponseBody"
45+
},
46+
"key2": {
47+
"$ref": "#/components/schemas/ResponseBody"
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
},
55+
"deprecated": true
56+
}
57+
}
58+
},
59+
"components": {
60+
"schemas": {
61+
"RequestBody": {
62+
"required": [
63+
"requestId",
64+
"requestName"
65+
],
66+
"properties": {
67+
"requestId": {
68+
"type": "integer",
69+
"format": "int64",
70+
"examples": [123456]
71+
},
72+
"requestName": {
73+
"type": "string"
74+
}
75+
}
76+
},
77+
"ResponseBody": {
78+
"required": [
79+
"responseId",
80+
"responseName"
81+
],
82+
"properties": {
83+
"responseId": {
84+
"type": "integer",
85+
"format": "int64",
86+
"examples": [234]
87+
},
88+
"responseName": {
89+
"type":"string",
90+
"examples": ["200 OK Response"]
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"version": "1.0.0",
5+
"title": "Swagger Petstore",
6+
"license": {
7+
"name": "MIT"
8+
}
9+
},
10+
"servers": [
11+
{
12+
"url": "http://petstore.swagger.io/v1"
13+
}
14+
],
15+
"paths": {
16+
"/pets": {
17+
"get": {
18+
"summary": "List all pets",
19+
"operationId": "listPets",
20+
"requestBody": {
21+
"content": {
22+
"application/json": {
23+
"schema": {
24+
"properties": {
25+
"key1": {
26+
"$ref":"#/components/schemas/RequestBody"
27+
},
28+
"key2": {
29+
"$ref":"#/components/schemas/RequestBody"
30+
}
31+
}
32+
}
33+
}
34+
}
35+
},
36+
"responses": {
37+
"200": {
38+
"description": "An paged array of pets",
39+
"content": {
40+
"application/json": {
41+
"schema": {
42+
"properties":{
43+
"key1": {
44+
"$ref": "#/components/schemas/ResponseBody"
45+
},
46+
"key2": {
47+
"$ref": "#/components/schemas/ResponseBody"
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
},
55+
"deprecated": true
56+
},
57+
"post": {
58+
"summary": "Create a pet",
59+
"operationId": "createPets",
60+
"tags": [
61+
"pets"
62+
],
63+
"responses": {
64+
"201": {
65+
"description": "Null response"
66+
},
67+
"default": {
68+
"description": "unexpected error",
69+
"content": {
70+
"application/json": {
71+
"schema": {
72+
"properties": {
73+
"key1": {
74+
"$ref":"#/components/schemas/RequestBody"
75+
},
76+
"key2": {
77+
"$ref":"#/components/schemas/RequestBody"
78+
}
79+
}
80+
}
81+
}
82+
}
83+
}
84+
}
85+
}
86+
}
87+
},
88+
"components": {
89+
"schemas": {
90+
"RequestBody": {
91+
"required": [
92+
"requestId",
93+
"requestName"
94+
],
95+
"properties": {
96+
"requestId": {
97+
"type": "integer",
98+
"format": "int64",
99+
"examples": [123456]
100+
},
101+
"requestName": {
102+
"type": "string"
103+
}
104+
}
105+
},
106+
"ResponseBody": {
107+
"required": [
108+
"responseId",
109+
"responseName"
110+
],
111+
"properties": {
112+
"responseId": {
113+
"type": "integer",
114+
"format": "int64",
115+
"examples": [234]
116+
},
117+
"responseName": {
118+
"type":"string",
119+
"examples": ["200 OK Response"]
120+
}
121+
}
122+
}
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)