You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Ajv are you using? Does the issue happen if you use the latest version? I'm using the latest version.
I'm getting "can't resolve reference" error when having a schema with a definition property using a uri-encoding like '%3C' or '%22'. I started seeing this while using a schema with the fields oneOf, allOf or anyOf inside the definition.
The following code, based on a template provided in this repo, was used to debug the error.
Validation result, data AFTER validation, error messages
MissingRefError: can't resolve reference #/definitions/Some%3Cloremipsum3E from id #
at Object.code (./node_modules/ajv/dist/vocabularies/core/ref.js:43:19)
at keywordCode (./node_modules/ajv/dist/compile/validate/index.js:480:13)
at ./node_modules/ajv/dist/compile/validate/index.js:193:25
at CodeGen.code (./node_modules/ajv/dist/compile/codegen/index.js:440:13)
at CodeGen.block (./node_modules/ajv/dist/compile/codegen/index.js:570:18)
at schemaKeywords (./node_modules/ajv/dist/compile/validate/index.js:193:13)
at typeAndKeywords (./node_modules/ajv/dist/compile/validate/index.js:131:16)
at subSchemaObjCode (./node_modules/ajv/dist/compile/validate/index.js:117:5)
at subschemaCode (./node_modules/ajv/dist/compile/validate/index.js:92:13)
at KeywordCxt.subschema (./node_modules/ajv/dist/compile/validate/index.js:448:9) {
missingRef: '#/definitions/Some%3Cloremipsum3E',
missingSchema: ''
}
The error is thrown in the line if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref).
The strucutre up to "it" seems to be as it should, but the props passed to derived from it "resolveRef.call" seem to be missing definitions, turning schOrEnv to undefined and leading to the error.
The worked for me with your example. The reason is because the when we use fast-uri to resolve the uri in the ref, it does that conversion, so it's not looking for the encoded version, but the def how it should be.
The reason is because the when we use fast-uri to resolve the uri in the ref, it does that conversion, so it's not looking for the encoded version, but the def how it should be.
Yeah, it does make sense. But what if I'm doing the encoding precisely to avoid these symbols to go on the definitions and ref string and possibly cause any issues? I'm replacing " with %22 and ' with %27, for example.
What version of Ajv are you using? Does the issue happen if you use the latest version? I'm using the latest version.
I'm getting "can't resolve reference" error when having a schema with a definition property using a uri-encoding like '%3C' or '%22'. I started seeing this while using a schema with the fields oneOf, allOf or anyOf inside the definition.
The following code, based on a template provided in this repo, was used to debug the error.
Validation result, data AFTER validation, error messages
The error is thrown in the line
if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref)
.The strucutre up to "it" seems to be as it should, but the props passed to derived from it "resolveRef.call" seem to be missing definitions, turning schOrEnv to undefined and leading to the error.
The text was updated successfully, but these errors were encountered: