-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested errors with JSON Schema #593
Comments
Hi @adrianschneider94. Yes, ajv actually uses Playground example. If you type {
"details": [
{
"keyword": "pattern",
"dataPath": ".a.b.c",
"schemaPath": "#/properties/a/properties/b/properties/c/pattern",
"params": { "pattern": "[0-9]{5}" },
"message": "should match pattern \"[0-9]{5}\""
}
]
} How have you encountered this problem? I'm not sure about custom keywords and other advanced (in a way) features, but in all of our cases it worked as it is. |
Yes I've had this problem. The issue only applies to arrays. However, I was wrong with the root of the problem. I switched to Without [
{
keyword: "const",
dataPath: ".doesWork.testString",
schemaPath: "#/properties/doesWork/properties/testString/const",
params: {allowedValue: "test"},
message: "should be equal to constant"
},
{
keyword: "const",
dataPath: ".test[0].doesNotWork", // uniforms would need ".test.0.doesNotWork", right?
schemaPath: "#/properties/test/items/properties/doesNotWork/const",
params: {allowedValue: "test"}
}
] |
Yep, brackets in the |
I encountered this same issue and solved it by doing a string replace of the square brackets in the master...kyleder:kd-fix-nested-inline-errors I'm not sure if that's the best approach to fixing the issue, but it seems to solve it for my case. |
Hi,
inline errors for nested schemas don't work with JSON Schema. At least not like shown in the docs.
getError(name, error)
compares the paths, but the path ajv returns has/
as delimiter whilst uniforms uses.
.You can make it work by transforming the ajv errors:
However, I think it would be better to change the JSONSchemaBridge accordingly.
Kind regards and thanks for your work!
The text was updated successfully, but these errors were encountered: