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

add changes so I can use reqparse and parameters at the same time #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Menda0
Copy link

@Menda0 Menda0 commented Jul 24, 2018

I was having a problem generating parameters using reqparse parser. Sometimes I had a path parameters in my resources and I still want to use the request parser functionality. For that I used the parameters and rerparser properties in @swagger.doc like this:

"reqparser": {
    "name": "User signup info",
    "parser": postreqparse
},
"parameters": [
    {
        "description": "User email",
        "in": "path",
        "name": "email",
        "type": "string",
        "required": True
    }
]

that provoke the following exception 'parameters and reqparser can't be in same spec'.

if 'parameters' in operation:
  raise ValidationError('parameters and reqparser can\'t be in same spec')

For that to work for me I wanted both the method to work together, like a concatenation of parameters and reqparser so the output should be like this

"parameters": [
    {
        "description": "User email",
        "in": "path",
        "name": "email",
        "required": true,
        "type": "string"
    },
    {
        "description": "Request body",
        "in": "body",
        "name": "body",
        "required": true,
        "schema": {
            "$ref": "#/definitions/User signup info"
        }
    }
]

I fix this problem on this commit concatenating the result of reqparse parser and parameters and it worked as expected.
I think that could be useful for someone like that was for me. So thats the reason of this pull request.

Hope I helped,
Thanks for this awesome worked,

Cheers,
Marco Mendão

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

1 participant