In Swagger 2.0, what should “default” within an array parameter actually mean?
See original GitHub issueNot an issue, but a question on the swagger in the repo:
In the well-known petstore swagger document, the findByStatus endpoint takes a status:
"parameters": [
{
"name": "status",
"in": "query",
"description": "Status values that need to be considered for filter",
"required": true,
"type": "array",
"items": {
"type": "string",
"enum": [
"available",
"pending",
"sold"
],
"default": "available"
},
"collectionFormat": "multi"
}
]
While the default value could be implied from this, from a programmatic perspective what should be expected as the value for “status” (and for other parameters in a similar case)?
The value is of type array, it doesn’t have a default. Each item is a string, one of available, pending or sold, and the default if not supplied is “available” How would you use “default” for an array of arbitrary length? The default supplied is for the string, not the array so:
Does this imply that the array has no default value? Does it imply that the array has a default value of an array with one item that is the default value for the array items? Does it imply an array of arbitrary length where all the values are the default value for the array items? Or is it just for UI representation of the default selected value when adding a new item to the array?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I believe that the example is just wrong. It should rather read
which would in fact make more sense.
Looks like the example in question is not part of this project, and no more work is being done on OAS 2 anyway, so I’m going to close this.