Skip to content
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

Handle type refs in _map_refs #166

Merged
merged 9 commits into from Sep 6, 2019

Conversation

@jacoblurye
Copy link
Collaborator

commented Sep 6, 2019

The _map_ref's update does two main things:

  • fixes the docs description bug for template schemas that use type_ref
  • fixes excel template file generation for template schemas that use type_ref (now validations and comments should appear)

Also, makes a little tweak to macros.j2 to handle consts in schemas.

@jacoblurye jacoblurye requested review from jim-bo, curlup and roshni-b Sep 6, 2019

@jacoblurye jacoblurye force-pushed the handle-type-refs branch from 9c5e98f to ca536a2 Sep 6, 2019

@jim-bo
jim-bo approved these changes Sep 6, 2019
Copy link
Contributor

left a comment

@jacoblurye No major comments, seems like an elegant solution.

One question is do we know have tests that would detect the reversion (at least for the template generation)?

@jacoblurye

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 6, 2019

@jim-bo we don't have tests for things like comments or validations appearing in Excel documents - I don't know of a way to automatically test that sort of thing, though.

jacoblurye added 2 commits Sep 6, 2019

# Plus concatenated new and old '$comment' fields
# which should be just ignored anyways.
if '$comment' in new_node or '$comment' in node:

This comment has been minimized.

Copy link
@curlup

curlup Sep 6, 2019

Contributor

As comments contain development related TODOs and stuff and we're now sending links to these docs to people, I think we should leave comments to ourselves and not add them in a visible manner to the docs.

This comment has been minimized.

Copy link
@curlup

curlup Sep 6, 2019

Contributor

nevermind

# Look for all refs in this mapping
for k, v in node.items():
node[k] = _map_refs(v, on_refs)
if isinstance(node, collections.abc.Mapping):

This comment has been minimized.

Copy link
@curlup

curlup Sep 6, 2019

Contributor

I'm not sure how this works, I though map_refs will be called whenever json schema walker walks into a node with '$ref'. So from that understanding it will not be called at all on some node : {"type_ref": "..."}

This comment has been minimized.

Copy link
@jacoblurye

jacoblurye Sep 6, 2019

Author Collaborator

I think _map_refs is the json schema walker you're referring to? On the next line, we look for $refs and type_refs, then handle each case slightly differently. The test test_json_validation.test_map_refs might be a bit helpful, too.

This comment has been minimized.

Copy link
@curlup

curlup Sep 6, 2019

Contributor

never mind

@jacoblurye jacoblurye merged commit c99141b into master Sep 6, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jacoblurye jacoblurye deleted the handle-type-refs branch Sep 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.