Repository navigation
Export an OpenAPI 3.1 description of the project's HTTP operations (#845) - #879
Merged
Merged
Conversation
`urlcode openapi [--project] [--origin] [--out] [--host-file] [--policy]`, MCP `get_openapi` and the SDK's `buildOpenApi` return one document from the compiled configuration: one operation per declared method, the route's parameters, each method's request.body policy as its requestBody (the 2020-12 schema as written; local $defs hoisted to components with their $refs rewritten), and only responses URLCode itself writes or the YAML fixes (redirect status + Location, respond values, asset statuses, 400/413/415/422 in the route's error format, enforced throttle/agents refusals, the auth extension's 401/403). Handler-defined answers are a `default` response with no schema. Extension, static and /** mounts are listed under x-urlcode.opaqueMounts, never enumerated. Bindings, egress/redirect targets, module paths, operator policy and cookie names are never emitted; auth: true uses a generic cookie scheme with a placeholder name. test/openapi.test.ts validates the output against the vendored official OAS 3.1 schema (2025-09-15) plus the 2020-12 meta-schema for every Schema Object, generates a client with @hey-api/openapi-ts (new devDependency, js-yaml overridden to 4.3.2 for its advisories) that typechecks and calls examples/body-validation, and runs a contract pass of derived requests against that example. Core package budget raised to 880 KiB packed / 3500 KiB unpacked (measured 897639 / 3572415). Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 29, 2026 00:23
jimhoyd
force-pushed
the
claude/openapi-export
branch
from
September 29, 2026 00:23
befc20a to
ab7293b
Compare
This was referenced Sep 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ndard formats Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers #845's acceptance that "OpenAPI output validates with an independent standard tool, supports a generated client and one contract-testing run", and #861 item 2.
What it does
urlcode openapi [--project] [--origin] [--out] [--host-file] [--policy], MCPget_openapi, and the SDK functionsbuildOpenApi/renderOpenApiall go through one function inpackages/core/src/openapi.ts. The document is built from the compiled configuration: nothing executes, no binding is read, and the output is deterministic.openapi: 3.1.1, withjsonSchemaDialectset to 2020-12.request.body.<METHOD>becomes that operation'srequestBody. The author's 2020-12 schema goes intocomponents.schemas, and each$defsentry is lifted into its own component so its$refresolves.Location, arespondbody as aconstschema, page/download statuses, conditional branches, the runtime's own 400/413/415/422 in the route's error format, and throttle 429 or agents 403.defaultresponse with a description and no invented schema./**mounts are listed inx-urlcode.opaqueMountsand never enumerated. A store OpenAPI contribution is scoped out: its vocabulary is still private (JSON Schema profile follow-ups: store/forms vocabularies, OpenAPI export, shared HTTP+MCP+form schema, formats, workerd CI #861 item 1), and its full surface wasn't small.auth: truegets a generic cookiesecurityscheme,urlcodeSession, with a placeholder cookie name.x-urlcode: runtime version, revision, handler kind, execution mode, middleware count, error format and target support.Validation evidence (
test/openapi.test.ts)$dynamicRef: "#meta", so the test rewrites it to the equivalent static$ref. Formats are not checked.@hey-api/[email protected](openapi-typescriptneeds TypeScript 5; this repo is on 6).@ts-expect-errorproving the schema'srequiredreached the types, and runs it against the servedexamples/body-validation: 201, 422/title, 201, 200.overridesentry pinsjs-yamlto 4.3.2 over the vulnerable 4.2.0 it pulled in.npm auditreports 0 vulnerabilities.--outand MCP return identical documents.npm run verifyandnpm run test:packagepass.Gaps (filed)
site.errorsscopes are matched by pattern.🤖 Generated with Claude Code