Merge pull request #544 from postmanlabs/fix/referencedComponents

Fix/referenced components
This commit is contained in:
Carlos-Veloz
2022-06-13 17:31:50 -05:00
committed by GitHub
23 changed files with 1219 additions and 1 deletions

View File

@@ -23,6 +23,21 @@ const COMPONENTS_KEYS_30 = [
],
PROPERTY_DEFINITION = [
'properties'
],
RESPONSE_DEFINITION = [
'responses'
],
REQUEST_BODY_CONTAINER = [
'requestBody'
],
LINKS_CONTAINER = [
'links'
],
HEADER_DEFINITION = [
'headers'
],
CALLBACK_DEFINITION = [
'callbacks'
];
module.exports = {
@@ -55,6 +70,12 @@ module.exports = {
if (EXAMPLE_CONTAINERS.includes(item)) {
item = 'examples';
}
if (REQUEST_BODY_CONTAINER.includes(item)) {
item = 'requestBodies';
}
if (LINKS_CONTAINER.includes(trace[index + 2])) {
trace[index + 1] = 'links';
}
if (PROPERTY_DEFINITION.includes(trace[index + 2])) {
trace[index + 1] = 'schemas';
}
@@ -63,6 +84,15 @@ module.exports = {
matchFound = true;
break;
}
if (RESPONSE_DEFINITION.includes(trace[index + 2])) {
trace[index + 1] = 'responses';
}
if (HEADER_DEFINITION.includes(trace[index + 2])) {
trace[index + 1] = 'headers';
}
if (CALLBACK_DEFINITION.includes(trace[index + 2])) {
trace[index + 1] = 'callbacks';
}
}
return matchFound ?
traceToKey.reverse() :