Repository navigation
Close out #9 — Problem Details ruleset, three base APIs, and RFC 9457 across the catalog - #32
Merged
Merged
Conversation
New repo: api-commons/spectral-problem-details-ruleset — 16 grounded Spectral rules for RFC 9457, following the spectral-owasp-ruleset pattern. - _base/problem-details-for-http-apis.md: url moves from RFC 7807 to RFC 9457, description explains that the retained urn:ietf:rfc:7807 XML namespace is deliberate (RFC 9457 Appendix B), and a Spectral Ruleset entry joins the OpenAPI and Repository entries. - _common/error-codes.md: three problem-details rules under governance_rules, and the ruleset plus the base OpenAPI under tools. - README: the ruleset in the tools table, and a pointer from the base entry. Layout fix, needed for the above to render at all. _layouts/base.html rendered only GitHubGist and GitHubRepository properties, and every GitHubRepository got the hard-coded link text "Visit this Base on GitHub". That is wrong the moment a base points at more than one repo — the ruleset would have rendered as a second "Visit this Base on GitHub", and the Rules and Specification properties would have been dropped silently. Replaced with a Resources list that renders every non-gist property with its own label and type. train-travel is unchanged in substance (one repository, now labelled); accounts, images and videos declare no apis block and are unaffected. Verified: site builds clean, all four links render on the base page, and the other four base pages still render their gists. Closes #9. Co-Authored-By: Claude Opus 5 (1M context) <[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.
Everything issue #9 asked for, end to end. Closes #9.
1. The ruleset
New repo: api-commons/spectral-problem-details-ruleset — 16 grounded rules for RFC 9457, on the
spectral-owasp-rulesetpattern. Built-in Spectral functions only, so it also runs in the browser validator.Grounded in RFC 9457 read in full. The sentence it's built around is §3.1:
A
statusdeclared as a string doesn't throw at the consumer — it vanishes. The type rules guard against silent data loss, not style.The two rules worth the install on their own:
problem-details-allows-extension-members(additionalProperties: falseforbids the §3.2 mechanism the format evolves through, and several generators emit it by default) andproblem-details-status-is-number.Two things deliberately not done, documented rather than faked: no check that
statusmatches the response's HTTP status code (not expressible with built-in functions), andurn:ietf:rfc:7807is not flagged — RFC 9457 Appendix B retained that XML namespace.clean.yamlcarries it so the suite fails if the regex ever over-matches.2. Reuse across the base APIs
accounts,imagesandvideoswere description-and-tags stubs with no OpenAPI and no repo. All three now exist:Each ships an OpenAPI 3.1, an APIs.json index, a README, and Apache-2.0.
The RFC 9457 error components are byte-identical across all three, composed from one shared block rather than written three times. Adopt more than one base and your clients parse a single error format. That is the reuse the issue asked for.
All three lint clean under the ruleset, and under
spectral:oasapart fromoas3-api-servers— deliberate, since a base template has no server and a placeholder would only tripoas3-server-not-example.com. Building them surfaced three real defects, now fixed: two operations missing descriptions, and aConflictresponse in images that no operation could return.Design choices carried into the bases rather than left implicit: merge-patch with the null-means-delete trap documented on the patch schema; conditional writes via ETag/If-Match/412; two-step upload so a failed upload doesn't lose metadata; renditions requested rather than enumerated;
alton images and captions as a first-class sub-resource on videos; webhooks on videos, because video isn't ready when the upload finishes.3. RFC 7807 → RFC 9457
The catalog cited an RFC obsoleted in July 2023 22 times, with zero references to its replacement.
Fixed at the source —
spotlight-validator/rules/all-rules.yamlandrules/spotlight-recommended.yaml— then regenerated withscripts/generate-spotlight.py, since_data/spotlight_rules.jsonis generated and a direct edit would be overwritten on the next build.rules/sources/*was deliberately not touched. Those are harvested third-party rulesets (team-digitale and others). Rewriting them would misrepresent what those vendors actually publish.Three 7807 mentions remain on purpose, in the phrasing "RFC 9457, which obsoleted RFC 7807" — history, not a stale citation.
Also:
rules/index.htmladvertised 733 rules; the committed data has held 740 since the agentic-access rules landed.4. Base OpenAPI + site
_base/problem-details-for-http-apis.md—urlmoves to RFC 9457, and a Spectral Ruleset entry joins the others_base/accounts|images|videos.md— rebuilt from stubs, each pointing at its OpenAPI, APIs.json, repo, and the ruleset_common/error-codes.md— threeproblem-detailsrules undergovernance_rules, ruleset and base undertoolsREADME— the ruleset in the tools table, the three bases in the specs listOne layout fix, needed for any of it to render.
_layouts/base.htmlrendered onlyGitHubGistandGitHubRepository, giving every repo the hard-coded text "Visit this Base on GitHub". The ruleset would have shown up as a second one, andOpenAPI/APIsJSONproperties would have been dropped silently. Replaced with aResourceslist. Same class of trap as the_commonlayout: the layout renders a fixed set, so new frontmatter is invisible until the layout learns it.spotlight-validatorhas no live remote — its origin is recorded asorigin-defunct. The source-side RFC fix exists only in the local checkout. The generated output is committed here, but the next person to regenerate from a fresh clone will reintroduce the 7807 text unless that repo gets a home.Related
info.licensesays CC BY-NC-SA 4.0 while the repo LICENSE is Apache-2.0.Verification
npm teston the ruleset asserts every declared rule fires on the noncompliant fixture, the clean fixture is silent, and no rule throws — that first assertion caught four rules that could never fire. It also caught a false positive in itself: the 7807 rule fired on a document correctly explaining the supersession, now scoped with a negative lookahead and a fixture proving it.Site builds clean; all five base pages render their resources.
🤖 Generated with Claude Code