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

Commit 309fb31

Browse files
Marco Frisokylef
authored andcommitted
fix(oas3): modify parsePathItemObject and tests
1 parent d97db84 commit 309fb31

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

packages/fury-adapter-oas3-parser/lib/parser/oas/parsePathItemObject.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ function parsePathItemObject(context, member) {
132132
[isHttpMethodKey, parseOperationObject(context, member.key)],
133133

134134
// FIXME Parse $ref
135-
// FIXME Parse servers
136135

137136
[isUnsupportedKey, createUnsupportedMemberWarning(namespace, name)],
138137

@@ -152,10 +151,7 @@ function parsePathItemObject(context, member) {
152151
resource.href = hrefFromParameters(member.key, parameters);
153152
resource.hrefVariables = hrefVariablesFromParameters(namespace, parameters);
154153

155-
const hosts = pathItem.get('servers');
156-
if (hosts) {
157-
resource.push(hosts);
158-
}
154+
resource.hosts = pathItem.get('servers');
159155

160156
const summary = pathItem.get('summary');
161157
if (summary) {

packages/fury-adapter-oas3-parser/test/unit/parser/oas/parsePathItemObject-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ describe('Path Item Object', () => {
445445
expect(parseResult.length).to.equal(1);
446446
expect(parseResult.get(0)).to.be.instanceof(namespace.elements.Resource);
447447

448-
const hostsCategory = parseResult.get(0).get(0);
448+
const hostsCategory = parseResult.get(0).hosts;
449449
expect(hostsCategory).to.be.instanceof(namespace.elements.Category);
450450
expect(hostsCategory.classes.toValue()).to.deep.equal(['hosts']);
451451
expect(hostsCategory.length).to.equal(2);

packages/fury-adapter-oas3-parser/test/unit/parser/oas/parseServersArray-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const { minim: namespace } = new Fury();
77

88
describe('#parseServersArray', () => {
99
let context;
10+
const name = 'parent-name';
1011

1112
beforeEach(() => {
1213
context = new Context(namespace);
@@ -15,7 +16,6 @@ describe('#parseServersArray', () => {
1516
it('warns when it is not an array', () => {
1617
const servers = new namespace.elements.Object();
1718

18-
const name = 'parent-name';
1919
const parseResult = parse(context, name, servers);
2020

2121
expect(parseResult.length).to.equal(1);
@@ -30,7 +30,6 @@ describe('#parseServersArray', () => {
3030
},
3131
]);
3232

33-
const name = 'parent-name';
3433
const parseResult = parse(context, name, servers);
3534

3635
expect(parseResult.length).to.equal(1);
@@ -57,7 +56,6 @@ describe('#parseServersArray', () => {
5756
},
5857
]);
5958

60-
const name = 'parent-name';
6159
const parseResult = parse(context, name, servers);
6260

6361
expect(parseResult.length).to.equal(1);

0 commit comments

Comments
 (0)