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 Swagger spec, setting allowMultiple = True will cause a CSV string (comma-separated values) to be converted to an array. The caveat is this field may be used only if paramType is "query", "header" or "path".
In contrast, flask-restful's reqparse can allow mutiple values too by setting action="append", but it's mechanism is to pass the same key several times. Per the documentation, this is how such multiple values would be passed with curl: curl http://api.example.com -d "Name=bob" -d "Name=sue" -d "Name=joe" . Digging into curl's documentation, the -d flag sends form data. This would match Swagger's paramType="form", which is incompatible with the allowMutliple=True setting.
It seems the Swagger spec and reqparse are incompatible in this way. However, as Swagger is only a documentation spec, and not an implementation spec, i'm not sure how to make the two libraries work together better.
The text was updated successfully, but these errors were encountered:
swagger-spec version 2.0 adds the parameter collectionFormat which can be "multi":
multi - corresponds to multiple parameter instances instead of multiple values for a single instance foo=bar&foo=baz. This is valid only for parameters in "query" or "formData".
But so far it seems that this project supports only spec version 1.2.
According to the Swagger spec, setting
allowMultiple = True
will cause a CSV string (comma-separated values) to be converted to an array. The caveat is this field may be used only ifparamType
is "query", "header" or "path".In contrast, flask-restful's reqparse can allow mutiple values too by setting
action="append"
, but it's mechanism is to pass the same key several times. Per the documentation, this is how such multiple values would be passed with curl:curl http://api.example.com -d "Name=bob" -d "Name=sue" -d "Name=joe"
. Digging into curl's documentation, the-d
flag sends form data. This would match Swagger'sparamType="form"
, which is incompatible with theallowMutliple=True
setting.It seems the Swagger spec and reqparse are incompatible in this way. However, as Swagger is only a documentation spec, and not an implementation spec, i'm not sure how to make the two libraries work together better.
The text was updated successfully, but these errors were encountered: