Skip to content

fix(golang): use datatype only for enums instead of format#24337

Open
rubenhoenle wants to merge 2 commits into
OpenAPITools:masterfrom
rubenhoenle:master
Open

fix(golang): use datatype only for enums instead of format#24337
rubenhoenle wants to merge 2 commits into
OpenAPITools:masterfrom
rubenhoenle:master

Conversation

@rubenhoenle

@rubenhoenle rubenhoenle commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

relates to #24336

Detailed description and steps to reproduce can be found in the linked GitHub issue.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@antihax @grokify @kemokemo @jirikuncar @ph4r5h4d @lwj5


Summary by cubic

Fixes Go enum generation when a schema sets format: "enum" by always using the base data type in generated enums. Prevents invalid types in both models and properties.

  • Bug Fixes
    • Updated go/model_enum.mustache to use {{dataType}} for the enum type, the UnmarshalJSON value, and the NewXFromValue parameter, removing reliance on {{format}}.

Written for commit 3a44bf6. Summary will update on new commits.

Review in cubic

@rubenhoenle rubenhoenle changed the title fix(golang): fallback if "format": "enum" is set for enums fix(golang): use datatype only for enums instead of format Jul 20, 2026
@rubenhoenle

Copy link
Copy Markdown
Contributor Author

See the linked GitHub issue for context of the latest change to this PR.

@rubenhoenle
rubenhoenle marked this pull request as ready for review July 20, 2026 13:00

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant