Skip to content

[kotlin] Fix boolean const enum literal generation#24022

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
scarab-systems:scarab-systems/openapi-generator-23550-repair
Jun 14, 2026
Merged

[kotlin] Fix boolean const enum literal generation#24022
wing328 merged 1 commit into
OpenAPITools:masterfrom
scarab-systems:scarab-systems/openapi-generator-23550-repair

Conversation

@scarab-systems

@scarab-systems scarab-systems commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #23550.

This keeps Kotlin boolean enum/const values as boolean literals when rendering enum values. Before this change, const: true could generate a Kotlin enum entry with "true" even though the enum value type is kotlin.Boolean.

I added a focused toEnumValue assertion and a generated-output regression fixture for the reported OpenAPI 3.1 boolean const: true case.

Tests:

  • ./mvnw clean package
  • ./bin/generate-samples.sh ./bin/configs/*.yaml
  • ./bin/utils/export_docs_generators.sh

Kotlin technical committee: @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l @dennisameling


Summary by cubic

Ensure Kotlin boolean const enums are generated as boolean literals, not strings. Fixes #23550.

  • Bug Fixes
    • Updated toEnumValue to pass through values for kotlin.Boolean (like kotlin.Int/kotlin.Long).
    • Added unit and generator tests for OpenAPI 3.1 const: true with jvm-ktor and jackson, plus a regression fixture (issue23550-boolean-const.yaml).

Written for commit a9e10a1. Summary will update on new commits.

Review in cubic

@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 4 files

Re-trigger cubic

@wing328 wing328 added this to the 7.24.0 milestone Jun 14, 2026
@wing328 wing328 merged commit 7b535a9 into OpenAPITools:master Jun 14, 2026
15 checks passed
@wing328

wing328 commented Jun 14, 2026

Copy link
Copy Markdown
Member

lgtm. thanks for the fix

@scarab-systems scarab-systems deleted the scarab-systems/openapi-generator-23550-repair branch June 14, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][kotlin] const: true on boolean property generates uncompilable enum (Boolean vs String mismatch)

2 participants