swagger-api / swagger-api/swagger-codegen

Missing import of github.com/antihax/optional

Open
#11,788 0 comments 0 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
Swagger-codegen version
Swagger declaration file content or url

Proprietary

Command line used for generation

wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.26/swagger-codegen-cli-2.4.26.jar -O swagger-codegen-cli.jar

java -jar swagger-codegen-cli.jar generate -i ../docs/swagger.json -l go -o tmp/

Steps to reproduce

Running the above commands on your swagger.json specification will produce an api_file which uses the package "github.com/antihax/optional" but does not import it.

Related issues/PRs

Referenced in:
https://github.com/swagger-api/swagger-codegen/issues/10213
https://github.com/fintechstudios/ververica-platform-k8s-operator/blob/master/README.md

the people in both of the above comments treated this as a bug to be fixed manually.

Suggest a fix/enhancement

This seems to be the template used:
https://github.com/swagger-api/swagger-codegen/blob/751e59df060b1c3ecf54921e104f2086dfa9f820/modules/swagger-codegen/src/main/resources/go/api.mustache

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

Start with modules/swagger-codegen/src/main/resources/go/api.mustache and reproduce the issue using the documented swagger-codegen-cli command with the Go generator. Inspect the generated api_file and verify that generated code using github.com/antihax/optional also includes the required import and remains buildable.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.