-
Notifications
You must be signed in to change notification settings - Fork 100
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
feature: Added Cerberus as a new option for item validation #201
Conversation
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
* Cerberus Validator : Validate Only Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Implement Translator Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Changes implemented as suggested Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Change location for validator tests Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Changes Implemented as suggested, also code formatted Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Changes implemented as suggested Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Ported to PyTest Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Changes implemented as suggested Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]> * Remove extra lines
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Implement Translator
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
* Add documentation for Expression Monitors Co-Authored-By: Adrián Chaves <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
) | ||
else: | ||
schema = load_object(source) | ||
if isinstance(schema, six.string_types): |
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 documentation does not mention either that the schema may be specified as a string.
I wonder if we should remove support for this, and instead allow paths to JSON files regardless of their file extension, just as we don’t require a file extension or Content-Type header when using a URL.
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.
From my perspective, I feel like adding raw schemas directly to the settings.py
file as strings for validation is something users wouldn't feel like doing. Also, only my code (Cerberus Validation) has tests and docs for adding raw schemas because I thought that it would be a good feature to work with.
Bit of context behind this change:
The code is from the original file is /jsonschema/tools.py
, and it was moved, tweaked, and was made available for both Cerberus and JSONSchema to use. Hence, these lines are from the original file only.
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.
@rennerocha What are your thoughts on this?
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.
@rennerocha How should we proceed?
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.
@rennerocha pinging again. 😅
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.
@rennerocha Pinging again 🙈
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
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.
Hi @rennerocha, we need your comments in some reviews 😅, have you checked them out yet.
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
We will not add a new item validation library as built-in in Spidermon now, so we will close this PR. If needed, it can be created as a separated package. |
🐣
This brings an end to a great and fulfilling period of contributing to Spidermon and the Scrapy Project as part of Google Summer of Code 2019.
Google Summer of Code 2019 with The Scrapy Project
Project - Integrate Cerberus, solves #182,
Project Description- Google Archive
Co-Org Admin - Cathal
Mentors - @rennerocha , @ejulio
Personal GSoC Blog - Mixster x GSoC
PSF Blog - https://blogs.python-gsoc.org/en/blogs/vipulgupta2048s-blog/
Description
Deliverables & Work Done
This Pull Request Includes:
For system testing, one could go ahead and use the pre-configured Quotes spider https://github.com/vipulgupta2048/testing_quotes and installing Spidermon from the master branch of my fork.
Looking forward to improving the source code even further, through all your valued opinions, reviews, and comments. Would love to clarify and help understand the work done.