Skip to content

Multidimensional arrays as parameters. #412

@IvanGoncharov

Description

@IvanGoncharov

Currently Swagger 2.0 support specs like that:

{
    "swagger": "2.0",
    "info": {
        "version": "0.0.0",
        "title": "Simple API"
    },
    "paths": {
        "/{foo}": {
            "parameters": [
                {
                    "name": "foo",
                    "in": "path",
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                }
            ],
            "get": {
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    }
}

By default collectionFormat is csv and this create problems with interpreting strings like 'a,b,c,d'.
Should it be interpreted like:

[
  ["a","b","c","d"]
]

Or maybe like this:

[
  ["a", "b"],
  ["c", "d"]
]

It should be forbidden to create nested arrays with same collectionFormat.
This change will prevent undefined behaviour situation and could be done in 2.0 as bugfix.
JSON Schema couldn't enforce such constraints, but it could be specified in spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions