swagger-api / swagger-api/swagger-codegen

.Net Core ApiClient.mustache missing parameter for AddFile

Open
#8,303 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The ApiClient.mustache file has this templated code:

        foreach(var param in fileParams)
            request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);

but in .Net core AddFile requires an additional contentLength parameter after the filename.

Swagger-codegen version

Latest

Suggest a fix/enhancement

Just add the missing ContentLength parameter from the param.Value, as in:

        foreach(var param in fileParams)
            request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);

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

Open the .Net Core ApiClient.mustache template and inspect the fileParams loop that calls AddFile. Verify the generated client passes param.Value.ContentLength in the expected position, and confirm the template matches the .Net Core AddFile signature.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.