Closed normanjaeckel closed 8 years ago
Shouldn't be too hard to add; since this is metadata though, I'm thinking there should be an option in schema.validate
to either use this or not. Perhaps something like the following?
def validate(..., use_default=False):
....
or do you think it should be enabled by default? Let me know your thoughts, and thanks for the suggestion. :)
I think an option is not necessary because if someone sets a default value in the schema he normally want to add this to the validated data. Maybe only as opt-out. But for my issues an opt-in option would also be ok.
That's a fair point. I think use_default=True
is a good compromise then.
Hey guys, I worked with tornado-json and I saw that some ideas I had to improve the project other people have too (Issues list) so I decided to give some contribution:
Check this out https://github.com/hfaran/Tornado-JSON/pull/86
Thanks @mauler, taking a look for you.
It would be nice if the package could add default values for missing properties to the body if mentioned in the schema. Untested Example:
Of cause I can do something like
self.body.get('foo', 42)
but that's not that awesome for large projects.By the way: Thanks for this nice package.