Skip to content
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

allowMultiple=True not being parsed per spec #50

Open
hamx0r opened this issue Oct 14, 2014 · 1 comment
Open

allowMultiple=True not being parsed per spec #50

hamx0r opened this issue Oct 14, 2014 · 1 comment

Comments

@hamx0r
Copy link

hamx0r commented Oct 14, 2014

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.

@PabloCastellano
Copy link

I'm in the same situation.

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.

See also: OAI/OpenAPI-Specification#49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants