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

body parameter isn't loaded when using parameter ref #119

Closed
msarmstr opened this issue Apr 15, 2017 · 2 comments
Closed

body parameter isn't loaded when using parameter ref #119

msarmstr opened this issue Apr 15, 2017 · 2 comments
Milestone

Comments

@msarmstr
Copy link

msarmstr commented Apr 15, 2017

Hi, I'm having an issue with using a ref for a body parameter.

parameters:
  PetParam:
    in: body
    name: body
    required: true
    schema:
      $ref: '#/definitions/Pet'
paths: 
  /pet: 
    post:
      operationId: addPet
      parameters:
        - $ref: '#/parameters/PetParam'

When a request is made with the addPet operation above, the payload is empty.

Seems to be that pyswagger.io.Request._prepare_body isn't derefing the body parameter, so getattr(parameter, 'in') returns None.

By the way, this is a great tool. Thanks!

@mission-liao mission-liao added this to the v0.8.28 milestone Apr 15, 2017
@mission-liao
Copy link
Member

mission-liao commented Apr 15, 2017

Hi, I think the problem in the sample spec you provide is because the Parameter Object is actually a "Reference Object" and pyswagger didn't deref it (i.e. use parameter.final instead of using it directly), I'll add a test case later and see if my guess is correct.

========
OK, I misunderstand what you described, it's exactly what's going wrong.

mission-liao added a commit that referenced this issue Apr 15, 2017
- #119
- I didn’t use the merged Parameter instance, thus the referenced one
is not used to check for “in” == “body”
mission-liao added a commit that referenced this issue Apr 15, 2017
[fix]
missing body parameter when referenced from “parameters” field
- #116
- #119

special characters in path parameters not handled correctly
- #117

query parameter doesn't pass to Webapp2's client
- #114
@mission-liao
Copy link
Member

the fix should be included in latest build: v0.8.28.

mission-liao added a commit to pyopenapi/pyopenapi that referenced this issue Aug 12, 2017
- pyopenapi/pyswagger#119
- I didn’t use the merged Parameter instance, thus the referenced one
is not used to check for “in” == “body”
mission-liao added a commit to pyopenapi/pyopenapi that referenced this issue Aug 12, 2017
[fix]
missing body parameter when referenced from “parameters” field
- pyopenapi/pyswagger#116
- pyopenapi/pyswagger#119

special characters in path parameters not handled correctly
- pyopenapi/pyswagger#117

query parameter doesn't pass to Webapp2's client
- pyopenapi/pyswagger#114
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

No branches or pull requests

2 participants