From f74efe1dcd1a62fe821402883c7663693ec250ed Mon Sep 17 00:00:00 2001 From: Erik Mendoza Date: Mon, 13 Jun 2022 14:57:18 -0500 Subject: [PATCH] moving the link scenario to the correct rule while resolving it - fixing the expected file - fixing the root file --- lib/30XUtils/componentsParentMatcher.js | 4 ++-- test/data/toBundleExamples/referenced_link/expected.json | 4 +++- test/data/toBundleExamples/referenced_link/root.yaml | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/30XUtils/componentsParentMatcher.js b/lib/30XUtils/componentsParentMatcher.js index fb840a3..330e717 100644 --- a/lib/30XUtils/componentsParentMatcher.js +++ b/lib/30XUtils/componentsParentMatcher.js @@ -73,8 +73,8 @@ module.exports = { if (REQUEST_BODY_CONTAINER.includes(item)) { item = 'requestBodies'; } - if (LINKS_CONTAINER.includes(item)) { - item = 'links'; + if (LINKS_CONTAINER.includes(trace[index + 2])) { + trace[index + 1] = 'links'; } if (PROPERTY_DEFINITION.includes(trace[index + 2])) { trace[index + 1] = 'schemas'; diff --git a/test/data/toBundleExamples/referenced_link/expected.json b/test/data/toBundleExamples/referenced_link/expected.json index 6411b35..f96373c 100644 --- a/test/data/toBundleExamples/referenced_link/expected.json +++ b/test/data/toBundleExamples/referenced_link/expected.json @@ -30,7 +30,9 @@ } }, "links": { - "$ref": "#/components/links/_link.yaml" + "theLinkId": { + "$ref": "#/components/links/_link.yaml" + } } } } diff --git a/test/data/toBundleExamples/referenced_link/root.yaml b/test/data/toBundleExamples/referenced_link/root.yaml index 900c550..c4310e8 100644 --- a/test/data/toBundleExamples/referenced_link/root.yaml +++ b/test/data/toBundleExamples/referenced_link/root.yaml @@ -25,7 +25,8 @@ paths: items: $ref: "#/components/schemas/Pet" links: - $ref: "./link.yaml" + theLinkId: + $ref: "./link.yaml" components: schemas: Pet: