Open fghpdf opened 5 months ago
Also specific to the sub-template generichost
which override the api.mustache and ClientUtils.mustache the method ParameterToMultiMap()
just doesn't exist which means that the exploded "explode: true not supported" bugs also apply to other use case like array.
For this OpenAPI document
info:
title: Example
version: 1.0.0
openapi: 3.0.1
paths:
/test-array:
get:
tags:
- Test
parameters:
- name: numbers
in: query
required: true
style: form
explode: true
schema:
type: array
items:
type: integer
format: int32
responses:
'200':
description: Success
[Expected] Should separate item from an array using &
https://localhost:8080/test-array?numbers=1&numbers=2&numbers=3
[Actual] Separates with comma
https://localhost:48666/test-array?numbers=1,2,3
We are also willing to open a Pull Request to make the required fixes for the generichost
library.
Looks like this is also a problem in the Python client generator.
Bug Report Checklist
Description
In OpenAPI 3.0, we can wrap query params into one param by using
style: form
andexplode: true
. (Ref: https://swagger.io/docs/specification/serialization/)And the generated C# code has only one param in this method.
[Expected] But the param cannot be converted into the correct HTTP query param, eg. in CURL:
[Actual] The generated code will convert the object's root name into the query param, eg. in CURL:
openapi-generator version
v7.3.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
new ResourceGetFiltersParam()
and put some value into itRelated issues/PRs
10438
15633
7973
16435
Suggest a fix
In the
ClientUtils.mustache
, the generated code will call the functionParameterToMultiMap
and the process will go to this step https://github.com/OpenAPITools/openapi-generator/blob/275ed9296dea4a1a894cc5b3402b5b8f3a61e7d7/modules/openapi-generator/src/main/resources/csharp/ClientUtils.mustache#L87-L90Like the suggestion in #16435 , we can use the similar way to solve this problem: