OpenAPITools / OpenAPITools/openapi-generator

[BUG][CSHARP][RESTSHARP] Enum array inside multipart/form-data request bug

Open
#21,538 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I have this endpoint which requires the content type to be multipart/form-data because of a file upload.
One of the other properties in the body is of type enum array.
Currently this is being generated:

localVarRequestOptions.FormParameters.Add("EnumArrayItems", MyNamespace.Api.Client.ClientUtils.Serialize(enumArrayItems)); // form parameter

It should generate this instead:

foreach (var enumArrayItem in enumArrayItems)
{
    localVarRequestOptions.FormParameters.Add("EnumArrayItems", MyNamespace.Api.Client.ClientUtils.ParameterToString(enumArrayItem)); // form parameter
}
openapi-generator version

OpenAPI Generator 7.14.0

OpenAPI declaration file content or url

https://gist.github.com/kipusoep/5070a52cb53537f5713ee83a41b210c2

Generation Details

I am using the REST API Client Code Generator v1.29.0.0 Visual Studio plugin to generate the code.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked OpenAPI declaration and trace how the C# RESTSharp client generates multipart/form-data entries into FormParameters. Compare the generated enum-array code with the requested per-item ParameterToString form, and consider the task done when generation produces one form parameter for each enum-array item.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.