OpenAPITools / OpenAPITools/openapi-generator

[BUG] openapi-generator-maven-plugin generates incorrect package import for go-server

Open
#8,448 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

When using openapi-generator-maven-plugin to generate go-server codes, there are two errors in the generated codes:
(openapi-generator-version is 5.0.0)

  1. "mime/multipart" is forget to import in router.go
  2. `github.com/gorilla/mux` should not be imported in `api_default.go` file.
    

How to produce:

I can stable reproduce it using the following file:

  1. get codes from: https://github.com/apache/iotdb/tree/openapi/openapi
  2. run mvn generate-codes
  3. the generated source is under target/generated-sources/go

see the codes and error tips by GoLand.

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

Reproduce with the openapi-generator-maven-plugin using the IoTDB openapi directory and mvn generate-codes; inspect the generated target/generated-sources/go/router.go and api_default.go. The fix is complete when the generated go-server code no longer omits mime/multipart or imports github.com/gorilla/mux incorrectly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.