Commit bd5f8a2
test: TS emitter handles chat fixture (discriminated unions) tsc-clean
Verified that the v0.1 TS emitter — scoped to OneBusAway-style schemas
— also generates tsc-clean output for the chat fixture (oneOf
discriminated unions + JSON request body) AND the full public openai-
openapi spec (162 paths, 983 schemas, 22 resources). The scope is
substantially broader than initially planned for a v0.1 slice.
What's covered by the v0.1 TS emitter:
- Simple types (primitives, arrays, maps, enums, unions, nulls, refs)
- Object types (interfaces with dot-quoted property names where the
wire key isn't a TS identifier)
- HTTP methods: GET / POST / PUT / PATCH / DELETE
- Path params + query params + JSON request/response bodies
- Nested subresources (constructor-initialized fields)
- Per-resource files, types module, full vendored runtime
- Typed error hierarchy re-exported from package root
- tsc strict mode passes on OneBusAway + chat fixture + openai spec
Caveats (deferred to v0.2-TS):
- Streaming methods generate as if non-streaming (return the JSON
response type; no Stream<Event> overload)
- Discriminated unions render as plain `T1 | T2 | T3` (no runtime
discriminator-based parse — works for tsc; not for runtime
validation of an unknown JSON payload)
- Multipart, binary, pagination, webhook unwrap — all not yet wired
- MCP-from-TS — deferred (Python MCP works with the Python SDK
today; a TS MCP server is a separate undertaking)
- 1 new regression test (`test_chat_fixture_tsc_clean`): chat fixture
→ tsc-clean
- 129 tests green; ruff clean
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 976798b commit bd5f8a2
1 file changed
Lines changed: 28 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
111 | 108 | | |
112 | | - | |
113 | | - | |
| 109 | + | |
114 | 110 | | |
115 | 111 | | |
116 | 112 | | |
| |||
124 | 120 | | |
125 | 121 | | |
126 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
0 commit comments