mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
changed the order of content type headers in openapi spec file and giving json as a first preference
This commit is contained in:
16
lib/util.js
16
lib/util.js
@@ -602,23 +602,17 @@ module.exports = {
|
|||||||
responseBody: ''
|
responseBody: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let headers = Object.keys(contentObj),
|
let headers = Object.keys(contentObj);
|
||||||
result = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < headers.length; i++) {
|
for (let i = 0; i < headers.length; i++) {
|
||||||
let headerFamily = this.getHeaderFamily(headers[i]);
|
let headerFamily = this.getHeaderFamily(headers[i]);
|
||||||
if (headerFamily !== HEADER_TYPE.INVALID) {
|
if (headerFamily !== HEADER_TYPE.INVALID) {
|
||||||
result.push(headerFamily);
|
cTypeHeader = headers[i];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result[HEADER_TYPE.JSON]) {
|
|
||||||
cTypeHeader = result[HEADER_TYPE.JSON];
|
|
||||||
hasComputedType = true;
|
hasComputedType = true;
|
||||||
|
if (headerFamily === HEADER_TYPE.JSON) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (result[HEADER_TYPE.XML]) {
|
|
||||||
cTypeHeader = result[HEADER_TYPE.XML];
|
|
||||||
hasComputedType = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no JSON or XML, take whatever we have
|
// if no JSON or XML, take whatever we have
|
||||||
|
|||||||
@@ -30,13 +30,13 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "Ok: Successfully processed the request.",
|
"description": "Ok: Successfully processed the request.",
|
||||||
"content": {
|
"content": {
|
||||||
"application/vnd.retailer.v3+json": {
|
"application/vnd.retailer.v3+xml": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int32"
|
"format": "int32"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"application/vnd.retailer.v3+xml": {
|
"application/vnd.retailer.v3+json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int32"
|
"format": "int32"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ describe('CONVERT FUNCTION TESTS ', function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should generate collection for a custom content type headers requests.' +
|
it('Should generate collection for a custom content type headers requests' +
|
||||||
specPath4, function(done) {
|
specPath4, function(done) {
|
||||||
var openapi = fs.readFileSync(specPath4, 'utf8');
|
var openapi = fs.readFileSync(specPath4, 'utf8');
|
||||||
Converter.convert({ type: 'string', data: openapi }, { schemaFaker: true }, (err, conversionResult) => {
|
Converter.convert({ type: 'string', data: openapi }, { schemaFaker: true }, (err, conversionResult) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user