Closed c-pius closed 2 years ago
:tada: This issue has been resolved in version @stoplight/spectral-functions-v1.7.1 :tada:
The release is available on npm package (@latest dist-tag)
Your semantic-release bot :package::rocket:
Thanks a bunch @c-pius!
Describe the bug Validation using the
schema
function does not detect schema errors if the target is a$ref
reference.To Reproduce
$ref: "#/components/schemas/LightMeasured"
does not match the pattern^#\\/components\\/messages\\/
.Alternatively, add the following test to schema.test.ts and note that it fails (
result = []
).Expected behavior
Validation should return the error that the content of the
$ref
does not match the expected pattern.Screenshots The validation using
ajv
does detect the schema error as expected:The problem seems to be within
betterAjvErrors
. Concretely, in themakeTree
function thepath
is null as theJSON_POINTERS_REGEX
does not like the JSONPointer including the$
char. It may be a simple fix by adding$
to theJSON_POINTERS_REGEX
, but I cannot judge what side effects this would have.Environment (remove any that are not applicable):