swagger-api / swagger-api/swagger-codegen
[Go] generated client packages are subject to linting
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When running golang linter, it will complain about generated code. I would expect linter to be muted. It turns out that partial_header.mustache is very old, and does not contain proper comment in header section.
Swagger-codegen version
Latest
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i ./api.json -l go -o ./tmp
Steps to reproduce
- Generate any API client
- Run golang linter
Related issues/PRs
Suggest a fix/enhancement
Proper template can be taken from here
The culprit is that generated header comment needs to contain line: Code generated by
As a workaround people can create their own partial_header.mustache and put it to directory that is passed to -t argument for swagger-codegen
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 partial_header.mustache template and compare it with the OpenAPI Generator template linked in the issue. Generate an API client using the provided command, then run a Go linter against the generated package. Done means the generated header contains the required Code generated by comment and the linter no longer reports generated files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100