-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
feat(go): add enumUnknownDefaultCase config option #23417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -153,6 +153,19 @@ public GoClientCodegen() { | |||||||||||||||||
| cliOptions.add(CliOption.newBoolean(WITH_GO_MOD, "Generate go.mod and go.sum", true)); | ||||||||||||||||||
| cliOptions.add(CliOption.newBoolean(CodegenConstants.GENERATE_MARSHAL_JSON, CodegenConstants.GENERATE_MARSHAL_JSON_DESC, true)); | ||||||||||||||||||
| cliOptions.add(CliOption.newBoolean(CodegenConstants.GENERATE_UNMARSHAL_JSON, CodegenConstants.GENERATE_UNMARSHAL_JSON_DESC, true)); | ||||||||||||||||||
|
|
||||||||||||||||||
| CliOption enumUnknownDefaultCaseOpt = CliOption.newBoolean( | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This option is already registered in DefaultCodegen, so adding it again here duplicates the CLI option entry and creates redundant config setup. Rely on the base class definition instead. Prompt for AI agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the AbstractGoCodegen, all cliOptions from the DefaultCodegen get cleared. So it's needed to configure it again Lines 159 to 166 in 90edc51
|
||||||||||||||||||
| CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, | ||||||||||||||||||
| CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE_DESC).defaultValue(Boolean.FALSE.toString()); | ||||||||||||||||||
| Map<String, String> enumUnknownDefaultCaseOpts = new HashMap<>(); | ||||||||||||||||||
| enumUnknownDefaultCaseOpts.put("false", | ||||||||||||||||||
| "No changes to the enum's are made, this is the default option."); | ||||||||||||||||||
| enumUnknownDefaultCaseOpts.put("true", | ||||||||||||||||||
| "With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case."); | ||||||||||||||||||
| enumUnknownDefaultCaseOpt.setEnum(enumUnknownDefaultCaseOpts); | ||||||||||||||||||
| cliOptions.add(enumUnknownDefaultCaseOpt); | ||||||||||||||||||
| this.setEnumUnknownDefaultCase(false); | ||||||||||||||||||
|
|
||||||||||||||||||
| this.setWithGoMod(true); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -411,6 +424,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) { | |||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Determines if at least one of the allOf pieces of a schema are of type string | ||||||||||||||||||
| * | ||||||||||||||||||
|
|
||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.