Commit fe1c642
fix(generator): escape discriminator JSON names instead of allowlist filtering (#340)
* fix(generator): escape discriminator JSON names instead of allowlist filtering
The allowlist approach would silently break JSON deserialization for specs
with non-alphanumeric discriminator property names. Escape only the two
characters that break Go struct tag syntax (" and \) so the tag matches
the actual JSON key. Also align unmarshal.go.tmpl to use | quote pipe
consistently with oneof.go.tmpl.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(generator): remove pre-escaping, rely on template quote pipe
The builder was escaping " and \ before the template applied
strconv.Quote via | quote, causing double-escaping. Remove
pre-escaping entirely — the | quote pipe in both templates
handles all necessary escaping for Go struct tag string literals.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent d5a1bf1 commit fe1c642
2 files changed
Lines changed: 2 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 447 | + | |
456 | 448 | | |
457 | 449 | | |
458 | 450 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments