Skip to content

Fix numeric enum deserialization#24394

Open
sakshichitnis27 wants to merge 3 commits into
OpenAPITools:masterfrom
sakshichitnis27:issue-24344-csharp-enum-deserialization
Open

Fix numeric enum deserialization#24394
sakshichitnis27 wants to merge 3 commits into
OpenAPITools:masterfrom
sakshichitnis27:issue-24344-csharp-enum-deserialization

Conversation

@sakshichitnis27

@sakshichitnis27 sakshichitnis27 commented Jul 23, 2026

Copy link
Copy Markdown

Fixes #24344

Description

Makes numeric inner-enum deserialization consistent with string enums in the C# generichost generator.

  • Unknown nullable numeric enum values are deserialized as null.
  • Unknown non-nullable numeric enum values leave the option unset.
  • Applies the same behavior to byte-backed numeric enums.
  • Adds regression coverage for nullable and non-nullable numeric enums.

Validation

  • CSharpClientCodegenTest: 10 tests passed, 0 failures.
  • Generated a fresh .NET 8 client from the test fixture.
  • Verified at runtime that an unknown nullable value becomes null.
  • Verified at runtime that an unknown non-nullable value remains unset.
  • git diff --check passed.

PR checklist


Summary by cubic

Fix numeric enum deserialization in the C# generichost generator to match string enums. Unknown numeric values now become null for nullable enums and are skipped for non‑nullable enums (including byte‑backed); parsing is centralized in NumericInnerEnumJsonRead.mustache, with tests covering nullable inline int enums.

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

Review in cubic

Signed-off-by: sakshichitnis27 <sakshichitnis27@users.noreply.github.com>

@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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@wing328

wing328 commented Jul 23, 2026

Copy link
Copy Markdown
Member

thanks for the PR

cc @devhl-labs

@wing328

wing328 commented Jul 23, 2026

Copy link
Copy Markdown
Member

please follow step 3 to update the samples

@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.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

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][csharp][generichost] Enum de/serialization inconsistency

2 participants