OpenAPITools / OpenAPITools/openapi-generator
[BUG] [client] [csharp] Culture dependent double format breaks CSV style for array params
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by generating a csharp-netcore client from the supplied OpenAPI declaration with openapi-generator-cli.jar. Inspect the generated client’s array query-parameter serialization for form style with explode=false under de-DE. Done means double values use invariant decimal formatting so CSV query parameters remain correctly separated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100