Commit ac1a26b
Fix: Restore full error.details handling for binary wrap-non-model-return deserializers (#3852)
* fix: restore full error.details handling for binary wrap-non-model-return deserializers
The wrap-non-model-return feature (commit 49500ef) introduced early returns
in the binary wrap path that skipped status checking and error.details
extraction in generated deserialize functions.
This fix:
- Adds a new getBinaryStream static helper that separates stream extraction
from error handling (Node + browser variants)
- Removes the status check skip for binary wrap - all operations now generate
the full getExceptionThrowStatement with error.details, exception headers,
and restErrorCodeHeader support
- The deserializer parameter is renamed to _streamableResult for binary wrap,
with getBinaryStream resolving it into an HttpResponse named result so
existing error handling code references work unchanged
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: add error enrichment scenarios for binary wrap-non-model-return
Adds two new unit test scenarios verifying that binary wrap deserializers
generate full error.details handling:
- Binary wrap + error model: verifies error.details = apiErrorDeserializer(result.body)
- Binary wrap + error model + exception headers: verifies error.details with
exception header merging via _getBlobDeserializeExceptionHeaders(result)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: add storage-compat scenario for void+headers with error enrichment
Verifies that when enable-storage-compat and include-headers-in-response are
both enabled on a void-body operation with response headers and an error model:
1. Deserializer generates error.details = storageErrorDeserializer(result.body)
2. Exception headers are merged into error.details
3. Operation function extracts parsedHeaders and passes them to
addStorageCompatResponse
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update smoke tests
* Update for Storage Compat binary response
- move the `getBinaryStream()` call out of `_operationDeserialize()` and into the
operation method `operation()`, where its result is passed to both `_opDeserialize()` and
`_operationDeserializeHeaders()`
- `_operationDeserialize()` now takes the result of `getBinaryStream()`, process and
throw for error response if any; return the wrapped stream body.
- return type is fixed for wrapped operation.
* update smoke test
* attempt to fix missing import of OperationResponse
* react to recent fast-xml-parser change
* Remove unnecessary logic and rename the helper
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jialin Huang <jialinhuang@microsoft.com>
Co-authored-by: Jeremy Meng <jeremy.ymeng@gmail.com>1 parent 738b13e commit ac1a26b
20 files changed
Lines changed: 516 additions & 220 deletions
File tree
- packages
- typespec-test/test
- batch_modular/generated/typespec-ts/src
- api
- static-helpers/serialization
- openai_modular/generated/typespec-ts/src
- api
- static-helpers/serialization
- typespec-ts
- src/modular
- helpers
- static/static-helpers/serialization
- test/modularUnit/scenarios/operations
- headerParam
- storageCompat
Lines changed: 37 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
| |||
424 | 432 | | |
425 | 433 | | |
426 | 434 | | |
427 | | - | |
| 435 | + | |
| 436 | + | |
428 | 437 | | |
429 | 438 | | |
430 | 439 | | |
| |||
822 | 831 | | |
823 | 832 | | |
824 | 833 | | |
825 | | - | |
| 834 | + | |
826 | 835 | | |
827 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
828 | 845 | | |
829 | 846 | | |
830 | 847 | | |
| |||
840 | 857 | | |
841 | 858 | | |
842 | 859 | | |
843 | | - | |
| 860 | + | |
| 861 | + | |
844 | 862 | | |
845 | 863 | | |
846 | 864 | | |
| |||
1655 | 1673 | | |
1656 | 1674 | | |
1657 | 1675 | | |
1658 | | - | |
| 1676 | + | |
1659 | 1677 | | |
1660 | | - | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
1661 | 1687 | | |
1662 | 1688 | | |
1663 | 1689 | | |
| |||
1669 | 1695 | | |
1670 | 1696 | | |
1671 | 1697 | | |
1672 | | - | |
| 1698 | + | |
| 1699 | + | |
1673 | 1700 | | |
1674 | 1701 | | |
1675 | 1702 | | |
| |||
Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
| |||
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
144 | | - | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments