@@ -28,7 +28,6 @@ import (
28
28
29
29
"github.com/pkg/errors"
30
30
log "github.com/sirupsen/logrus"
31
- gengoargs "k8s.io/gengo/args"
32
31
generatorargs "k8s.io/kube-openapi/cmd/openapi-gen/args"
33
32
"k8s.io/kube-openapi/pkg/generators"
34
33
)
@@ -103,16 +102,17 @@ func openAPIGen(hf string, fqApis []string) error {
103
102
api = filepath .FromSlash (api )
104
103
// Use relative API path so the generator writes to the correct path.
105
104
apiPath := "." + string (filepath .Separator ) + api [strings .Index (api , scaffold .ApisDir ):]
106
- args := & gengoargs.GeneratorArgs {
107
- InputDirs : []string {apiPath },
108
- OutputFileBaseName : "zz_generated.openapi" ,
109
- OutputPackagePath : filepath .Join (wd , apiPath ),
110
- GoHeaderFilePath : hf ,
111
- CustomArgs : & generatorargs.CustomArgs {
112
- // Print API rule violations to stdout
113
- ReportFilename : "-" ,
114
- },
115
- }
105
+ args , cargs := generatorargs .NewDefaults ()
106
+ // Ignore default output base and set our own output path.
107
+ args .OutputBase = ""
108
+ // openapi-gen already generates a "do not edit" comment.
109
+ args .GeneratedByCommentTemplate = ""
110
+ args .InputDirs = []string {apiPath }
111
+ args .OutputFileBaseName = "zz_generated.openapi"
112
+ args .OutputPackagePath = filepath .Join (wd , apiPath )
113
+ args .GoHeaderFilePath = hf
114
+ // Print API rule violations to stdout
115
+ cargs .ReportFilename = "-"
116
116
if err := generatorargs .Validate (args ); err != nil {
117
117
return errors .Wrap (err , "openapi-gen argument validation error" )
118
118
}
0 commit comments