Commit 53264a2
authored
fix(go): emit the oneOf no-match error once instead of once per member (#24683)
The no-match branch of the generated UnmarshalJSON was wrapped in a
{{#oneOf}} section, so the error return introduced by #24349 was rendered
once per oneOf member. Only the first copy is reachable; the rest is dead
code that grows with the number of members.
Render the block once, outside the section. err is declared unconditionally
at the top of UnmarshalJSON, so the {{^oneOf}} fallback is no longer needed.
Behaviour is unchanged: the first copy is what executed before.
Regenerate the affected go samples.
fix #246611 parent d098bc3 commit 53264a2
9 files changed
Lines changed: 50 additions & 105 deletions
File tree
- modules/openapi-generator/src/main/resources/go
- samples
- client/others/go/oneof-anyof-required
- openapi3/client/petstore/go/go-petstore
Lines changed: 10 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
93 | 88 | | |
94 | 89 | | |
95 | 90 | | |
| |||
124 | 119 | | |
125 | 120 | | |
126 | 121 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
137 | 127 | | |
138 | 128 | | |
139 | 129 | | |
| |||
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments