Skip to content

Commit e6b51b1

Browse files
Release version v5.3.5 (#898)
* AB-1622-Removed empty properties if not present' --------- Co-authored-by: Ayush Shrivastav <[email protected]>
1 parent d72cea9 commit e6b51b1

File tree

5 files changed

+64
-4
lines changed

5 files changed

+64
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
## [v5.3.5] - 2025-11-10
6+
57
## [v5.3.4] - 2025-11-06
68

79
## [v5.3.3] - 2025-10-14
@@ -673,7 +675,9 @@ Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0
673675

674676
- Base release
675677

676-
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.3.4...HEAD
678+
[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.3.5...HEAD
679+
680+
[v5.3.5]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.3.4...v5.3.5
677681

678682
[v5.3.4]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.3.3...v5.3.4
679683

libV2/schemaUtils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ let QUERYPARAM = 'query',
890890
if (schemaDetails.required && schemaDetails.required.length === 0) {
891891
schemaDetails.required = undefined;
892892
}
893+
if (schemaDetails.properties && Object.keys(schemaDetails.properties).length === 0) {
894+
schemaDetails.properties = undefined;
895+
}
893896
return schemaDetails;
894897
}
895898
else if (resolvedSchema.type === 'array' && resolvedSchema.items) {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-to-postmanv2",
3-
"version": "5.3.4",
3+
"version": "5.3.5",
44
"description": "Convert a given OpenAPI specification to Postman Collection v2.0",
55
"homepage": "https://github.com/postmanlabs/openapi-to-postman",
66
"bugs": "https://github.com/postmanlabs/openapi-to-postman/issues",

test/unit/convertV2WithTypes.test.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,4 +1531,57 @@ describe('convertV2WithTypes', function() {
15311531
done();
15321532
});
15331533
});
1534+
1535+
it('should omit properties when object schema has no properties', function(done) {
1536+
const oas = {
1537+
openapi: '3.0.0',
1538+
info: { title: 'Empty Properties Test', version: '1.0.0' },
1539+
paths: {
1540+
'/empty': {
1541+
get: {
1542+
responses: {
1543+
'200': {
1544+
description: 'ok',
1545+
content: {
1546+
'application/json': {
1547+
schema: {
1548+
type: 'object'
1549+
}
1550+
}
1551+
}
1552+
}
1553+
}
1554+
},
1555+
post: {
1556+
requestBody: {
1557+
content: {
1558+
'application/json': {
1559+
schema: {
1560+
type: 'object'
1561+
}
1562+
}
1563+
}
1564+
},
1565+
responses: {
1566+
'200': { description: 'ok' }
1567+
}
1568+
}
1569+
}
1570+
}
1571+
};
1572+
1573+
Converter.convertV2WithTypes({ type: 'json', data: oas }, {}, (err, conversionResult) => {
1574+
expect(err).to.be.null;
1575+
const body = conversionResult.extractedTypes['get/empty'].response['200'].body;
1576+
const parsed = JSON.parse(body);
1577+
expect(parsed).to.have.property('type', 'object');
1578+
expect(parsed).to.not.have.property('properties');
1579+
1580+
const reqBody = conversionResult.extractedTypes['post/empty'].request.body;
1581+
const parsedReq = JSON.parse(reqBody);
1582+
expect(parsedReq).to.have.property('type', 'object');
1583+
expect(parsedReq).to.not.have.property('properties');
1584+
done();
1585+
});
1586+
});
15341587
});

0 commit comments

Comments
 (0)