Commit b5d1a69
committed
microsoft: parse Graph spec with the lean OpenAPI parser to fit the Workers isolate
The full Graph OpenAPI document (37MB, ~16.5k operations) parsed through the
bespoke eemeli/yaml `YAML.parse` builds a full CST that peaks ~720MB heap and
OOMs the 128MB Cloudflare Workers isolate (measured on a real isolate: HTTP
503, outcome=exceededMemory).
Delegate the parse to the OpenAPI SDK's `parse`, which uses js-yaml's `load`
and does not inline `$ref`s. It peaks ~315MB heap and returns HTTP 200 in-band
on the same isolate. `parse` already validates an OpenAPI 3.x object, so the
redundant object/version checks are dropped. `YAML.stringify` is retained for
emitting the small filtered preset spec, which never touches the 37MB document.1 parent 5f08d68 commit b5d1a69
1 file changed
Lines changed: 13 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
545 | 551 | | |
546 | 552 | | |
547 | 553 | | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
561 | 557 | | |
562 | 558 | | |
563 | 559 | | |
| |||
0 commit comments