Commit 0555520
committed
Go codegen: per-event-type data structs (fixes #1031)
Replace the flat quicktype-generated Data union struct with per-event-type
data structs, matching the C# codegen approach. Adding a new session event
type can no longer change the struct shape of existing event types.
- Replace generateSessionEvents() in scripts/codegen/go.ts with custom
codegen that produces 74 per-event data structs, a SessionEventData
interface, and custom UnmarshalJSON/MarshalJSON on SessionEvent
- Update go/session.go to use idiomatic Go type switches for event dispatch
- Update samples, tests, and doc examples for the new API
- Add type/const aliases for PermissionRequest, Attachment, and related
types to ease migration
- Add .gitattributes eol=lf for generated files to prevent cross-platform
line ending diffs
- Re-enable the codegen-check CI workflow (remove go/generated_session_events.go
revert workaround)
- Add ui, uri, mime to Go initialisms for correct field naming1 parent 6565a3b commit 0555520
21 files changed
Lines changed: 2903 additions & 1843 deletions
File tree
- .github/workflows
- go
- internal/e2e
- testharness
- rpc
- samples
- scripts/codegen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
| |||
404 | 402 | | |
405 | 403 | | |
406 | 404 | | |
407 | | - | |
| 405 | + | |
| 406 | + | |
408 | 407 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
| 408 | + | |
| 409 | + | |
413 | 410 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
| 411 | + | |
| 412 | + | |
418 | 413 | | |
419 | 414 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
| 415 | + | |
| 416 | + | |
424 | 417 | | |
425 | 418 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 419 | + | |
| 420 | + | |
431 | 421 | | |
432 | 422 | | |
433 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
0 commit comments