Skip to content
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

Change format of content of _validation field #425

Closed
rennerocha opened this issue Oct 25, 2023 · 1 comment
Closed

Change format of content of _validation field #425

rennerocha opened this issue Oct 25, 2023 · 1 comment

Comments

@rennerocha
Copy link
Collaborator

If a validation error is found and SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS setting is True, we populate the _validation field with the errors.

The content of this field is the string representation of a Python defaultdict such as:
'_validation': defaultdict(<class 'list'>, {'author_url': ['Invalid URL']})

To make this field valid as JSON, we should have it as a list of objects such as:
'_validation': [ {'author_url': ['Invalid URL'] }]

This change will improve the data returned, making it possible to be read as a JSON.

rochamatcomp added a commit to rochamatcomp/spidermon that referenced this issue Feb 8, 2024
The content of _validation field must to be the string representation of a Python dict instead defaultdict when SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS setting is True.
rochamatcomp added a commit to rochamatcomp/spidermon that referenced this issue Feb 8, 2024
The content of _validation field must to be the string representation of a Python dict instead defaultdict when SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS setting is True.
@rochamatcomp
Copy link
Contributor

Can I take this issue? I have created this pull request #431.

rochamatcomp added a commit to rochamatcomp/spidermon that referenced this issue Feb 16, 2024
The content of _validation field must to be the string representation of a Python dict instead defaultdict when SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS setting is True.
VMRuiz pushed a commit that referenced this issue Mar 7, 2024
The content of _validation field must to be the string representation of a Python dict instead defaultdict when SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS setting is True.
@VMRuiz VMRuiz closed this as completed Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants