Skip to content

Explode parameter is not correctly converted from OpenAPI 3.0 to 3.1 documents #377

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

Closed
czechboy0 opened this issue Nov 13, 2023 · 4 comments
Labels
area/generator Affects: plugin, CLI, config file. kind/bug Feature doesn't work as expected. kind/support Adopter support requests. status/blocked Waiting for another issue.
Milestone

Comments

@czechboy0
Copy link
Contributor

          The exploded query parameter style is not working in current version (0.3.4). It used to work properly in previous version (0.1.11)

example openapi.yaml

openapi: '3.0.3'
info:
  description:
  version: 2023.8.26
  title: example
  
servers:
  - url: https://example
  
paths:
  /example:
    get:
      operationId: example
      parameters:
      - name: LocationId
        required: false
        in: query
        style: form
        explode: false
        schema:
          type: array
          items:
            type: string

It now yields:
https://example/example?LocationId=1&LocationId=2

But it is expected to be:
https://example/example?LocationId=1,2

Originally posted by @luomein in #258 (comment)

@czechboy0 czechboy0 added the kind/support Adopter support requests. label Nov 13, 2023
@czechboy0 czechboy0 changed the title Issue with query + exploded form parameters Explode parameter is not correctly converted from OpenAPI 3.0 to 3.1 documents Nov 13, 2023
@czechboy0
Copy link
Contributor Author

Thanks for reporting this @luomein, this indeed looks like a bug.

I've identified that it only happens for documents using OpenAPI 3.0, as we then convert them to 3.1 in memory using OpenAPIKit's to31 method under the hood, however the one for parameter context seems not to be bringing over the explode parameter: https://github.com/mattpolzin/OpenAPIKit/blob/f93e9bd8ec7b9d58f6a86e303fd5f71c7088f9ae/Sources/OpenAPIKitCompat/Compat30To31.swift#L171 @mattpolzin could you take a look?

In the meantime, you can resolve this by using openapi: 3.1.0 at the top of your document, @luomein.

@czechboy0 czechboy0 added area/generator Affects: plugin, CLI, config file. kind/bug Feature doesn't work as expected. status/blocked Waiting for another issue. labels Nov 13, 2023
@czechboy0 czechboy0 added this to the 1.0 milestone Nov 13, 2023
@luomein
Copy link

luomein commented Nov 13, 2023

Thanks for the quick response. Confirmed it works after updating openapi: '3.1.0' in my openapi.yaml

@czechboy0
Copy link
Contributor Author

@luomein it was also fixed in OpenAPIKit 3.1.0, if you update the dependency, can you check it then also works with a document marked with the OpenAPI version 3.0.x?

https://github.com/mattpolzin/OpenAPIKit/releases/tag/3.1.0

@luomein
Copy link

luomein commented Nov 14, 2023

@luomein it was also fixed in OpenAPIKit 3.1.0, if you update the dependency, can you check it then also works with a document marked with the OpenAPI version 3.0.x?

https://github.com/mattpolzin/OpenAPIKit/releases/tag/3.1.0

Yes, confirmed. It works with OpenAPIKit 3.1.0 and openapi: '3.0.3' in openapi.yaml, explode: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/generator Affects: plugin, CLI, config file. kind/bug Feature doesn't work as expected. kind/support Adopter support requests. status/blocked Waiting for another issue.
Projects
None yet
Development

No branches or pull requests

2 participants