You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the OpenAPI 3.0 specification a map where the keys are strings and the values are string arrays should be a valid parameter type:
A dictionary (also known as a map, hashmap or associative array) is a set of key/value pairs. OpenAPI lets you define dictionaries where the keys are strings. To define a dictionary, use type: object and use the additionalProperties keyword to specify the type of values in key/value pairs.
The additionalProperties keyword specifies the type of values in the dictionary. Values can be primitives (strings, numbers or boolean values), arrays or objects.
The swagger.json shown above includes an example where a map value is an array of two elements. I would expect this to be a valid configuration. But, swagger UI doesn't seem to accept it. When sending a request to the endpoint using swagger (with the example shown above) the curl command is: curl -X GET "http://localhost:8000/endpoint" -H "accept: */*". Notice that the query string is missing.
Expected behavior
The map containing arrays as values gets encoded as a query string.
Additional context or thoughts
Are map where the values are arrays only supported in a request body (e.g., using POST method)? Or should this also work in a query string as part of a GET request?
The text was updated successfully, but these errors were encountered:
Currently OpenAPI Specification does not support this scenario. The issue is that the deepObject behavior is only defined for simple objects with primitive properties (such as a string-to-string dictionary) but not for arrays or nested objects (such as a string-to-array dictionary).
This feature requires a change to the OpenAPI Specification (OAI/OpenAPI-Specification#1706) before it could be implemented in Swagger UI.
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
According to the OpenAPI 3.0 specification a map where the keys are strings and the values are string arrays should be a valid parameter type:
The
swagger.json
shown above includes an example where a map value is an array of two elements. I would expect this to be a valid configuration. But, swagger UI doesn't seem to accept it. When sending a request to the endpoint using swagger (with the example shown above) the curl command is:curl -X GET "http://localhost:8000/endpoint" -H "accept: */*"
. Notice that the query string is missing.Expected behavior
The map containing arrays as values gets encoded as a query string.
Additional context or thoughts
Are map where the values are arrays only supported in a request body (e.g., using POST method)? Or should this also work in a query string as part of a GET request?
The text was updated successfully, but these errors were encountered: