← Back to Pull requests

[ruby-nextgen] Fix enumUnknownDefaultCase mapping and numeric enum constant casing (#24996) #25344

Open
unknown opened this pull request with 359 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 21, 2026 08:57 UTC
Author

Fixes #24996

When enumUnknownDefaultCase=true is enabled for ruby-nextgen:
1. RubyNextgenClientCodegen#toEnumVarName previously skipped .toUpperCase(Locale.ROOT) in the numeric (Integer / Float) branch, emitting unknown_default_open_api = 11184809 in lowercase (which Ruby evaluates as a local variable instead of a constant, raising NameError in self.all).
2. partial_model_enum_class.mustache did not define self.build(value), so Polymorphism.coerce_model never mapped unknown values to UNKNOWN_DEFAULT_OPEN_API.

Changes

  • Uppercase varName in the numeric branch of RubyNextgenClientCodegen#toEnumVarName.

  • Emit self.build(value) in partial_model_enum_class.mustache when enumUnknownDefaultCase is enabled.

  • Add unit tests in RubyNextgenClientCodegenTest.
  • PR checklist



  • Read the contribution guidelines.

  • Samples for ruby-nextgen (bin/configs/ruby-nextgen.yaml, bin/configs/ruby-nextgen-qdrant.yaml) do not enable enumUnknownDefaultCase and are unaffected.

  • Mention Ruby technical committee members: @cliffano @zlx @autopp @n-rodriguez
  • <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Fixes #24996. When enumUnknownDefaultCase=true, the generated ruby-nextgen client emitted numeric enum members like unknown_default_open_api = 11184809 in lowercase, which Ruby treats as a local variable instead of a constant and raises NameError in self.all. Unknown values also never mapped to UNKNOWN_DEFAULT_OPEN_API because self.build(value) was missing.

  • Numeric enum member names are now uppercased so they become valid Ruby constants.

  • partial_model_enum_class.mustache now emits self.build(value) when enumUnknownDefaultCase is enabled, mapping unknown values to the unknown default member and passing nil through unchanged.

  • connection.mustache deserializes arrays of enums through build so unknown members in array responses map correctly, and skips array handling when the payload is not an array.

  • Adds unit tests for generated method output, constant casing, and array enum deserialization.
  • <sup>Written for commit 698c83f0f7a6ec1259ff6d0b73f82ba44bc7a98f. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/OpenAPITools/openapi-generator/pull/25344?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    Diff: 359 lines (+269 / -90) across 4 files Reviewer: princejain756 Review duration: 58640m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 359 lines diff across 4 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.352
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #25344"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.6% (MEDIUM) · Higher = larger blast radius
    49.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.4% · Safe to merge
    27.4%