Repository navigation
Commit 7bee48f
[ruby] fix: enumUnknownDefaultCase declares the unknown-default member but never deserializes to it (#24879)
* fix: [ruby] enumUnknownDefaultCase must reach build_from_hash, not just declare the member
With enumUnknownDefaultCase=true the generator adds UNKNOWN_DEFAULT_OPEN_API to
every enum class's constants and all_vars, but the enum's build_from_hash still
raised 'Invalid ENUM value' for any wire value outside the list — the flag
changed nothing observable, and one new enum value from the server still
destroyed the whole response.
build_from_hash now falls back to the enum's own unknown-default member — the
last declared enum var, which under the flag is always the appended
UNKNOWN_DEFAULT_OPEN_API. The tolerance lives in each generated enum class;
without the flag the generated code is byte-identical to before and still
raises. Java's fromValue behavior under the same flag is the reference.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxDNCjqJycKTfzVWg2SeTJ
* test: [ruby] drop enumUnknownDefaultCase assertions the build_from_hash checks imply
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test: [ruby] keep the enumUnknownDefaultCase member value assertions
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>1 parent 9f97fc4 commit 7bee48f
2 files changed
Lines changed: 59 additions & 0 deletions
File tree
- modules/openapi-generator/src
- main/resources/ruby-client
- test/java/org/openapitools/codegen/ruby
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
861 | 915 | | |
0 commit comments