-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
pipeDelimited and spaceDelimited style examples can be unresolvable #3737
Comments
@charjr My initial thought was that the @karenetheridge have you run into this? I know you improved some things in this table recently. |
@handrews @karenetheridge If the tables need updating, I can provide some PRs for each. Just let me know whether it would be better to:
I also have to question the Example: parameters:
- name: pet
in: query
required: true
schema:
type: object
properties:
name:
type: string
id:
type: integer
- name: id
in: query
required: true
schema:
type: integer
Default PS: I'm not saying the above example is a good API, my current knowledge leads me to believe if you create an api like the above, then you should fully expect it to clash. |
I agree, I believe that for the examples given in the spec, the URI would look like The examples at https://swagger.io/docs/specification/serialization/#query also back this up, that the parameter name does appear in the query portion of the URI. |
@karenetheridge would you be interested in writing a 3.0.4 PR for this? If so I can assign this issue to you and add it to the 3.0.4 milestone. |
If it's not a direct copy-paste of what we'd do for 3.1.0, then I'm not the right person for that, as I've not ever used 3.0.x in any serious way and don't have good command of its differences from 3.1. |
@karenetheridge the style examples table is identical in 3.0.3 and 3.1.0. I'd also be perfectly happy if you want to do a 3.1.1 PR and then leave porting it to 3.0.4 to me. We can also just raise this in the Thursday meeting and see if anyone else has bandwidth to do it. |
following up on your point about style=form, explode=true, type=object:
Yes, that was my interpretation as well when I implemented style=form parsing of query strings. When the indicated schema type is 'object', all query parameters in the URI are sucked up into that parameter. There could be another parameter as well, separately, but it would get a duplicate of that parameter. However, this is not reversible ( Following your example:
Using this query string:
We could also reconcile this in the specification by explicitly saying that if a parameter of type This issue does not extend to the other styles, because |
These should have the parameter name in the resulting string (see issue OAI#3737).
These should have the parameter name in the resulting string (see issue OAI#3737).
These should have the parameter name in the resulting string (see issue OAI#3737).
I agree, that clarification would be good and make it easier for tools to parse query strings while being compliant with the spec.
According to the Swagger docs It would also affect I think clarification, in one of two ways, would help: |
We don't allow explode:true with those styles -- at least, that's been my interpretation of the spec, since examples for those aren't shown. If this is ambiguous we should definitely make that clear (and we can also change the schema to explicitly disallow that combination -- I'm a big fan of everything being in the schema that's possible to represent there). |
PR merged for 3.0.4 and ported to 3.1.1 via PR #3921! |
What the Specification states
According to the style examples:
style
explode
array
object
When I read the rows for
form
I observe that the parameter name is explicitly used within the examples:color=blue,black,brown
for instance.So naturally, when I do not see the name explicitly used in
spaceDelimited
orpipeDelimited
examples my conclusion is that the names are not used.Problem with statement
Imagine the following example:
A valid url according to the spec would be:
/pets?cat|shorthair|calico&confident%20greedy%20loud
/pets?cat|shorthair|calico&loud
loud
is... but if we can work out the first part thenloud
can be deduced by a process of elimination./pets?cat&loud
Using the Swagger Editor with this spec it seems to think that the urls would come out as follows:
/pets?type=cat|shorthair|calico&personality=confident%20greedy%20loud
/pets?type=cat|shorthair|calico&personality=loud
/pets?type=cat&personality=loud
All of which would immediately be identifiable based on the name. I realise the Swagger Editor is not the source of all knowledge, but the urls it generated matched what I would have expected.
Considering that
form
,spaceDelimited
andpipeDelimited
, are based off of 2.0'scollectionFormat
I was wondering ifspaceDelimited
, andpipeDelimited
were meant to have the name explicitly used in the same way asform
?The text was updated successfully, but these errors were encountered: