swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.73k stars 6.02k forks source link

[GO] Bug when other go tools does not see code generated by swagger-codegen as code generated #12358

Open jensravn opened 3 months ago

jensravn commented 3 months ago
Description

Go code generated by swagger-codegen has a line with the following comment:

* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

This comment does not match the pattern for generated code in go:

^// Code generated .* DO NOT EDIT\.$

Described here https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source

Swagger-codegen version

3.0.54

Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i swagger.yaml -l go
Steps to reproduce
Related issues/PRs

This PR fixes the issue https://github.com/swagger-api/swagger-codegen/pull/12357

Suggest a fix/enhancement

The fix could be to change the line to the following

// Code generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) DO NOT EDIT.
satokenta940 commented 1 month ago

You could try using Apidog to generate code. That's how I use it, and I find the range of features quite diverse.