Repository navigation
OpenAPI accuracy: runtime headers and 405, auth 401/403 per method, mixed error scopes; standard formats for parameters (#881) - #894
Merged
Conversation
…cy; parameter formats (#881) OpenAPI export (#881 items 3-6): - Every response names X-Request-Id and X-Content-Type-Options (reusable components.headers); the runtime's own errors also name their fixed Cache-Control: no-store. Cache-Control is not stated elsewhere, since a handler, declared header or cache policy may set it. - Each path item states the 405 for an undeclared method under x-urlcode.methodNotAllowed: the exact Allow value and a components.responses body in the path's error format. - auth: true routes declare 401 on every method and 403 only on POST, PUT, PATCH and DELETE, matching the auth extension's authorize(). - site.errors entries are compared with the route pattern segment by segment. An entry covering only some concrete paths of a templated route (an exact /users/42 beside /users/{id}) makes the path `mixed`: x-urlcode.errorScope lists the entries and each runtime error declares both bodies. - The contract run now also covers a project with an auth: true route (synthetic auth extension) and function routes, checks the runtime headers, and provokes a 405 on every path. Parameter formats (#881 item 9): path, query and header parameter schemas accept the body schema's standard formats (date, time, date-time, email, uri, hostname, ipv4, ipv6, uuid) through the same body-formats.ts checks and caps; the Cloudflare build inlines them into validators.js. Schema, capability text, HTTP.md and RIM-INPUT-001 updated; workerd parity cases added. Unpacked package budget raised by the measured growth (3604 to 3614 KiB). Items 1 and 2 (extension contributions, function response schemas) remain open. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Fixes #881 items 3, 4, 5, 6 and 9. Items 1 and 2 (extension contributions, function response schemas) stay open there.
OpenAPI (
openapi.ts)X-Request-IdandX-Content-Type-Options: nosniffas reusablecomponents.headers; the runtime always sets both and handlers can't replace them.Cache-Control: no-storeis declared only on the runtime's own error responses (400/404/413/415/422).x-urlcode.methodNotAllowedwith:Allowvalue;components.responsesentry in the path's error format.auth: trueroutes declare 401 on every method and 403 only on POST, PUT, PATCH and DELETE, matching the auth extension.site.errorsscopes (item 5). Scopes are matched segment by segment against the route pattern.json./users/42beside/users/{id}, or/v2/*over/{version}/items) givesmixed.x-urlcode.errorScopelists the covering entries, and the error bodies are declared in both formats.Allowvalue). It also runs against a project with:auth: trueroute: 401 on GET and POST, 403 on a cross-origin POST, 200 on a cross-origin GET;mixedcase.Parameter formats (item 9)
schemas/urlcode.schema.jsonand the capability text list all nine; an unknown format fails at load.test/body-validation.test.tsnow usesidn-emailas the unsupported example.Evidence (macOS, Node 26), rebased on main after #891
npm run verifypasses (1164 core tests).npm run test:packagepasses.npm run test:workerd: 37/37 identical, including 4 new parameter-format cases.Docs: TOOLING (the OpenAPI "Not yet described" list is down to items 1 and 2), HTTP,
RIM-INPUT-001,RIM-OPENAPI-001, llms.🤖 Generated with Claude Code