Skip to content

Commit 1f7e031

Browse files
committed
Copy path variable description to generated collection
1 parent 50e1eb0 commit 1f7e031

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"object-hash": "3.0.0",
129129
"graphlib": "2.1.8",
130130
"path-browserify": "1.0.1",
131-
"postman-collection": "4.1.5",
131+
"postman-collection": "4.2.1",
132132
"swagger2openapi": "7.0.8",
133133
"traverse": "0.6.6",
134134
"yaml": "1.10.2"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: "1.0.0"
4+
title: "Sample API"
5+
description: Buy or rent spacecrafts
6+
7+
paths:
8+
/space/{spacecraftId}:
9+
get:
10+
parameters:
11+
- name: spacecraftId
12+
description: PATH_PARAM_DESCRIPTION
13+
in: path
14+
required: true
15+
schema:
16+
type: string
17+
- name: limit
18+
in: query
19+
description: QUERY_PARAM_DESCRIPTION
20+
required: false
21+
schema:
22+
type: integer
23+
format: int32
24+
- name: page
25+
in: header
26+
description: "HEADER_DESCRIPTION_NOT_PRESENT"
27+
required: false
28+
schema:
29+
type: string
30+
summary: Read a spacecraft
31+
responses:
32+
"201":
33+
description: The spacecraft corresponding to the provided `spacecraftId`
34+
content:
35+
application/json:
36+
schema:
37+
type: string

test/unit/convertV2.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const expect = require('chai').expect,
5454
path.join(__dirname, VALID_OPENAPI_PATH, '/query_param_with_enum_resolve_as_example.json'),
5555
formDataParamDescription = path.join(__dirname, VALID_OPENAPI_PATH, '/form_data_param_description.yaml'),
5656
allHTTPMethodsSpec = path.join(__dirname, VALID_OPENAPI_PATH, '/all-http-methods.yaml'),
57+
descriptionTestSpec = path.join(__dirname, VALID_OPENAPI_PATH, '/description-test.yaml'),
5758
invalidNullInfo = path.join(__dirname, INVALID_OPENAPI_PATH, '/invalid-null-info.json'),
5859
invalidNullInfoTitle = path.join(__dirname, INVALID_OPENAPI_PATH, '/invalid-info-null-title.json'),
5960
invalidNullInfoVersion = path.join(__dirname, INVALID_OPENAPI_PATH, '/invalid-info-null-version.json'),
@@ -1170,6 +1171,24 @@ describe('The convert v2 Function', function() {
11701171
});
11711172
});
11721173

1174+
it('description test', function(done) {
1175+
var openapi = fs.readFileSync(descriptionTestSpec, 'utf8');
1176+
1177+
Converter.convertV2({ type: 'string', data: openapi },
1178+
{}, (err, conversionResult) => {
1179+
expect(conversionResult.output[0].data.item[0].item[0].item[0].request.url.query[0].description.content).to.equal(
1180+
'QUERY PARAM DESCRIPTION'
1181+
);
1182+
expect(conversionResult.output[0].data.item[0].item[0].item[0].request.url.variable[0].description).to.equal(
1183+
'PATH PARAM DESCRIPTION'
1184+
);
1185+
expect(conversionResult.output[0].data.item[0].item[0].item[0].request.url.header[0].description).to.equal(
1186+
'HEADER PARAM DESCRIPTION'
1187+
);
1188+
done();
1189+
});
1190+
});
1191+
11731192
it('Should have disableBodyPruning option for protocolProfileBehavior set to true for all types of request' +
11741193
allHTTPMethodsSpec, function (done) {
11751194
var openapi = fs.readFileSync(allHTTPMethodsSpec, 'utf8');

0 commit comments

Comments
 (0)