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
  • #11965
Closed
Open
Issue created Mar 24, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [Go] File download returns nil

Created by: acranbury

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

Have an OpenAPI v3 endpoint definition to download a file, when you create the client, and try to execute a download, you get a nil file pointer back.

openapi-generator version

master

OpenAPI declaration file content or url

https://gist.github.com/acranbury/0b2358548c7e45ab5cc2f857b964cd28

Generation Details

java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g go -i apicurio_test.yaml -o /var/tmp/apicurio_test

Related issues/PRs

This seems related to https://github.com/OpenAPITools/openapi-generator/issues/8392 where the file upload fails

Suggest a fix

The issue is that client.decode expects a **os.File to be passed in, but the return type of the file download endpoint is already **os.File. The endpoint passes &localVarReturnValue which ends up as a ***os.File, so the file write never happens and nil is returned.

It seems like the **os.File return type of the endpoint is unnecessary, and could be reduced to just *os.File, or decode could expect a ***os.File, although a triple pointer makes me shudder just a little.

Assignee
Assign to
Time tracking