Skip to content

2404 stack 3 document metadata and paths - #2446

Open
correct-horse-battery-bench wants to merge 3 commits into
2404-stack-2-commit-generated-specfrom
2404-stack-3-document-metadata-and-paths
Open

2404 stack 3 document metadata and paths#2446
correct-horse-battery-bench wants to merge 3 commits into
2404-stack-2-commit-generated-specfrom
2404-stack-3-document-metadata-and-paths

Conversation

@correct-horse-battery-bench

@correct-horse-battery-bench correct-horse-battery-bench commented Aug 18, 2026

Copy link
Copy Markdown
Contributor
  1. Add license to the info field in the spec
  2. Previously paths had slim pattern in there with regex
    /api/v2/ui/crackertypes/{id:[0-9]+}/{relation:crackerVersions}
    Make sure the paths are valid:
    /api/v2/ui/crackertypes/{id}/{relation}
  3. add better tag descriptions, tags are used by generators to group api operations as well as for swagger sidebar info about a specific route

@correct-horse-battery-bench
correct-horse-battery-bench force-pushed the 2404-stack-3-document-metadata-and-paths branch from 1126005 to 53f588a Compare August 18, 2026 07:44
@correct-horse-battery-bench
correct-horse-battery-bench marked this pull request as ready for review August 18, 2026 14:10
…izer

Title and version were built by SpecBuilder, while description and contact were
filled in afterwards by SpecSanitizer. The two halves of the same info object
lived in different classes, and the raw spec (which the builder tests and the
fixtures compare against) was missing them.

Build the whole info object in SpecBuilder, so both spec variants identify the
API the same way, and state the license of the server beside them, which neither
half carried before. The sanitizer no longer touches info at all.

Move the coverage accordingly: the SpecSanitizerTest case is replaced by one
FullSpecTest case asserting the info of both variants. The fixtures now carry
the full info object, and the published spec gains the license.
The generator keyed its paths by the raw Slim pattern, constraints and all
("/api/v2/ui/configs/{id:[0-9]+}/{relation:configSection}"), and SpecSanitizer
rewrote them into path templates as one of its phases. Everything in between
therefore worked on strings that are not valid OpenAPI paths: StaticFragments
had to spell out a regex constraint to hit the right path item, and the raw
spec the builder tests and fixtures assert against was never a valid document.

Translate the pattern into a path template in RouteIntrospector, where the
route is resolved, and carry both on RouteTarget. The path template is what the
spec is keyed by; the raw pattern stays available because a constraint encodes
more than a validation rule, namely the relation name of a relationship route,
which ModelApiPathBuilder still reads from it.

Consequently the sanitizer loses its path cleaning phase (the remaining phases
are renumbered) and StaticFragments addresses the importFile paths by template.

The relationship routes of one model collapse into a single templated path item
now, which is what the sanitized spec always contained, so openapi.json is
unchanged; the fixtures show the collapse because they snapshot the raw spec.

RouteIntrospectorTest covers the translation, including the balanced braces of
a quantifier inside a constraint, which the two removed sanitizer cases used to
cover.
The sanitizer collected the tag names of all operations and declared each as a
bare name. A reader of the document, and every tool that renders it, was left
with a heading and nothing under it, which is also what Redocly reported as its
tag-description warning.

Derive the description from the operations carrying the tag: the collection they
are served under, and whether that collection can be modified, which follows
from the methods those operations use. The tags that do not describe a resource
collection (Helpers, Login, Authentication) are named explicitly.
@correct-horse-battery-bench
correct-horse-battery-bench force-pushed the 2404-stack-3-document-metadata-and-paths branch from 53f588a to 3283eda Compare August 18, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants