Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit cc1f940

Browse files
kylefMarco Friso
andauthored
fix(oas3): server variables wrapped in object element
Co-authored-by: Marco Friso <marco.friso@oracle.com>
1 parent 2877f77 commit cc1f940

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/openapi3-parser/lib/parser/oas/parseServerObject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const parseServerObject = context => pipeParseResult(context.namespace,
8686
resource.href = object.get('url');
8787

8888
if (object.hasKey('variables')) {
89-
resource.hrefVariables = new context.namespace.elements.HrefVariables(object.get('variables'));
89+
resource.hrefVariables = new context.namespace.elements.HrefVariables(object.get('variables').content);
9090
}
9191

9292
return resource;

packages/openapi3-parser/test/unit/parser/oas/parseOpenAPIObject-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('#parseOpenAPIObject', () => {
9191
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
9292
expect(hrefVariables.length).to.equal(1);
9393

94-
const hrefVariable = hrefVariables.content.content[0];
94+
const hrefVariable = hrefVariables.content[0];
9595
expect(hrefVariable).to.be.instanceof(namespace.elements.Member);
9696
expect(hrefVariable.key.toValue()).to.equal('username');
9797
expect(hrefVariable.value.attributes.get('default').toValue()).to.equal('Mario');

packages/openapi3-parser/test/unit/parser/oas/parseOperationObject-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ describe('Operation Object', () => {
568568
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
569569
expect(hrefVariables.length).to.equal(1);
570570

571-
const hrefVariable = hrefVariables.content.content[0];
571+
const hrefVariable = hrefVariables.content[0];
572572
expect(hrefVariable).to.be.instanceof(namespace.elements.Member);
573573
expect(hrefVariable.key.toValue()).to.equal('username');
574574
expect(hrefVariable.value.attributes.get('default').toValue()).to.equal('Mario');

packages/openapi3-parser/test/unit/parser/oas/parsePathItemObject-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ describe('Path Item Object', () => {
478478
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
479479
expect(hrefVariables.length).to.equal(1);
480480

481-
const hrefVariable = hrefVariables.content.content[0];
481+
const hrefVariable = hrefVariables.content[0];
482482
expect(hrefVariable).to.be.instanceof(namespace.elements.Member);
483483
expect(hrefVariable.key.toValue()).to.equal('username');
484484
expect(hrefVariable.value.attributes.get('default').toValue()).to.equal('Mario');

packages/openapi3-parser/test/unit/parser/oas/parseServerObject-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ describe('#parseServerObject', () => {
128128
expect(resource).to.be.instanceof(namespace.elements.Resource);
129129

130130
const { hrefVariables } = resource;
131-
const firstHrefVariable = hrefVariables.content.content[0];
132-
const secondHrefVariable = hrefVariables.content.content[1];
131+
const firstHrefVariable = hrefVariables.content[0];
132+
const secondHrefVariable = hrefVariables.content[1];
133133

134134
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
135135
expect(hrefVariables.length).to.equal(2);
@@ -187,8 +187,8 @@ describe('#parseServerObject', () => {
187187
expect(resource).to.be.instanceof(namespace.elements.Resource);
188188

189189
const { hrefVariables } = resource;
190-
const firstHrefVariable = hrefVariables.content.content[0];
191-
const secondHrefVariable = hrefVariables.content.content[1];
190+
const firstHrefVariable = hrefVariables.content[0];
191+
const secondHrefVariable = hrefVariables.content[1];
192192

193193
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
194194
expect(hrefVariables.length).to.equal(2);
@@ -225,8 +225,8 @@ describe('#parseServerObject', () => {
225225
expect(resource).to.be.instanceof(namespace.elements.Resource);
226226

227227
const { hrefVariables } = resource;
228-
const firstHrefVariable = hrefVariables.content.content[0];
229-
const secondHrefVariable = hrefVariables.content.content[1];
228+
const firstHrefVariable = hrefVariables.content[0];
229+
const secondHrefVariable = hrefVariables.content[1];
230230

231231
expect(hrefVariables).to.be.instanceof(namespace.elements.HrefVariables);
232232
expect(hrefVariables.length).to.equal(2);

0 commit comments

Comments
 (0)