-
Notifications
You must be signed in to change notification settings - Fork 73
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
Schema for path-arguments duplicates input #220
Comments
Use of Schema for path parameters is poorly documented. See this conversation: #219. Better doc would certainly not hurt. Thinking out loud, perhaps we could catch the parameter injected by Flask from |
I'm thinking about how this could be done, either in flask-smorest or in webargs. We could check Another option is for I'm not sure if these are good ideas vs. docs and maybe a warning about path params specifically. Fancy special-case behaviors might be harder to understand or document. |
Ran into another issue relating to this. In the generated OpenAPI specification the path parameter is documented on the path object but it seems like the OpenAPI standard expects it to be documented on the method(s): https://swagger.io/docs/specification/describing-parameters/#path-parameters I can create the desired output for the method by adding an argument schema with |
@hellbe see the "common parameters" part of that page:
|
@lafrech yes I am well aware and not suggesting to change that, but the fact that OpenAPI/Swagger spec still expects those parameters to be described for each method. I.e. the definition should not change, the generated documentation should. |
My understanding is that parameters shared by all operations of a path can be defined on the path level instead of the operation level so our implementation conforms to the spec, doesn't it? Are you saying that swagger-ui or another tool complains about it? |
@lafrech you are correct - looked more closely and also confirmed here: https://swagger.io/specification/#path-item-object For some reason the validator I was using is complaining so I assumed it was out of spec. Sorry about the confusion! |
Using a schema to validate/process the path arguments seems to pass the argument twice.
The data-dict of the marshmallow schema is passed as an argument and the value is passed as keyword-argument (probably by vanilla flask).
Note: This can be prevented by passing
as_kwargs = True
to the decoratorCode-Example:
The text was updated successfully, but these errors were encountered: