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
  • #8165
Closed
Open
Issue created Dec 11, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][GO] Build error if 2 properties have binary format

Created by: krhubert

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

go build produce an error

./api_default.go:113:6: localVarFile redeclared in this block
        previous declaration at ./api_default.go:102:6

Here is the declaration of the variable: https://github.com/OpenAPITools/openapi-generator/blob/08fb59009a8565295b1e091eb0c514b7439245e8/modules/openapi-generator/src/main/resources/go/api.mustache#L236-L239

openapi-generator version
 docker pull openapitools/openapi-generator-cli:latest

https://hub.docker.com/layers/openapitools/openapi-generator-cli/latest/images/sha256-19f983d1a396391e13e1010c8ca0f27577eacb68f83a07fffa778bec40e033ee?context=explore

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: api
  version: 0.0.1

paths:
  /media:
    post:
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                video:
                  type: string
                  format: binary
      responses:
        200:
          description: Success
Steps to reproduce

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -g go -o /local/out/go -i /local/openapi.yaml

Related issues/PRs

None

Suggest a fix

Change the variable name for every property that has a binary format.

Assignee
Assign to
Time tracking