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

Fix reference parameter/response with MarshmallowPlugin #414

merged 2 commits into from Apr 2, 2019


Copy link

commented Mar 29, 2019

MarshmallowPlugin doesn't play well with parameter references because it assumes a parameter is a dict, which is not the case when passing a reference by name (the plugin works before clean_operations transforms the name into a full reference dict: {"$ref": name}), and it tries a get on the string.

This PR fixes this.

It also addresses a similar issue with responses. There was no error in this case because the resolve function does not use get but only in, which doesn't crash because the string is iterable, but I figured this was luck and it would be better to eliminate dict instances first.

def test_parameter_reference(self, spec_fixture):
if spec_fixture.spec.openapi_version.major < 3:
param = {"schema": PetSchema}
reference = '#/parameters/Pet'

This comment has been minimized.

Copy link

lafrech Mar 29, 2019

Author Member

Note: I'd like to extend tests.utils.ref_path to parameter, responses and all kinds of components (#408 (comment)). This can be done later.

@lafrech lafrech force-pushed the fix_resolve_parameters_resolve_schema branch 2 times, most recently from 53ed56f to 182f3f1 Apr 1, 2019

@lafrech lafrech added the bug label Apr 1, 2019

@lafrech lafrech force-pushed the fix_resolve_parameters_resolve_schema branch from 182f3f1 to 95d92a9 Apr 2, 2019

@lafrech lafrech merged commit f4c75ba into dev Apr 2, 2019

2 checks passed

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

@lafrech lafrech deleted the fix_resolve_parameters_resolve_schema branch Apr 2, 2019

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