-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Path templating, multiple segments, and RFC 6570? #291
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
Comments
Currently, Swagger 2.0 doesn't support it. It's been discussed in the workgroup but we have decided to exclude it. I imagine it has a very good chance of being included in the next version of the spec though. |
Thanks, please then consider this a vote for some solution to this problem in the next rev of the spec. |
👍 |
1 similar comment
👍🏻 |
Does this bug imply that it is not possible to have multiple REST-API "Search" operations for same resource? |
It's not a bug, it's a feature request (can't believe I just said that). If your query parameters are mutually exclusive, you can't define that, but that's not related to this feature but another one here. If you're just looking to describe multiple parameters, there's no problem with that. |
Okay let`s name it feature ^^ |
It actually relates to #164, not this one. We can't treat RFC 6570 as a single feature. Not saying it won't all be implemented, but we need to have separate issues for separate sections of it so we know we cover it properly. |
+1 and curious about how to track/participate in the workgroup on this issue? |
+1 to include this in the next spec. |
+1 for adding at least partial RFC 6570 support from me as well. We already use these local extensions:
|
I'm trying to implement :
maybe soon a PR :) |
+1 |
Parent: #574 |
+1 for adding RFC 6570 support from me as well. |
👍 I need it at two different places:
|
👍
IMO the spec shouldn't limit this to tool chain capabilities. While certain tool chains might be able to support it with higher fidelity, we should atleast support the subset that can be described by parameter definitions.
My vote is yes, because the parameter definitions can have type information that cannot be described by the path alone.
For consistency I'd say yes |
Also there is a working reference implementation using the java + spring + trickedout-swagger-ui stack. |
Option 1 The risk of allowing unescaped parameters is that it would make tools like swagger inflector difficult to implement as it becomes challenging to match URIs to templates when parameters can contain URL delimiter characters. The common scenario for unescaped parameters is when the host is being parameterized but considering the paths property doesn't include the host, I'm not sure what other use cases exist. Option 2
Standard 6570 parsing libraries can still be used. Option 3 Previously it was decided that including query string parameters in the path key would introduce significant amount of additional complexity when it comes determining path identity. Some cited concerns involve optional parameters, literal values, and parameter ordering. e.g.
Are these considered three, two or one distinct paths? From a specification and documentation perspective, a spec author could explicitly choose which of these need to be described separately. However for tools like Inflector and Codegen it could cause some challenging situations. Despite the additional complexity, there appears to be fairly significant support #164 for adding this capability. One final issue, if this option is adopted, can we really continue to call the parent property "paths"? Or do we need to have to call it PathAndQueries :-\ |
Option 3 gets my vote. I would argue that merging query params into the path template may make the overall specification simpler in light of #574 - the uniqueness of an operation could remain verb + path and satisfy the demands for including more variability if the path template had full RFC 6570 support. Just to add a real-world use case for unescaped parameters: I maintain an API that represents a virtual filesystem with an endpoint |
+1 for at least Option 2. I have APIs that make heavy use of matrix parameters. For each endpoint, some matrix parameters are required and others optional. I like the notion of documenting both (required and optional) in the parameters object. |
+1 |
Option 1 (optional paths) seems to address most immediate needs, and avoids figuring out all the complexity of option 3. Option 3 (query strings) could be added on top of Option 1 later. This would provide some extra time to figure out the desired semantics re uniqueness. To me, ignoring the query string part of the URL spec for uniqueness seems to be the most consistent way to go about this, but there are several other options on the table. I do not care as much about the map functionality in Option 2. If this is added, then I would prefer to do this in line with RFC 6570. |
+1 |
+1 |
2 similar comments
+1 |
+1 |
+1 |
+1 |
You can see what has been added by looking at changes in this PR: |
+1 |
+1 |
1 similar comment
+1 |
I'm trying to write swagger docs for APIs like dropbox where the number of path segments isn't known ahead of time. For example, the path template will look something like:
And the following urls should all match this path:
If we were using RFC 6570, I'd represent this as:
but the swagger v2 spec doesn't say if this syntax is acceptable or not.
If it is acceptable/correct, could you please let me know in this item? If it's not, what is the expected way to model APIs like this with runtime variable URI paths?
The text was updated successfully, but these errors were encountered: