-
Notifications
You must be signed in to change notification settings - Fork 11
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
Correct reporting of oneOf (anyOf, allOf) errors #895
Comments
@duncandewhurst this is the issue you were looking for |
Looking at this example my understanding is that when validating a record, any errors found in the How much work would it be to get individual reports of errors in the embedded releases? I think that would make the most sense for users |
@robredpath mentioned having a solution from another standard (BODS, I think). |
@robredpath Was this completed as part of the April sprint? (The sprint doc hadn't been updated to document the outputs.) |
@jpmckinney oops, sorry - I've updated the doc now. This wasn't done as part of the April sprint. |
I came across another variant of this issue today when validating a record package from Uganda, the path to the error was
There is also something weird going on because |
Yes, we can do this in a few days. It's what we did for BODS, see these screenshots for an example. We replace the The reason we have to do this on a case by case basis, rather than improving the generic For BODS we can tell which subschema is meant because they each have a different In the OCDS case we need to tell whether you intended Linked releases or Embedded releases. The easiest way to do this is to look for the Additionally, for BODS a single statement is nested within the
This is a different case, so won't be affected by the above work. It is easy to just remove the large block. I suggest creating a new issue for doing any more than this.
This is because the jsonschema library displays the Python representation of the data, rather than the JSON representation. (Whereas in our custom code for oneOf we use the JSON representation). |
Thanks, @Bjwebb
Presumably this only works if the error the user has made isn't to do with that field? This certainly sounds sufficient for a dramatic improvement over current behaviour, but am I right in thinking this algorithm could be a good candidate for future improvement to be smarter at detecting what the user was trying to do? Also - I'd like to document the very helpful rationale here - "we are assuming that this is a Linked Release becuase the url field is only found in Linked Releases" - both in the code and the interface. I've created #1220 for the 'giant block of JSON' issue. Presumably when we stop sending large blocks of JSON to the user we'll also stop sending representations of the Python objects that contain them? |
That's right. Separately, me and @duncandewhurst discussed that it's better to look for
I agree. The interface could be a bit fiddly, but its worth doing.
Yes, we'll stop showing the Python representations. Note that they could appear again for different error messages, if we start using certain json schema features (e.g. anyOf instead of oneOf). |
Make an educated guess at the correct subschema, and use the validation messages from that.
I've updated the validation error messages. I still need to add a note to the web UI about our assumptions. PR: OpenDataServices/lib-cove#31 |
What specific changes to the results should I be looking for?
Please use sentence case and spaces between 'Linkedreleases'. I think it'd be helpful to link to documentation, rather than to describe that one has |
Instead of "valid under any of the given schemas" (current behaviour) there are now more specific validation messages from one of the subschemas. |
Aha! It's much better! |
I've added text about assumptions of linked/embedded releases to the web UI: [demo] Currently these appear for every relevant validation error message, because that was the easiest thing to do. Does this need changing before this work is merged? |
Please create an issue to remove this repetition at a later date. If there are very many errors, the texts about the assumptions will be very repetitive. In that case, it might be preferable to group the errors by assumption/subschema. However, this is already an improvement, so can be deployed as-is. Please create an issue about grouping errors by subschema, so that the texts about the assumptions are not repeated. |
New issues: |
[OpenDataServices/cove#895] Better oneOf validation messages for records
[#895] Better oneOf validation messages for records
This was deployed to live couple of weeks ago. |
This issue still seems to be present with Zambia's data: https://standard.open-contracting.org/review/data/d7b728ba-e43b-462e-9cac-6e24e5b12325 To reproduce, download the July 2019 record package from ZPPA's download page and submit it to CoVE. |
Looks as I'd expect. Could you check again and screenshot the problem? |
Hmm on clicking the link above it seems to be resolved, but on uploading the file afresh the issue reappears: Zambia's portal seems to be down at the moment, so I uploaded the file here |
I've identified the source of the problem here, which is my code doesn't work properly with 1.0. This is because it looks for the Today I've fixed a bug with arrays being falsely flagged as non-unique #1246. There's now no validation errors with that Zambia file, including none to do with oneOfs. The underlying problem is still there though, and can be reproduced by changing the version in any of the fixtures. |
The lib-cove commits haven't made their way into a release yet, so not into CoVE. |
The updated lib-cove is now live on https://standard.open-contracting.org/review/ |
e.g. http://standard.open-contracting.org/validator/data/efa21228-0d98-4080-8c4f-ab63db58e1f6
"[very long JSON] is not valid under any of the given schemas"
The hundreds of rows of
oneOf
errors should be collected into a single error, not presented as distinct errors.If that's not possible, then if we can collapse the long JSON (e.g. show a snippet and require the user to click on something to see the full JSON), it will make reviewing errors easier.
The text was updated successfully, but these errors were encountered: