mtennoe / swagger-typescript-codegen

A Swagger Codegenerator tailored for typescript.
Apache License 2.0
140 stars 52 forks source link

implemented collection format for query and path array values #100

Closed tommyseus closed 4 years ago

tommyseus commented 4 years ago

Currently, the collectionFormat configuration is ignored and all array parameters behave like "collectionFormat": "multi".

// example parameter config
{
    "name": "csvParam",
    "type": "array",
    "items": {
        "type": "string"
    },
    "in": "query",
    "collectionFormat": "csv"
}

Wrong: ?csvParam=foo&csvParam=bar Correct: ?csvParam=foo,bar

I tried to implement collectionFormat and would be happy if it get merged after a review.

https://swagger.io/docs/specification/2-0/describing-parameters/#array-and-multi-value-parameters

mtennoe commented 4 years ago

Thanks @tommyseus, this looks great! Only left a few minor comments. I also created #101 as a reminder to change to the normal default collectionFormat on the next major release

mtennoe commented 4 years ago

@tommyseus - I am so sorry, I thought I had already merged and published this PR! Just merged it now and published as 3.0.2