mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fix for https://github.com/postmanlabs/openapi-to-postman/issues/5 - headers that have refs to deeper components are correctly generated
This commit is contained in:
@@ -1062,8 +1062,9 @@ module.exports = {
|
||||
_.forOwn(response.headers, (value, key) => {
|
||||
if (key !== 'Content-Type') {
|
||||
if (value.$ref) {
|
||||
// the convert to PmHeader function handles the
|
||||
// schema-faking
|
||||
header = this.getRefObject(value.$ref);
|
||||
// header.name = value.$ref.split('/').slice(3)[0];
|
||||
}
|
||||
else {
|
||||
header = value;
|
||||
@@ -1115,8 +1116,8 @@ module.exports = {
|
||||
var refObj, savedSchema;
|
||||
|
||||
savedSchema = $ref.split('/').slice(2);
|
||||
// must have 2 segments after "#/components"
|
||||
if (savedSchema.length !== 2) {
|
||||
// must have min. 2 segments after "#/components"
|
||||
if (savedSchema.length < 2) {
|
||||
console.warn(`ref ${$ref} not found.`);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user