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

Commit d566e23

Browse files
opichalskylef
authored andcommitted
fix(oas3): use both where appropriate
1 parent 264fefb commit d566e23

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function parseOauthFlowsObject(context, object) {
4444

4545
const parse = pipeParseResult(namespace,
4646
R.compose(parseOauthFlowObject(context), getValue),
47-
R.when(R.allPass([R.complement(hasAuthorizationUrl), needAuthorizationUrl]), () => createWarning(namespace,
47+
R.when(R.both(R.complement(hasAuthorizationUrl), needAuthorizationUrl), () => createWarning(namespace,
4848
`'${name}' '${key}' is missing required property 'authorizationUrl'`, member)),
49-
R.when(R.allPass([R.complement(hasTokenUrl), needTokenUrl]), () => createWarning(namespace,
49+
R.when(R.both(R.complement(hasTokenUrl), needTokenUrl), () => createWarning(namespace,
5050
`'${name}' '${key}' is missing required property 'tokenUrl'`, member)));
5151

5252
return parse(member);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const unsupportedKeys = [
2727
];
2828
const isUnsupportedKey = R.anyPass(R.map(hasKey, unsupportedKeys));
2929

30-
const isRequestBody = R.allPass([isMember, hasKey('requestBody')]);
30+
const isRequestBody = R.both(isMember, hasKey('requestBody'));
3131

3232
function createTransactions(namespace, member, operation) {
3333
const requests = R.map(getValue, R.filter(isRequestBody, operation.content));

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ function validateRequiredForPathParameter(context, object, parameter) {
6060
return parseResult;
6161
}
6262

63-
const hasExplodeWithoutQueryIn = R.allPass([
63+
const hasExplodeWithoutQueryIn = R.both(
6464
object => object.getValue('explode') === true,
65-
object => object.getValue('in') !== 'query',
66-
]);
65+
object => object.getValue('in') !== 'query'
66+
);
6767

6868
/**
6969
* Parse Parameter Object

packages/openapi3-parser/lib/parser/parseObject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const chainParseResult = R.curry((transform, parseResult) => {
3838

3939
// FIXME Can be simplified once https://github.com/refractproject/minim/issues/201 is completed
4040
const hasMember = R.curry((object, key) => {
41-
const findKey = R.allPass([isMember, member => member.key.toValue() === key]);
41+
const findKey = R.both(isMember, member => member.key.toValue() === key);
4242
const matchingMembers = object.content.filter(findKey);
4343
return matchingMembers.length > 0;
4444
});
@@ -153,7 +153,7 @@ function parseObject(context, name, parseMember, requiredKeys = [], orderedKeys
153153
let errors = null;
154154

155155
orderedKeys.forEach((key) => {
156-
const isOrderedKey = R.allPass([isMember, m => m.key.equals(key)]);
156+
const isOrderedKey = R.both(isMember, m => m.key.equals(key));
157157
const member = R.filter(isOrderedKey, value).get(0);
158158
if (member) {
159159
const parseResult = parseMember(member);

packages/openapi3-parser/lib/pipeParseResult.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const hasValue = parseResult => !R.reject(isAnnotation, parseResult).isEmpty;
2222
* @param parseResult {ParseResult}
2323
* @returns boolean
2424
*/
25-
const hasNoErrorsAndHasValue = R.allPass([hasNoErrors, hasValue]);
25+
const hasNoErrorsAndHasValue = R.both(hasNoErrors, hasValue);
2626

2727
/**
2828
* Concatate the lhs and rhs array into a parse result

0 commit comments

Comments
 (0)