Sometimes, traverse accidentally traverses a non-schema object, e.g. instead traversing the properties object of a schema.
This then causes validation errors if one of these properties is "invalid" (e.g. you have a key called deprecated).
Using traverse instead of traverseObjectKeys seems to fix this, since then we don't traverse on objects that contain BLACKLISTED_KEYS.
For an example, see the test case I added. On the current master branch, shows the following error:
[
'Error at key "properties" in file "deprecated": deprecated must be a boolean'
]
For a real world use-case, I was trying to use the OpenAPI 3.1 JSON Schema in my app and I got this validation error.
[^1]: Unfortunately, even after fixing this bug, it looks like OpenAPI 3.1's JSON Schema uses some new features in JSON Schema that the @apidevtools/json-schema-ref-parser library does not yet support: https://github.com/APIDevTools/json-schema-ref-parser/issues/145
Sometimes,
traverse
accidentally traverses a non-schema object, e.g. instead traversing theproperties
object of a schema.This then causes validation errors if one of these properties is "invalid" (e.g. you have a key called
deprecated
).Using
traverse
instead oftraverseObjectKeys
seems to fix this, since then we don't traverse on objects that containBLACKLISTED_KEYS
.For an example, see the test case I added. On the current
master
branch, shows the following error:For a real world use-case, I was trying to use the OpenAPI 3.1 JSON Schema in my app and I got this validation error.
[^1]: Unfortunately, even after fixing this bug, it looks like OpenAPI 3.1's JSON Schema uses some new features in JSON Schema that the
@apidevtools/json-schema-ref-parser
library does not yet support: https://github.com/APIDevTools/json-schema-ref-parser/issues/145