-
Notifications
You must be signed in to change notification settings - Fork 3.2k
REST API: Support the anyOf and oneOf JSON Schema keywords. #555
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
Conversation
|
Thanks for working on this @yakimun! We don't usually, but in this case since the error strings are so important, can we add the actual error message to the assertions? |
|
We'll also need to add support to I've also left some inline feedback, let me know if anything is unclear. Thanks again for working on this! |
|
Thanks for the review! I'm not sure what to do with For In @TimothyBJacobs, what do you think about it? |
That's another thing we need to adjust. It should be allowed to use What we need to be able to do is figure out the schema used for validation, and then use it for sanitization. If there isn't a schema that matches we need to do the same procedure to get a
The idea for this is similar, find the If none apply, we can skip trying to filter that property. For The JSON Schema Test Suite might also be helpful: https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/master/tests/draft4/anyOf.json Something to keep in mind is that the JSON Schema spec doesn't require that a |
|
@TimothyBJacobs, I've fixed the issues you noticed and improved the tests. Please let me know if I missed something. Thanks! |
|
Thanks for your continued work on this @yakimun! I've left some more feedback. I'm going to take a deeper look at the tests later too. |
|
Thanks for your comments, @TimothyBJacobs! Just to be clear: everything previously mentioned has been fixed. |
This is technically not as accurate, but I think the tradeoff for making the message more friendly for users it worth it.
|
Fixed in 54aa0bc. Thanks again for your hard work on this @yakimun! |
Added support for the anyOf and oneOf JSON Schema keywords.
Trac ticket: https://core.trac.wordpress.org/ticket/51025