Commit a7d6a61
authored
fix(api): declare mount binary responses, regenerate the Fern client (#5518)
The three mount routes that return raw bytes declared no response media type, so
FastAPI advertised application/json for them. The generated clients then parsed a
zip or a file body as JSON and corrupted it, which is why the frontend had to call
these routes through raw axios.
Declare the real media types (application/zip for the archive export,
application/octet-stream for the two file downloads). Setting responses= alone is
not enough: FastAPI keeps its default application/json entry unless the route also
declares a response_class with no media type, so both are set. Runtime behavior is
unchanged, since each handler already returns its own Response.
Regenerate the TypeScript client once from the resulting spec, replacing the
exportMountFiles method that was hand-written into the generated directory after
the /files/export rename. The three methods now return core.BinaryResponse with
responseType binary-response, which exposes both .blob() and .stream(). The
regeneration also corrects two pieces of drift the hand-edits had left behind:
GetMountFilesRequest.order becomes a generated enum, and MountFile moves under the
mounts resource.
Refs #5417
Claude-Session: https://claude.ai/code/session_011npNAXwcM2adqdSX6QGcsz1 parent 894c23b commit a7d6a61
5 files changed
Lines changed: 61 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
6 | 15 | | |
7 | 16 | | |
8 | 17 | | |
| |||
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| 54 | + | |
| 55 | + | |
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
| |||
200 | 211 | | |
201 | 212 | | |
202 | 213 | | |
| 214 | + | |
| 215 | + | |
203 | 216 | | |
204 | 217 | | |
205 | 218 | | |
| |||
247 | 260 | | |
248 | 261 | | |
249 | 262 | | |
| 263 | + | |
| 264 | + | |
250 | 265 | | |
251 | 266 | | |
252 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
24 | 45 | | |
25 | 46 | | |
26 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| |||
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
919 | 928 | | |
920 | 929 | | |
921 | 930 | | |
| 931 | + | |
| 932 | + | |
922 | 933 | | |
923 | 934 | | |
924 | 935 | | |
| |||
Lines changed: 8 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | 530 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | 531 | | |
538 | 532 | | |
539 | 533 | | |
540 | 534 | | |
541 | | - | |
| 535 | + | |
542 | 536 | | |
543 | 537 | | |
544 | 538 | | |
545 | 539 | | |
546 | 540 | | |
547 | 541 | | |
548 | | - | |
| 542 | + | |
549 | 543 | | |
550 | 544 | | |
551 | 545 | | |
552 | 546 | | |
553 | 547 | | |
554 | 548 | | |
555 | | - | |
| 549 | + | |
556 | 550 | | |
557 | 551 | | |
558 | 552 | | |
| |||
565 | 559 | | |
566 | 560 | | |
567 | 561 | | |
| 562 | + | |
568 | 563 | | |
569 | 564 | | |
570 | 565 | | |
| |||
897 | 892 | | |
898 | 893 | | |
899 | 894 | | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | 895 | | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | 896 | | |
911 | 897 | | |
912 | 898 | | |
913 | 899 | | |
914 | | - | |
| 900 | + | |
915 | 901 | | |
916 | 902 | | |
917 | 903 | | |
918 | 904 | | |
919 | 905 | | |
920 | 906 | | |
921 | | - | |
| 907 | + | |
922 | 908 | | |
923 | 909 | | |
924 | 910 | | |
| |||
929 | 915 | | |
930 | 916 | | |
931 | 917 | | |
932 | | - | |
| 918 | + | |
933 | 919 | | |
934 | 920 | | |
935 | 921 | | |
| |||
939 | 925 | | |
940 | 926 | | |
941 | 927 | | |
| 928 | + | |
942 | 929 | | |
943 | 930 | | |
944 | 931 | | |
| |||
Lines changed: 4 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1289 | 1289 | | |
1290 | 1290 | | |
1291 | 1291 | | |
1292 | | - | |
1293 | | - | |
1294 | | - | |
1295 | 1292 | | |
1296 | | - | |
1297 | | - | |
1298 | | - | |
1299 | | - | |
1300 | | - | |
1301 | | - | |
1302 | 1293 | | |
1303 | 1294 | | |
1304 | 1295 | | |
1305 | 1296 | | |
1306 | | - | |
| 1297 | + | |
1307 | 1298 | | |
1308 | 1299 | | |
1309 | 1300 | | |
1310 | 1301 | | |
1311 | 1302 | | |
1312 | 1303 | | |
1313 | | - | |
| 1304 | + | |
1314 | 1305 | | |
1315 | 1306 | | |
1316 | 1307 | | |
| |||
1321 | 1312 | | |
1322 | 1313 | | |
1323 | 1314 | | |
1324 | | - | |
| 1315 | + | |
1325 | 1316 | | |
1326 | 1317 | | |
1327 | 1318 | | |
| |||
1331 | 1322 | | |
1332 | 1323 | | |
1333 | 1324 | | |
| 1325 | + | |
1334 | 1326 | | |
1335 | 1327 | | |
1336 | 1328 | | |
| |||
0 commit comments