inaka / cowboy_swagger

Swagger integration for Cowboy (built on trails)
http://inaka.net/blog/2015/08/19/cowboy-swagger/
Apache License 2.0
120 stars 58 forks source link

Add "-" and "_" for path binding variable names format #180

Closed zsoci closed 7 months ago

zsoci commented 7 months ago

Our API specification comes in a yaml file containing OpenAPI definitions. We generate our trails definitions from these yaml file. Openapi does not restrict the naming of path parameters, it shall be a string without /?#. (see https://spec.openapis.org/oas/latest.html#path-templating). Our customers started to use '-' in path parameter field names. We would avoid to parse and generate field names for bindings in our handlers for cowboy. Cowboy and trails works fine with the 'extension' our swagger page generated from the trails definitions does not work as it compiles "/customers/[:customer-name]" to "/customers/{customer}-name" and cannot be used to test the endpoint from the generated swagger page.

paulo-ferraz-oliveira commented 7 months ago

@zsoci, could you maybe edit your initial message to state the motivation and use case for this? Doesn't need to be anything super-detailed or long, as long as it can serve as an historical reference. Thanks. (meanwhile, I've approved the CI run and will look closer at the implementation)