Documentation
¶
Overview ¶
filter_spec trims the upstream E2B OpenAPI specs down to the surface the Go SDK generates clients for. It mirrors the decorators in upstream E2B/redocly.yaml (which the JS/Python SDK pipelines run through `redocly bundle`) so our oapi-codegen inputs stay equivalent without a Node.js toolchain:
- every mode: drop any node marked `x-not-implemented: true` (operations, schemas, properties, ...);
- mode "internal" (envd.yaml, openapi-volumecontent.yml): drop operations marked `x-internal: true` (orchestrator-only control endpoints such as envd's /init, whose `x-go-type: SecureToken` does not compile outside envd);
- mode "api" (openapi.yml): keep only operations whose tags intersect the SDK tag set (plus GET /health), dropping admin/console endpoints;
after which path items left without operations are removed and unreferenced components are pruned (redocly's remove-unused-components).
The filter is deliberately dependency-free (no YAML library in go.mod): it works on the block-structured layout upstream uses (2-space indentation, paths at indent 2, operations at indent 4, operation fields at indent 6, components at indent 2/4) and removes whole line blocks, so every kept line stays byte-identical to upstream. It fails loudly if the layout changes.
Usage (invoked by scripts/sync-spec.sh):
go run -mod=readonly ./scripts/filter_spec.go <api|internal> <file.yml> [<file.yml>...]