Converting "collectionFormat: csv" in OAS2 to OAS3
See original GitHub issueChecklist
- Conversion: I have checked my source definition is valid OpenAPI 2.0
- Conversion: On valid OpenAPI 2.0 input, the conversion looks wrong
Detailed Description
When converting the following endpoint in petstore.yaml from OAS2 to OAS3 using the online converter:
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
produces:
- application/xml
- application/json
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
collectionFormat: csv
I got the following result in OAS3:
/pet/findByStatus:
get:
tags:
- pet
summary: Finds Pets by status
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
style: form
schema:
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
collectionFormat: csv in OAS2 should be converted to the following in OAS3 instead:
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: false
but in the output generated by the online converter, explode: false is missing.
Ref:
- https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-10
- https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#style-values
Am I understanding OAS3 correctly in terms of how “collectionFormat: csv” (OAS2) should be defined in OAS3?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
OpenAPI Specification - Version 2.0 - Swagger
Describes the type of items in the array. collectionFormat, string, Determines the format of the array if type array is used. Possible values...
Read more >OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, ... This option replaces collectionFormat with a csv (when explode is false) or multi ...
Read more >Swagger: cannot set "collectionFormat" - openapi
To address this issue, i found that you could influence this behavior by setting the attribute "collectionFormat" not to multi but to csv....
Read more >Mermade Swagger 2.0 to OpenAPI 3.0.0 converter
Mermade Swagger 2.0 to OpenAPI 3.0.0 converter · Conversion / Validation engine v5.3.0 · Web frontend version v1.3.17 · Example definitions · Test...
Read more >Request Handling — Connexion 2.0 documentation
With this option enabled, Connexion firstly converts CamelCase names to ... and collectionFormat: csv , then connexion will set letters = ['d', 'e',...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ackintosh did a great job by creating this table: https://github.com/swagger-api/swagger-parser/pull/702#issue-187611442
it provides conversion rules OAS2 <-> OAS3 for parameters.
@wing328 I think you’re right. Will take a look.