-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support for repeated path parameters #741
Comments
Path parameters largely just need to be compatible with the |
Ideally I’d like to follow the OpenAPI 2.0 standard which allows csv (default), ssv, tsv, pipe and multi. The latter is only for query params though. But I don’t see how it would be possible to specify a ”separator” using the http annotation. As I see it I can implement/hard code csv and my assumption is that it would be sufficient for most people. The http annotation documentation also seems to state that this should be the way to do it if I interperet it and RFC 6570 (https://tools.ietf.org/html/rfc6570#section-3.2.2) correctly. On the other hand I guess it could be possible to have a custom annotation, like you have for the swagger generator (https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-swagger/options/annotations.proto) to support specifying the ”separator” type. Yet another option could be to make it configureable via a parameter provided to the plug-in, e.g. ”repeated_field_separator=csv”. What is your take? |
Sadly swagger-codgen doesn't support arrays as path parameters, even if the 2.0 spec says that it is supported. See https://github.com/swagger-api/swagger-codegen/blob/v2.2.2/modules/swagger-codegen/src/main/resources/go/api.mustache#L45. It will only generate correct code for arrays as query parameters. See https://github.com/swagger-api/swagger-codegen/blob/v2.2.2/modules/swagger-codegen/src/main/resources/go/api.mustache#L85-L86. Nonetheless, I'll submit a PR for review. |
I wonder if you would consider adding support for repeated path parameters á la
"collectionFormat": "csv"
from Swagger/OpenAPI? See e.g. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#path-item-object-example. I would be interested in submitting a PR myself.The text was updated successfully, but these errors were encountered: