added schema extension fixes#227
Merged
tusharmakkar08 merged 1 commit intoalecthomas:masterfrom Oct 4, 2016
Merged
Conversation
Author
|
i usually just to develop in 2.7, didn't think about it, sorry about that. |
tusharmakkar08
requested changes
Oct 4, 2016
Collaborator
tusharmakkar08
left a comment
There was a problem hiding this comment.
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: |
Collaborator
There was a problem hiding this comment.
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 |
| else: | ||
| result[key] = value | ||
|
|
||
| # recomplie and send old object |
| extension = {Required('a'): int} | ||
| extended = base.extend(extension) | ||
|
|
||
| assert len(base.schema) == 1 |
Collaborator
There was a problem hiding this comment.
Better use assert_equal instead of normal assert
Collaborator
tusharmakkar08
approved these changes
Oct 4, 2016
Collaborator
|
Hey @mprager Please squash in your commits. Let's get this merged into master then 🍰 Thanks |
c60aa14 to
1998aaa
Compare
This was referenced Apr 12, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added functionality to detect
Markertype 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.