Adding the ability to set a 'required' boolean kwarg in the Object.add_object method#60
Adding the ability to set a 'required' boolean kwarg in the Object.add_object method#60sj-curtin wants to merge 1 commit intowolverdude:masterfrom
Conversation
kwarg in the Object.add_object method - Doing so will avoid the `required` keyword for an object in the schema to be included - Added test cases - Updated docs
|
Thanks for the PR! Sorry for the slow response here. This looks really useful, but I'm still hesitant to approve because it doesn't really fit well with the existing philosophy of how GenSON works and there are a couple of edge-cases that need to be explored. I think I would like to understand more about your use-case. I can see two possibilities here, and there are alternative approaches for each that are more consistent with GenSON's design:
I'm not sure I answered everything. Please let me know any further thoughts or context. I do have one more thought here: I notice that you added a |
requiredkeyword for an object inthe schema to be included
Added GenSON to a recent project and found it very useful - thank you 🙌
Use case:
"If JSON is validated against a schema produced and it is missing an object key, it should still be deemed valid"
Our solution was a little overwrite of the add_object method for Objects - however we also toyed with this approach - what are your thoughts?
Our change:
Default: