Skip to content

Commit

Permalink
Configure default generator with no config
Browse files Browse the repository at this point in the history
When no config file is specified while using new configuration style,
assume some code generation defaults, namely (client, server, echo, embed),
to be consistent with old default behavior.
  • Loading branch information
marcinromaszewicz committed Oct 28, 2022
1 parent 85ca14e commit 80a2aca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/oapi-codegen/oapi-codegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ func main() {
if err != nil {
errExit("error parsing'%s' as YAML: %v\n", flagConfigFile, err)
}
} else {
// In the case where no config file is provided, we assume some
// defaults, so that when this is invoked very simply, it's similar
// to old behavior.
opts = configuration{
Configuration: codegen.Configuration{
Generate: codegen.GenerateOptions{
EchoServer: true,
Client: true,
Models: true,
EmbeddedSpec: true,
},
},
OutputFile: flagOutputFile,
}
}
var err error
opts, err = updateConfigFromFlags(opts)
Expand Down

0 comments on commit 80a2aca

Please sign in to comment.