Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #10588
Closed
Open
Issue created Oct 13, 2021 by Administrator@rootContributor

[BUG][csharp-netcore] Failed to deserialize FileParameter when using HttpClient.

Created by: TORISOUP

Description

When a client that returns byte[] (FileParameter) as a response is created and called, FileParameter is interpreted as Json and decoded, resulting in an exception.

openapi-generator version

5.2.1.

Related issues/PRs

I'm sorry if this has already been pointed out.

Suggest a fix/enhancement

In the next conditional branch, it looks like the fact that FileParameter is passed is not taken into account.

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache#L99-L147

For now, by adding the following code, I was able to get the byte[] without any error.

if (type == typeof(FileParameter))
{
    return new FileParameter(await response.Content.ReadAsStreamAsync());
}
Assignee
Assign to
Time tracking