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

Commit 06ae665

Browse files
honzajavorekkylef
authored andcommitted
refactor: Address pull request feedback
1 parent cbaa002 commit 06ae665

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ function parseParameterObject(minim, object) {
4040
const validateIn = R.unless(isValidInValue, createError(minim,
4141
"'Parameter Object' 'in' must be either 'query, 'header', 'path' or 'cookie'"));
4242

43+
// FIXME: The following should not be an error
4344
const ensureInPath = R.unless(hasValue('path'), createError(minim,
44-
"Only 'in' values of 'path' is supported at the moment"));
45+
"Only 'in' values of 'path' are supported at the moment"));
4546

4647
const parseIn = pipeParseResult(minim,
4748
parseString(minim, name, true),

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function extractPathVariables(path) {
4343
}
4444

4545
function createErrorForMissingPathParameter(minim, path, variable) {
46+
// FIXME: This shouldn't be an error
4647
const message = `Path '${path.toValue()}' contains variable '${variable}' which is not declared in the parameters section of the '${name}'`;
4748
return createError(minim, message, path);
4849
}
@@ -60,15 +61,11 @@ function createErrorForMissingPathVariable(minim, path, variable) {
6061
*/
6162
function validatePathForMissingHrefVariables(minim, path, pathItem) {
6263
const pathVariables = extractPathVariables(path.toValue());
63-
64-
let missingParameters;
65-
6664
const hrefVariables = pathItem.get('parameters');
67-
if (hrefVariables) {
68-
missingParameters = pathVariables.filter(name => !hrefVariables.getMember(name));
69-
} else {
70-
missingParameters = pathVariables;
71-
}
65+
66+
const missingParameters = hrefVariables
67+
? pathVariables.filter(name => !hrefVariables.getMember(name))
68+
: pathVariables;
7269

7370
if (missingParameters.length > 0) {
7471
const toError = R.curry(createErrorForMissingPathParameter)(minim, path);

packages/fury-adapter-oas3-parser/test/parser/oas/test_parseParameterObject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Parameter Object', () => {
7171

7272
expect(result.length).to.equal(1);
7373
expect(result.errors.get(0).toValue()).to.equal(
74-
"Only 'in' values of 'path' is supported at the moment"
74+
"Only 'in' values of 'path' are supported at the moment"
7575
);
7676
});
7777

@@ -85,7 +85,7 @@ describe('Parameter Object', () => {
8585

8686
expect(result.length).to.equal(1);
8787
expect(result.errors.get(0).toValue()).to.equal(
88-
"Only 'in' values of 'path' is supported at the moment"
88+
"Only 'in' values of 'path' are supported at the moment"
8989
);
9090
});
9191

@@ -99,7 +99,7 @@ describe('Parameter Object', () => {
9999

100100
expect(result.length).to.equal(1);
101101
expect(result.errors.get(0).toValue()).to.equal(
102-
"Only 'in' values of 'path' is supported at the moment"
102+
"Only 'in' values of 'path' are supported at the moment"
103103
);
104104
});
105105
});

packages/fury-adapter-oas3-parser/test/pipeParseResult-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('#pipeParseResult', () => {
2121
expect(parseResult.toValue()).to.deep.equal([10]);
2222
});
2323

24-
it('streads multiple elements as arguments during pipe', () => {
24+
it('spreads multiple elements as arguments during pipe', () => {
2525
const duplicate = element => new minim.elements.ParseResult([element, element]);
2626
const multiply = (lhs, rhs) => lhs.toValue() * rhs.toValue();
2727
const parse = pipeParseResult(minim,

0 commit comments

Comments
 (0)