-
Notifications
You must be signed in to change notification settings - Fork 218
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
added schema extension fixes #227
Conversation
i usually just to develop in 2.7, didn't think about it, sorry about that. |
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.
Hey @mprager
I have reviewed the PR. There are minor changes which are required before the merge. Please work on them and squash the commits.
Thanks
# build a map that takes the key literals to the needed objects | ||
# literal -> Required|Optional|literal | ||
result_key_map = dict() | ||
for key in result: |
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.
Use dict_comprehension here.
result_value = result[result_key] | ||
|
||
# if both are dictionaries, we need to extend recursively | ||
# create the new extended sub schema, then remote the old key and add the new one |
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.
*remove
else: | ||
result[key] = value | ||
|
||
# recomplie and send old object |
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.
*recompile
extension = {Required('a'): int} | ||
extended = base.extend(extension) | ||
|
||
assert len(base.schema) == 1 |
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.
Better use assert_equal
instead of normal assert
Hey @mprager Please squash in your commits. Let's get this merged into master then 🍰 Thanks |
c60aa14
to
1998aaa
Compare
added functionality to detect
Marker
type keys in schemas and replace them with updated markers or no markers at all. The extension functionality also checks for recursive subschema extensions and adds and alters only the necessary keys.Appropriate tests were added as well.