What the Specification states
According to the style examples:
style | explode | array | object |
|---|
| form | false | color=blue,black,brown | color=R,100,G,200,B,150 |
| form | true | color=blue&color=black&color=brown | R=100&G=200&B=150 |
| spaceDelimited | false | blue%20black%20brown | R%20100%20G%20200%20B%20150 |
| pipeDelimited | false | blue|black|brown | R|100|G|200|B|150 |
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 or pipeDelimited examples my conclusion is that the names are not used.
Problem with statement
Imagine the following example:
/pets:
get:
parameters:
- name: typein: querystyle: pipeDelimitedschema:
type: arrayitems: type: string
- name: personalityin: querystyle: spaceDelimitedschema:
type: arrayitems:
type: string
A valid url according to the spec would be:
/pets?cat|shorthair|calico&confident%20greedy%20loud- not too bad, we could identify each parameter based on the styles.
/pets?cat|shorthair|calico&loud- Okay... no idea what style
loud is... but if we can work out the first part then loud 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 and pipeDelimited, are based off of 2.0's collectionFormat I was wondering if spaceDelimited, and pipeDelimited were meant to have the name explicitly used in the same way as form?
What the Specification states
According to the style examples:
styleexplodearrayobjectWhen I read the rows for
formI observe that the parameter name is explicitly used within the examples:color=blue,black,brownfor instance.So naturally, when I do not see the name explicitly used in
spaceDelimitedorpipeDelimitedexamples 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&loudloudis... but if we can work out the first part thenloudcan be deduced by a process of elimination./pets?cat&loudUsing 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=loudAll 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,spaceDelimitedandpipeDelimited, are based off of 2.0'scollectionFormatI was wondering ifspaceDelimited, andpipeDelimitedwere meant to have the name explicitly used in the same way asform?