Hi, this is my first issue here :grin: . I've came across of what I believe it is a bug on the JSONSchemaBridge. To be more precise, a bug on the pathToName method.
As we can see on this piece of code on the last line, it performs a slice(1). This slice makes this method return a wrong string if you have a property that contains whitespace on the top level of your schema.
A property with whitespace is represented as "['My Property']" and a common property is ".myProperty".
Version: any (since the creation of this file)
An example of a schema that doesn't work correctly:
{
type: "object",
properties: {
"My Property": {
required: ["someValue"],
type: "object",
properties: {
someValue: {
type: "number"
}
}
}
}
}
The someValue property will not be validated correctly because pathToName will return "'My Property']" instead of "My Property" (I'm not sure if this should be the correct return, but it is what my tests suggest).
Hi @ljmotta, thanks for the report! It looks like you are using the old format of ajv errors. Since v7 the default one is jsonPointers: true (to enable the old style in v7 use jsPropertySyntax: true). Here's a playground presenting this problem. Anyway, I agree we have to fix that.
@radekmie Thanks for addressing this issue so quickly! Yes I'm using an old format of ajv. My setup is ajv v6 (and ajv errors v1 due to compatibility) beucase my schema is draft4.