openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] [client] [csharp] Culture dependent double format breaks CSV style for array params

Open Reinhard-PTV opened this issue 3 years ago • 0 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [ ] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using an array of doubles as query parameter with explode = false, the CSV format of the parameter that is used for the URL is broken if the current culture is e. g. 'de-DE', because the decimal separator is ',' then.

Suggested fix is to use also InvariantCulture as it is applied when converting a single value.

openapi-generator version

6.2.0

OpenAPI declaration file content or url

Sample file defining an array of doubles as query parameter:

openapi: 3.0.3
info:
  title: Test array of double values
  version: 1.0.0
paths:
  /test:
    get:
      operationId: test
      parameters:
        - name: values
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: number
              format: double
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
Generation Details
Steps to reproduce

java -jar openapi-generator-cli.jar generate -g csharp-netcore -i test.yaml

Related issues/PRs

#6194

Suggest a fix

#13637

Reinhard-PTV avatar Oct 07 '22 14:10 Reinhard-PTV