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
  • #6927
Closed
Open
Issue created Jul 14, 2020 by Administrator@rootContributor

[BUG] [Go] api.mustache template change to use strings.replace for localVarPath not importing strings lib

Created by: shylasrinivas

Description

Modified api.mustache template to replace localVarPath. In files where strings package is not already present by default, generator is not importing the lib for strings causing compilation failure. Manually adding the imports causes duplicate import error.

openapi-generator version

4.3.1

OpenAPI declaration file content or url

https://gist.github.com/shylasrinivas/ba6cc06dbc5a731b00f5d06d0bb6d8ee Line in api.mustache causing this issue - localVarPath = strings.Replace(localVarPath, "__", "?" , -1)

Command line used for generation

openapi-generator generate -g go -p enumClassPrefix=true -p structPrefix=true -t ~/bindings/templates -i hcl.yaml -o ~/bindings/hcl

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/5231

Suggest a fix

Used import alias functionality in go and added another import for strings Eg: strings and _strings. This fixes the compilation issue, however the code in the bindings does not look good.

Assignee
Assign to
Time tracking