Open JonathanMonroeU opened 2 months ago
So I think the issue is that the definition needs to be defined with the decoded version like so:
definitions: {
'Some<loremipsum3E': {
additionalProperties: {
type: 'string',
},
type: 'object'
}
},
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.
Does that make sense?
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.