-
Notifications
You must be signed in to change notification settings - Fork 8
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
Handle Nested Resource Validation Errors #189
Handle Nested Resource Validation Errors #189
Conversation
- Handle nested resource validation.
- Added change log file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parsing and reordering resource errors code is repeated 3 times and could be factored out.
We can also have errors in the dataset metadata that prevent updating resources, should that be handled as well?
Reckon so, and will tighten up the reusable code |
- Better handling of resource validation errors.
- Handle all dataset errors in resource actions.
@wardi okay I THINK this should be good now. So we have a method now which goes through all of the errors in the ValidationError exception and formats them into a new dict if needed. And then the rest is done in jinja templates now which is much better. I did originally just have the new I also found out that I needed to handle the Reorder Resource javascript stuff too, so there are some additions in there to handle that. EDIT: the |
ckanext-scheming stuff handle in: open-data/ckanext-canada#1556 If you want me to put this one upstream, I can also add the ckanext-scheming template stuff upstream |
This would be a great contribution upstream. Just needs some tests to cover how the errors returned from resource APIs have changed. |
Co-authored-by: Ian Ward <ian@excess.org>
Co-authored-by: Ian Ward <ian@excess.org>
- `dataset_errors` -> `resource_validation_errors` - Humanize labels. - Pass pkg_dict into resource confirm delete. - Pass pkg_dict into resource form. - Remove try/catch. - Do not store empty resource validation error dicts.
@wardi okay all that feedback has been done now |
- `h` -> `helpers` - Humanization fixes.
- `helpers` -> `h` - Humanization changes.
feat(dev): handle resource validation;
So we have come across this issue a couple times now, in which users come back to edit a super old dataset in which the schema has changed so much. And they try to add a new resource but some other resources fail validation. Because the resource create and update logic actions just get their own validation errors, and not other resource validation errors, this is what this PR tries to do. So if the current resource does not have any validation errors, it will go check the other ones from the ValidationError object, if it find them, it will make a new error_dict structure which is used in the Resource view functions to output the errors.