OpenAPITools / OpenAPITools/openapi-generator
[REQ] Please consider providing options disable the Go Generator generates client test code and go.mod file
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
We found several problems when using the Go generator version 6.2.1 to generate client code inside our Go project,
- The sub package name of the test code it generates is wrong;
expected path/to/gen/test/api_xxx.test.go
package xxx_test
import (
"context"
"testing"
openapiclient "path/to/our/go/project/gen/xxx/openapi"
// ...
)
got
package xxx_test
import (
"context"
"testing"
openapiclient "../openapi"
// ...
)
the xxx is packageName option pass to Go generator tool via configuration file.
BTW: the option isGoSubmodule does not help no matter set it true or false.
- the Go generator generates client code as a Go sub-package breaks our main Go project dependency and auto-building
We have to remove go.mod go.sum from client source code folder to fix it by manual every time we update client code.
Describe the solution you'd like
Please consider providing two options noTest one for disable generating test code, and another noGoMod for diable go.mod go.sum, thanks.
https://openapi-generator.tech/docs/generators/go/#config-options
Describe alternatives you've considered
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Go generator's configuration options and the behavior that produces client tests, go.mod, and go.sum; compare the requested noTest and noGoMod options with isGoSubmodule. Done means both options are documented and reliably control generation without breaking the generated client, with coverage for the package import behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100