Skip to content

Commit f9a8a75

Browse files
fix: logic in ternary operator
1 parent 53647f6 commit f9a8a75

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/src/rules/ajv.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ export function validateJsonSchema(
100100
specVersion: string = 'oas3_1'
101101
): { valid: boolean; errors: (ErrorObject & { suggest?: string[] })[] } {
102102
const validate =
103-
specVersion === 'oas3_1'
104-
? getAjvValidator(schema, schemaLoc, resolve, allowAdditionalProperties)
105-
: getAjvDraft04Validator(schema, schemaLoc, resolve);
103+
specVersion === 'oas3_0' || specVersion === 'oas2'
104+
? getAjvDraft04Validator(schema, schemaLoc, resolve)
105+
: getAjvValidator(schema, schemaLoc, resolve, allowAdditionalProperties);
106+
106107
if (!validate) return { valid: true, errors: [] }; // unresolved refs are reported
107108

108109
const valid = validate(data, {

0 commit comments

Comments
 (0)