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

Colon support in Path Parameters #1681

Closed
anupsaund opened this issue Sep 3, 2018 · 6 comments
Closed

Colon support in Path Parameters #1681

anupsaund opened this issue Sep 3, 2018 · 6 comments

Comments

@anupsaund
Copy link

anupsaund commented Sep 3, 2018

This is relation to swagger-api/swagger-js#1338 which was rejected as Colon substitution is not part of the OpenAPI Specification.

May I ask for colon in Path parameters to be considered please?

My scenario is using a JAVA framework, Vert.x to generate Swagger JSON.
Unfortunately, it's was too invasive for me to change the routing in that framework to use {} braces in PATH parameter substitution, so I hacked the front end java script to find a colon : and replace based on that.

More info on back story with screenshots available in pull request linked above.

@MikeRalphson
Copy link
Member

My personal reaction is no, this is unlikely to be supported. OAS path parameters are (loosely) modelled on RFC6570 which uses {} as template delimiters, not colons. This is more flexible, as it allows for paths such as /foo/{bar}baz which I don't think the :parameter notation supports.

Generally, the OAS defines one and only one way of defining a particular intent and (again, personally) that's the way I'd like it to stay.

I note that there are multiple projects related to vert.x and OpenAPI, and these seem to cope with the translation of colon-delimited parameters to RFC6570-style templates without problem. For example https://github.com/outofcoffee/vertx-oas#vertx-oas and https://github.com/ckaratzas/vertx-openapi-spec-generator

@anupsaund
Copy link
Author

@MikeRalphson Thanks.

I had already looked into the two vert.x projects that you linked, and they both produce swagger.json which contains colons in the paths rather than curley braces.

Sadly, I have yet to come across an implementation which does the conversion.

I do get what you are saying though, but there are scenarios where frameworks adhere to colons, regexpresions or whatever that are pretty fundimental to their framework syntax that it is too hard to replace into curley braces.

If it was that easy - then I would have done it in Vert.x.

@MikeRalphson
Copy link
Member

I'm afraid I can't see this as anything other than a tooling bug. Whether the tools use :parameter or {parameter} syntax internally is irrelevant. Only the generated (or ingested) OAS document needs to be converted. From experience this can be done with a simple regex.

@handrews
Copy link
Member

I agree with @MikeRalphson that this is a tooling bug and that OAS should specify exactly one syntax for a feature.

The colon syntax is limited by not allowing for a closing delimiter other than the next / in a path, so supporting it would limit those who use the RFC 6570 syntax to define variables that do not directly correlate to a single path component.

@ioggstream
Copy link
Contributor

Hi @webron!

Do you know why swagger editor doesn't signal an error when :param is used instead of {param} ?

Thx++, R

@MikeRalphson
Copy link
Member

Closing due to inactivity - but please feel free to reopen the issue if necessary.

@MikeRalphson MikeRalphson closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
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

No branches or pull requests

4 participants