Commit b62055d
[http-client-csharp] Add JSONL and SSE streaming support (#11462)
## Summary
- preserve JSONL and SSE stream metadata in the C# emitter code model
- generate incremental `IAsyncEnumerable<T>` JSONL requests and
`AsyncStreamingClientResult<T>` JSONL responses
- generate unbuffered SSE responses as
`AsyncStreamingClientResult<SseItem<BinaryData>>`, including
terminal-event suppression
- add live Spector coverage for JSONL send/receive and all unnamed,
named, and retrieval SSE scenarios
- consume the streaming result APIs introduced by
Azure/azure-sdk-for-net#60994
Closes #10738
## Validation
- `npm run build`
- `npm test`
- `npm run cop`
- `Test-Spector.ps1 -filter "http/streaming/jsonl"`
- `Test-Spector.ps1 -filter "http/streaming/sse"`
`npm run lint -- --emitter` is currently blocked by the package
resolving ESLint 10 while retaining a legacy ESLint configuration
(`eslint.config.*` is not present).
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e02ee7d0-8d27-46f8-a856-222d6a938ecd1 parent 0fba3fe commit b62055d
141 files changed
Lines changed: 3948 additions & 1049 deletions
File tree
- packages/http-client-csharp
- emitter
- src
- lib
- type
- test/Unit
- utils
- eng/scripts
- generator
- Microsoft.TypeSpec.Generator.ClientModel
- src
- Providers
- Snippets
- Utilities
- test/Providers
- ClientProviders/TestData/ClientProviderTests
- Microsoft.TypeSpec.Generator.Input
- src/InputTypes
- Serialization
- test
- Microsoft.TypeSpec.Generator
- src
- Primitives
- Properties
- Snippets
- Utilities
- test/common
- TestProjects
- Local/Sample-TypeSpec/src
- Spector.Tests
- Http/Streaming
- Jsonl
- Sse
- Infrastructure
- Spector/http
- authentication
- api-key/src
- http/custom/src
- oauth2/src
- union/src
- client/structure
- client-operation-group/src
- default/src
- multi-client/src
- renamed-operation/src
- two-operation-group/src
- documentation/src
- encode
- array/src
- boolean/src
- bytes/src
- datetime/src
- duration/src
- numeric/src
- parameters
- basic/src
- body-optionality/src
- body-root/src
- collection-format/src
- path/src
- query/src
- spread/src
- payload
- content-negotiation/src
- head/src
- json-merge-patch/src
- media-type/src
- multipart/src
- pageable/src
- xml/src
- resiliency/srv-driven
- v1/src
- v2/src
- response/status-code-range/src
- routes/src
- serialization/encoded-name/json/src
- server
- endpoint/not-defined/src
- path
- multiple/src
- single/src
- versions
- not-versioned/src
- versioned/src
- service/multiple-services/src
- special-headers
- conditional-request/src
- repeatability/src
- special-words/src
- streaming
- jsonl
- src
- Generated
- Models
- schema
- sse
- src
- Generated
- Models
- schema
- type
- array/src
- dictionary/src
- enum
- extensible/src
- fixed/src
- model
- empty/src
- inheritance
- enum-discriminator/src
- nested-discriminator/src
- not-discriminated/src
- recursive/src
- single-discriminator/src
- usage/src
- visibility/src
- property
- additional-properties/src
- nullable/src
- optionality/src
- value-types/src
- scalar/src
- union/src
- versioning
- added
- v1/src
- v2/src
- madeOptional
- v1/src
- v2/src
- removed
- v1/src
- v2Preview/src
- v2/src
- renamedFrom
- v1/src
- v2/src
- returnTypeChangedFrom
- v1/src
- v2/src
- typeChangedFrom
- v1/src
- v2/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 112 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
234 | 239 | | |
235 | 240 | | |
236 | 241 | | |
237 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
238 | 245 | | |
239 | 246 | | |
240 | 247 | | |
| |||
351 | 358 | | |
352 | 359 | | |
353 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
354 | 370 | | |
355 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
356 | 378 | | |
357 | 379 | | |
358 | 380 | | |
| |||
365 | 387 | | |
366 | 388 | | |
367 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
368 | 396 | | |
369 | 397 | | |
370 | 398 | | |
| |||
378 | 406 | | |
379 | 407 | | |
380 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
381 | 418 | | |
382 | 419 | | |
383 | 420 | | |
| |||
408 | 445 | | |
409 | 446 | | |
410 | 447 | | |
411 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
412 | 451 | | |
413 | 452 | | |
414 | 453 | | |
| |||
607 | 646 | | |
608 | 647 | | |
609 | 648 | | |
610 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
611 | 652 | | |
612 | 653 | | |
613 | 654 | | |
| |||
725 | 766 | | |
726 | 767 | | |
727 | 768 | | |
728 | | - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
729 | 772 | | |
730 | 773 | | |
731 | 774 | | |
| |||
737 | 780 | | |
738 | 781 | | |
739 | 782 | | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
740 | 847 | | |
741 | 848 | | |
742 | 849 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
305 | 306 | | |
306 | 307 | | |
307 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
308 | 320 | | |
309 | 321 | | |
310 | 322 | | |
| |||
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
218 | 307 | | |
219 | 308 | | |
220 | 309 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
| 88 | + | |
| 89 | + | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
0 commit comments