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 non object body parameters #68

Merged
merged 2 commits into from
Sep 28, 2015
Merged

Handle non object body parameters #68

merged 2 commits into from
Sep 28, 2015

Conversation

jmcs
Copy link
Contributor

@jmcs jmcs commented Sep 28, 2015

Fix for #66.

@hjacobs
Copy link
Contributor

hjacobs commented Sep 28, 2015

There can be at most one body parameter according to the Swagger spec (http://swagger.io/specification/). I think getting the value from the body parsed as dict is wrong.

There can be one "body" parameter at most.

for key, value in body_parameters.items():
if key not in arguments:
logger.debug("Body parameter '%s' not in function arguments", key)
if isinstance(body_parameters, dict):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think getting the value from the body parsed as dict is wrong. 'There can be one "body" parameter at most.' the Swagger spec says.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When connexion receives a request with type object body_parameters is a dict and I was getting the keys from inside that object and passing them to the function as arguments. Do you think it would be better to provide the body as a single argument in this case?

@hjacobs
Copy link
Contributor

hjacobs commented Sep 28, 2015

Looks better 👍

jmcs added a commit that referenced this pull request Sep 28, 2015
Handle non object body parameters
@jmcs jmcs merged commit 5fa7642 into master Sep 28, 2015
@jmcs jmcs removed the in progress label Sep 28, 2015
@jmcs jmcs deleted the issue66-body-list branch October 2, 2015 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants