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

Query and Path Parameter Validation #48

Closed
hjacobs opened this issue Aug 13, 2015 · 13 comments
Closed

Query and Path Parameter Validation #48

hjacobs opened this issue Aug 13, 2015 · 13 comments

Comments

@hjacobs
Copy link
Contributor

hjacobs commented Aug 13, 2015

Only "body" parameters are validated right now, we need to validate other parameters ("path", "query") too.

@hjacobs
Copy link
Contributor Author

hjacobs commented Aug 27, 2015

Basic query parameter validation is now part of Connexion 0.9.1, I will add basic path parameter validation next.

@cansik
Copy link
Contributor

cansik commented Aug 27, 2015

👍

@hjacobs
Copy link
Contributor Author

hjacobs commented Aug 27, 2015

Path and header parameters are now also validated in Connexion 0.9.2.
Note that some less common Swagger validation rules are not yet implemented.

@saemideluxe
Copy link

👍

@saemideluxe
Copy link

I get the following exception on all path parameters even though the swagger editor tells me, that my file is correct. But as far as I tested, I am able to use all the routes without any further exceptions. Do you know what the problem could be here?

ERROR:connexion.api:Failed to add operation for PARAMETERS /containers/<id>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/connexion/api.py", line 131, in add_paths
    self.add_operation(method, path, endpoint)
  File "/usr/local/lib/python2.7/dist-packages/connexion/api.py", line 112, in add_operation
    parameter_definitions=self.parameter_definitions)
  File "/usr/local/lib/python2.7/dist-packages/connexion/operation.py", line 72, in __init__
    self.operation_id = operation['operationId']
TypeError: list indices must be integers, not str

@hjacobs
Copy link
Contributor Author

hjacobs commented Sep 16, 2015

@samuelvonstachelski can you paste your swagger.yaml here?

@hjacobs
Copy link
Contributor Author

hjacobs commented Sep 16, 2015

It looks like your operation is not a map, but a list (this would not conform with Swagger spec).

@saemideluxe
Copy link

The yaml formatting gets lost if I paste it, here is the link to the file:
https://dev.flarecast.eu/stash/projects/INFRA/repos/pipeline/browse/pipeline/swagger.yaml?raw

@hjacobs
Copy link
Contributor Author

hjacobs commented Sep 17, 2015

Your Swagger YAML is wrong in line 65: https://dev.flarecast.eu/stash/projects/INFRA/repos/pipeline/browse/pipeline/swagger.yaml#65

The "parameters" key is on the same level as the HTTP verbs.

@saemideluxe
Copy link

Swagger specs 2.0 says this is ok:
http://swagger.io/specification/#pathItemObject

@hjacobs
Copy link
Contributor Author

hjacobs commented Sep 17, 2015

Oh, true, i.e. we have missing support in Connexion for that right now.

@saemideluxe
Copy link

Okay, no problem. I am going update our swagger file. This is anyway just a "shortcut"-feature, explicit description for each http verb may be better...
Btw: In earlier versions it worked, but I suppose the path-validation which you introduced shortly broke this.

@rafaelcaricio
Copy link
Collaborator

This is now supported after #152 got merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants