Skip to content

Commit

Permalink
chore(functions): extra comment on schema fn missing ref error logic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
padamstx authored and P0lip committed Apr 25, 2023
1 parent 92dab78 commit 0702287
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/functions/src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export default createRulesetFunction<unknown, Options>(
// let's ignore any $ref errors if schema fn is provided with already resolved content,
// if our resolver fails to resolve them,
// ajv is unlikely to do it either, since it won't have access to the whole document, but a small portion of it
if (!rule.resolved || !(ex instanceof MissingRefError)) {
// We specifically check that "rule" is truthy below because "rule" might be undefined/null if this
// code is called from testcases.
const ignoreError = rule?.resolved && ex instanceof MissingRefError;
if (!ignoreError) {
results.push({
message: ex.message,
path,
Expand Down

0 comments on commit 0702287

Please sign in to comment.