Route request and response shape
Graphvein describes what a route accepts and returns: path, query, header and cookie parameters, the request body, responses and security. Every part says how Graphvein knows it, and a part Graphvein did not read is shown as "not read", never as "none". The model is shared by every framework; the rules are rows SM-1..SM-29 of the route shape claim contract, and the decision is recorded in ADR 0081 ("Shape model").
What is stored
A route node may carry the attribute shape (model version 1). A route
without it has every section not read. The attribute holds:
- seven sections,
path,query,header,cookie,body,responsesandsecurity, each with a state:not_read: Graphvein did not read this part;provably_none: the code proves there is nothing (with the evidence);partial: some items were read and more may exist (with a reason);complete: every item is known, from an enforced declaration or a committed spec;
- items, each with a provenance: its kind, the extractor rule, the source
file and line, the chain of calls followed to reach it, and a confidence:
fact: a typed declaration the framework enforces at runtime;read_in_handler: a name read in the handler or a function it calls, with no type and never required;intended: a static type nothing checks at runtime (a TypeScript generic,as T);returned: the declared type of a returned value, not validated;mapped: from a committed spec or a typed frontend client linked to the route;
security_schemesandmodels(named schemas referred to byref);follow: the depth limit the run used and every followed call chain, with its depth and why it stopped.
Schemas use a small JSON-Schema-like language: object (fields with a
presence each: required, optional or unknown), array, string, number,
integer, boolean, null, enum of literals, a reference to a model, and
unknown with a reason.
The server serves the checked shape on the endpoint detail (shape) and a
compact summary on the endpoint list; see
serve.
Model types
When a section's item was read from a named model (a Pydantic class and
its repository bases, a Go struct and the structs it embeds, a Rust serde
type, a TypeScript interface or type alias, a module-level zod or Joi
schema), the route also lists the model's declaration in the attribute
model_uses and has a uses_model edge to the declaration node, so
change impact reaches the route when the model changes ("through request
body (fact) model UserIn"). Only declarations the extractor itself
resolved, and whose node is emitted, are recorded; each use keeps the
item's section and provenance kind. The rules are rows MT-1..MT-19 of the
route model types claim contract.
An extractor marks a schema node it read from a declaration with the
declaration's identity (Schema.Decls, never stored in the shape) and
calls routeshape.SetModelUses with the shape it stored.
Following calls
Parameters and bodies are often read in functions the handler calls. The
shape extractors follow the handler's values only through proven call
targets (one stored definition), up to a depth limit set by
index.shape_depth in graphvein.yaml or
graphvein index --shape-depth (default 6, from 1 to 10). A chain stops
for one of these reasons, which is stored with it:
| Stop | Meaning |
|---|---|
ended |
the value is not passed on |
depth_cap |
the next call is proven but deeper than the limit: "depth cap reached (N)", raise the setting to follow it |
cycle |
the call returns to a function already on the chain |
joined |
the call reaches a function already read through another chain |
budget |
256 functions were already read for this route |
resolver_error |
reading a function failed (recorded; other chains continue) |
unresolved, ambiguous, external |
the target is not proven: no definition, several, or a library |
transformed, opaque_type |
the value is changed before it is passed on, or its type is any, unknown or generic |
Adding a framework
A framework's shape extractor (for example FastAPI, Express, gin, Axum,
Next.js) uses the shared package internal/extract/routeshape and adds its
own claim table. It never changes the model; if a form needs a claim the
model cannot express, report it as a contract change.
- Claim table. Write the framework's
SH-<family><n>table first (public, underdocs/extract/): one row per code form read, each naming the section, the provenance kind and the model rows it relies on, plus a default row for every form not read. Every hazard of the framework (sequence parameters that are bodies, dependencies reading headers, generics that are not checked, ...) has a row or a refusal. Keep a Go table 1:1 with it and test that. - Build the shape. Start from
routeshape.New(depthLimit)(every sectionnot_read), set only the sections the extractor reads, and give every item arouteshape.ProvenancewhoseRuleis the framework's row. Mark a sectionpartialwith a reason whenever a chain stopped before the end; useprovably_noneandcompleteonly with evidence of kindfactormapped. A name read in code isAccess: ReadByHandler(orReadByDependencywith the chain), presenceunknown, no schema. - Follow calls. Implement
routeshape.Resolverfor the language:Visit(ctx, frame)readsframe.Function, records the reads offrame.Value(withframe.Chainas their provenance chain), and returns the calls through which the value leaves the function. Return a call with an emptyStoponly for a proven target; otherwise return it withStopUnresolved,StopAmbiguous,StopExternal,StopTransformedorStopOpaqueType. Callrouteshape.Follow(ctx, start, depthLimit, resolver)and storerouteshape.Records(section, result)inshape.Follow.Chains. Do the following at link time over cached syntax, so changing the depth needs no re-parse; if parse-time data is needed, cache enough for depth 10 (routeshape.MaxDepthLimit). - Store.
routeshape.ToAttribute(shape)checks every model rule and returns the value forattrs[routeshape.AttributeKey]. If it refuses, store no shape and record a diagnostic; never store a shape that breaks a rule. - Test. A fixture with a golden output for every row, including the
default and every hazard; the framework's oracle where one exists (the
framework's own OpenAPI output, a compiler, a schema library), with any
disagreement treated as a precision stop. Run the extractor over the
corpora and report
routeshape.Stats(Table()): how deep chains go and how many hitdepth_cap, so the default depth is set from data. - Version. Shape extraction changes link output: bump the extractor version as for any extraction change.
Express and Next.js Pages Router API
Rows SH-E1..SH-E36 of the Express shape claim
contract. The extractor runs
after the Express and Next.js linkers (routes.LinkShapes) and stores a
shape on every Express route and every Pages Router API route.
Cached syntax. The TypeScript extractor records, per file, the
parameter-use syntax of its functions and its top-level interfaces and
type aliases (facts.ShapeSyntax, extractor version 54): for each
function, its parameters (names, destructured keys, type annotations),
the type annotation of the const that binds it, its declared return type
and the uses of its parameters: property paths read (directly, through
const aliases or by destructuring), method chains called on them
(res.status(201).json({...})), calls they are passed to, type
assertions, assignments and throw statements. Nothing in it is
resolved; names are resolved and calls followed at link time, so a new
index.shape_depth needs no re-parse.
What is read.
- Path: the parameters of the composed path templates (Express) or of
the file name (Pages), typed string, or an array of strings for an
Express 5 or Pages catch-all; complete when every path has the same
names,
provably_nonewhen the template has none. - Query, headers, cookies, body: names read in the handler and in the
functions it passes the request (or
req.body,req.query, ...) to, never typed or required. Cookies count on Express only whencookie-parseris proven mounted before the route. - Validation that runs: zod
parse(andsafeParsewhose result is tested), Joivalidatewith a tested error andvalidateAsync,celebrateon the route: kindfact, with types and presence from the schema. A throwing validation counts only as a top-level statement of its function, awaited when it returns a promise, before anything may send, and reached through calls that are the same; a tested result counts only in the handler, tested by a top-levelifthat always returns or throws. Anything else isintended. Joi types that Joi converts by default (number,boolean) are typed only withstrict(); a Joi body schema notrequired()at its root claims no presence unless an Express 4 JSON parser runs first. express-validator chains on the route only name fields. - TypeScript types (
Request<P, ResBody, ReqBody, Query>,RequestHandler<...>,as T, typed callee parameters): kindintended, as models built from repository interfaces and type aliases. - Responses:
res.status(n)chains,sendStatus,redirect, and a send without a status as 200 only when nothing read, and no middleware that is not read, may set another status;res.jsonclaimsapplication/jsonexcept for 204 and 304, and on Express only when the code read sets no Content-Type. Middleware is read too: a known library or a function that uses the response only for sends that end the request (an auth check answering 401 or 403) changes nothing; any other middleware may change the status, the Content-Type or the body, so none of them is claimed; inline object literals give the field names; a const holding a proven callee's result gives its declared return type (kindreturned). Thrown errors andnext(err)keep the section partial.
Hazards. A mounted express-openapi-validator and the body parsers
are noted in the sections' reasons (the committed spec, shown as
mapped by its own rows, decides the shape there). A Pages Router API
route is one route for every method, so the reads of all req.method
branches are merged. Path parameters a Pages handler reads through
req.query stay path parameters.
Next.js App Router route handlers and server actions
Rows SH-N1..SH-N29 of the Next.js route shape claim
contract. The same linker as the
Express rows (routes.LinkShapes) stores a shape on every App Router route
(framework: nextjs) and every Next.js server_action node; the Pages
Router API keeps the Express rows.
Cached syntax. The TypeScript shape payload (above) also records, from
extractor version 57: the Fetch API body readers as parameter paths
(await request.json() is the path json(), formData(), text(),
arrayBuffer(), blob(); request.clone() is the request), new URL(request.url) as the path url.URL(), zero-argument calls of
headers() and cookies() as values of their own, calls of notFound,
redirect, permanentRedirect, forbidden and unauthorized, and the
return statements of a function (the returned expression, the
initializer of a returned const and the arguments of the returned call
or construction). Returns are kept for functions named like an HTTP
method, functions of a 'use server' file or with the directive, and
functions with other recorded uses; in any other function only returns
that build a response (Response.json, new Response, NextResponse.*)
are kept. Names are resolved at link time (headers must be the import of
next/headers, Response the global, NextResponse the export of
next/server).
What is read.
- Path: the parameters of the route template, strings, an array of
strings for a catch-all; an optional catch-all is partial. The
paramsannotation is never read (hazard H15). - Query, headers, cookies: names read with
get,getAllorhasonrequest.nextUrl.searchParams,new URL(request.url).searchParams,request.headers,request.cookies, and onawait headers()andawait cookies()ofnext/headers(an un-awaited call claims no name and no response: Next.js 16 throws on it), in the handler and the functions it passes the request (or one of these values) to; never typed or required. A value iterated, passed to an unread function or written leaves the section partial; a written one keeps no name. - Body: fields read on the parsed JSON body (
const b = await request.json(), destructuring) and onformData(); content type null (json()parses whatever the Content-Type says). zodparseand a testedsafeParseof the JSON body follow the Express enforcement rules (a top-level statement, awaited, before any return that may have answered, outsidetry; a tested result in the handler): kindfact; a failed parse makes Next.js answer 500. Anything else isintended, as areas Tcasts and typed callee parameters. - Responses: the handler's returns.
Response.jsonandNextResponse.jsongive their status (200 by default) andapplication/jsonunlessinit.headersis not a literal object or sets a Content-Type;new Responseandnew NextResponsegive their status, an empty body fornull,text/plain;charset=UTF-8for a string literal and a literal Content-Type header;NextResponse.redirectgives 307 andResponse.redirect302 by default, only for a URL proven absolute (a relative one makes both throw);notFound(),redirect()andpermanentRedirect()ofnext/navigationgive 404, 307 and 308 with an empty body, only in a function's own body (not in a nested function or callback) and when no call site on the way from the handler is insidetryor a promise chain, which may catch them. A returned call of a proven function is followed and its own returns read. Statuses a form refuses (a body with 204, a redirect with 200,Response.json(undefined)) are not claimed. A middleware or proxy file whose matcher may cover the route (only a literal string matcher can exclude it), or next.configredirects,rewritesorheaderswhose literal source may match it (or that are not read), may answer or add headers: no status the code does not write is claimed, and no content type or body. A config redirect or applicable rewrite withouthasormissingwhose source covers the whole route answers it before the handler: no response is claimed. Aheadersrule whose header names are all read literals, none of them Content-Type, Content-Length, Content-Encoding or Transfer-Encoding in any case, only adds response headers and changes no claim. Rule and header lists may be grown withpush(), spread orconcat(). A file that exportsdynamic = 'force-static'(or adynamicthat is not a string literal) hands its handlers an empty query, headers and cookies and may answer from a build-time render (dynamic = 'error'makes Next.js 14 throw on any read of the request, the body included): no name read there is claimed, and no response either when the handler uses any of those values. - Server actions: path and query are not read (an action is a POST to the
page that renders it); a
FormData(or untyped) parameter's fields read form the body; one typed parameter gives anintendedbody with its type, and a zod parse of it afact: the arguments travel as a list, and the schema describes argument 1 only (further arguments are not checked); results (returned object literals, the declared return type) are responses with statusdefaultand no content type: the result is not an HTTP response of its own.
Security. Next.js route handlers: see "Security beyond FastAPI" below.
Not read. Joi and other validators, streamed
responses, NextResponse.next() and rewrite(), other route segment
config (revalidate, runtime, dynamic 'auto' or 'force-dynamic';
the handler sees the request as sent), redirects and
notFound() in server actions, several typed action arguments.
The oracle scripts/oracle/nextjs_shape builds the fixture
testdata/fixtures/nextjs-shape with Next.js 14.1.0, 15.5.4 and 16.2.10,
serves it on 127.0.0.1 and drives every claimed status, content type and
empty body, the requests a fact body must refuse and accept, the server
actions through their action ids, and compares the zod schemas
(toJSONSchema) and the TypeScript checker's view of every name read and
every model.
Axum
The Axum shape extractor reads Axum routes (axum 0.3 to 0.8). Its rows
are SH-X1..SH-X29 of the
Axum route shape claim contract.
- What is read. The handler is the function or method the route
names; inline closures and services are not read. Every Rust file whose
text mentions
axum,serdeorhttpcaches its type declarations (serde derives and attributes, fields, generics, aliases) and its functions' signatures, returned expressions and request value uses (Rust payloadRustShapeversion 2), so the shape is built at link time and a new--shape-depthneeds no re-parse. - Parameters. The route's template gives the path parameters
(required facts);
Path<T>types them by position (scalar, tuple) or by serde field name (struct).Query<T>andForm<T>onGET(axum's form extractor reads the query onGETonly, also forHEADroutes) give declared query parameters from the struct's fields: required unlessOptionordefault, typed only when serde_urlencoded reads the type from one value (scalars, unit enums and newtypes of them).Form<T>on a route answering several methods (any) may read the query or the body: both stay partial.TypedHeader<T>of a known headers type gives a required header (optional insideOption).HeaderMapreads (get,get_all,contains_keywith a literal, anhttp::headerconstant or a string constant) give names read in code, never typed or required, also when read by a repositoryFromRequestPartsorFromRequestextractor (then "read by a dependency"). Any other use of a request or parts value (its URI,parts.extract::<..>(), a value stored or rebound), and any followed chain of one that is cut (depth cap, a callee not read), leaves the query, cookies and body partial. - Bodies.
Json<T>(application/json) andForm<T>(application/x-www-form-urlencoded) give the serde schema ofTas a fact;StringandBytesa body of any content type. Only one extractor reads the body (hazard H16). - Types. serde's derive is read:
rename,rename_all(serde's own per-character rules),alias,default,skip*,skip_serializing_if,deny_unknown_fields,Option, unit enums, generic structs instantiated at the use and type aliases expanded. A type without the derive (a custom implementation),with/serialize_with/deserialize_with,flatten, tagged or untagged enums, enums with data and library types other thanUuidand chrono dates areunknownwith the reason (hazard H17;validatorconstraints are not read). So is a type carrying an attribute that may rewrite serde's view and is not read (serde_as, acfg_attrapplyingserdeor a derive, any attribute macro outside a short inert list). Serialized floats are nullable (serde_json writes NaN asnull). - Responses. A declared
Json<T>,String,Html<T>,StatusCodeor(StatusCode, T), and forimpl IntoResponsethe returned expressions (Json(value),(StatusCode::X, ..),StatusCode::X,Redirect::temporary/permanent, string literals, calls followed into the callee).Result<T, E>: theOkvalues asT;Err(E::V)takes the status of variantVwhen every result ofE'sIntoResponseimpl that can answer forV(throughmatch selfarms, also in a status method) is the sameStatusCodeconstant and no such arm has a guard. AResultwhose values are allErrclaims noOkresponse. Values with the same status and content type but different schemas give anunknownschema. A tuple's header parts may set the content type: it is claimed only from a literalcontent-typepart or when no part sets it. Text content types depend on the axum version (text/plainin 0.3,; charset=utf-8since 0.4) and are claimed only when the version is proven fromCargo.lockorCargo.toml. Errors returned with?, panics and extractor rejections are not read: the responses section is always partial.Redirect::tochanged status between axum versions and is not claimed. - Calls. A request value (
HeaderMap, the request, an extractor's parts) or a returned call is followed when the call's target resolves to one repository function or method (helpers::f,Self::f,self.f()); methods of other values areunresolved, library functionsexternal, and a name the function binds itself (a local closure, a parameter) never resolves to an item of that name. - Security. See "Security beyond FastAPI" below.
- Not read. Cookies, middleware (layers) other than for security,
extractor rejection statuses,
Option/Result-wrapped extractors other thanOption<TypedHeader<T>>, and library extractors such asMultipartorCookieJar.
The oracle scripts/oracle/axum_shape builds the fixtures
testdata/fixtures/route-shape-axum (axum 0.8.8) and
testdata/fixtures/route-shape-axum03 (axum 0.3.4) with the real crates
(the fixture testdata/fixtures/route-shape-axum-versions covers the
version reading and is golden-only),
serves them on 127.0.0.1 and compares every claimed status, content type,
required and optional field and parameter, type, enum and closed object
with real requests and serde_json output.
FastAPI
The FastAPI and Starlette shape extractor reads rows SH-F1..SH-F39 of the
FastAPI route shape claim contract.
It follows FastAPI 0.161.1's own rules, checked against FastAPI's
app.openapi() and a TestClient run on the fixtures
testdata/fixtures/route-shape-fastapi,
testdata/fixtures/route-shape-fastapi-handlers,
testdata/fixtures/route-shape-fastapi-unpack and
testdata/fixtures/route-shape-fastapi-assign
(scripts/oracle/fastapi_shape.sh). Rules that depend on the FastAPI
version (return annotations validated from 0.89.0, form models from
0.113.0) apply only when the nearest pyproject.toml requiring fastapi
proves the version with a lower bound.
- Cached syntax. Files that import
fastapi,starlette,pydanticorsqlmodel(gate SG) cache their function signatures, the body sites that can add to a shape (raises, returned calls, calls that pass the request on, names read on the request) and the members of classes with bases. A call into any other file is a proven target whose body is not read: its chain stops withresolver_errorand the sections stay partial. Exception handler registrations androute_classanddefault_response_classassignments are cached in every Python file. - Parameters. The handler and its dependency tree (
Depends()andSecurity()on functions and classes with__init__,Annotatedaliases, and thedependencies=lists of the route, routers,include_routerand the app) are classified as FastAPI does: a name in the path template is a path parameter, a scalar a query parameter, a sequence or model a body field (alist[UUID]withoutQuery()is body, not query), markers decide the rest. Framework values (Request,Response,BackgroundTasks, ...) are classified by annotation, never by name.UploadFileand sequences of it are file fields; aForm()parameter typed with a model is that model's fields.Annotatedmetadata other than constraints,AfterValidatorand documentation (aBeforeValidator, ...) makes the type unknown, as do Pydantic before/wrap/plain field validators,populate_by_namewith an aliased field and an enum's_missing_. When the whole tree is read, an empty section isprovably_none. Readingrequest.urlorrequest.stateleaves the sections partial. - Names read on the request.
request.headers["X"],.get("X"), cookies, query and path parameters read in the handler or a dependency (or a function the request is passed to) are listed as "read by the handler" or "read by a dependency": never typed, never required, never OpenAPI parameters. Security scheme credentials (theAuthorizationheader of an OAuth2 scheme) are in the security section, not the header section. - Responses. The success status and model come from
status_code=(else the response class's default: 307 forRedirectResponse),response_model=(which overrides the return annotation) or the return annotation (factwhen the manifest proves FastAPI 0.89.0, elsereturned). The success item isfactonly when every return of the handler is proven not to be aResponseobject (FastAPI sends one as is); otherwise it isintended.response_model_include,_exclude,_exclude_noneandby_alias=Falsemake the success schema unknown; generator handlers (streamed) have anintendedsuccess item without a content type.responses=entries are documentation (kindintended);raise HTTPException(status_code=n)in the handler, a dependency or a followed function adds statusnunless it is insidetryor after ayield; the 422 validation error is stated for routes that declare a parameter or body,factonly when some declared item can fail validation. Project exception handlers forHTTPExceptionorRequestValidationError(and anyFastAPI(**options), which may pass them) lower those statuses tointended; a customroute_classon the route's router lowers every fact of the route. Adefault_response_class(or keyword unpacking, which may pass one) applies to the routes the object serves, as FastAPI resolves it: the routes registered on it and on every router included into it, directly or through other routers, and the routes of the router aninclude_router(...)call with one includes. Those routes get no success content type, and no default success status unless the class is FastAPI's or Starlette's with status 200; other routes keep theirs. Anyx.default_response_class = ...assignment makes every route's default success status and content type not read (object and order not modelled). The section is always partial: middleware is not read. - Security. Schemes come from the route's security dependency facts
(
docs/extract/auth.md) and are stated only with every field their type needs; FastAPI's ownOAuth2PasswordBearerwith a computedtokenUrlis stated withtoken_urlnull. A repository subclass of a scheme class is not stated: its own__call__is followed as a dependency. The route's requirement holds all its schemes,intendedwhen a scheme hasauto_error=False. - Chains. The dependency tree is recorded under section
query, a request value under the section it reads (headerfor the request object) and returned values underresponses.
gin, chi and net/http
The Go shape extractor reads gin v1, chi v5 and net/http routes. Its rows
are SH-G1..SH-G38 of the
Go route shape claim contract.
- What is read. The handler is the route's function, method or
function literal. Every function that declares a parameter of type
*gin.Context,*http.Requestorhttp.ResponseWriterhas its calls cached (Go payload version 10), so the shape is built at link time and a new--shape-depthneeds no re-parse. - Parameters.
c.Param,chi.URLParam,r.PathValue,c.Queryand its variants,r.URL.Query().Get,r.FormValue,c.GetHeader,r.Header.Get,c.Cookieandr.Cookiegive names read in code: never typed, never required. Astrconvparse of the value is noted by its row (SH-G4), not as a type. Names may come from a literal, a package string constant or a helper's caller (withID(c, "id", ...)). - Bodies.
c.ShouldBindJSON(&v)andc.BindJSON(&v)give the type ofvas afactwhen gin enforces it (BindJSON, or an error checked with areturn), withbinding:"required"fields required; an unchecked bind isintended.json.NewDecoder(r.Body).Decode(&v)is read the same way, without required fields. gin'sBindandShouldBindchoose the binder from the Content-Type, so their content type is not read (hazard H18); on aGETroute they bind the query.ShouldBindQueryandShouldBindUrigive declared query and path parameters from theformanduritags. - Responses.
c.JSON,c.String,c.Status,c.AbortWith...,w.WriteHeader,http.Error,http.NotFound,http.Redirectandjson.NewEncoder(w).Encode(v)give statuses (literals,net/httpconstants or a caller's argument) and bodies of kindreturned. AnEncodewithout an earlierWriteHeaderis200only in the handler itself and only when nothing else wrote to the writer first. - Types. Struct fields follow encoding/json (json tag names,
-,omitempty, thestringoption, embedded structs with Go's dominance rules). A type with a marshaling method, a generic, an interface, a type outside the repository or a recursive reference isunknownwith the reason. - Calls. A call that passes a request value is followed when its
target is proven: a module function, a method of the function's own
receiver type or of a variable's declared concrete type. A method of an
interface is
ambiguous; library functions areexternal. - Security. From the route's middleware and its router-level
middleware (attribute
group_middleware); see "Security beyond FastAPI" below. - Not read. Middleware other than for security,
c.XMLand the other gin renderers,w.Write, and the routes of oapi-codegen generated servers, whose sections say "generated from spec" (the committed spec is their shape source).
The oracle scripts/oracle/go_shape compiles the fixture
testdata/fixtures/go-shape with the real encoding/json, gin and chi and
compares the claimed field sets, types, presences, statuses and binds with
real marshaling and real responses on 127.0.0.1.
Security beyond FastAPI
Rows SH-S1..SH-S24 of the route security claim
contract fill the security
section of Express, Axum, gin, chi and Next.js App Router routes from a
closed list of auth libraries whose credential form is fixed or read from
literal options. Custom auth (a repository middleware, an axum from_fn,
gin-jwt, a session the library names from its configuration) states no
scheme: it stays as written in the route's middleware attributes, and a
section with no source stays not_read.
- Express. The route's
mounted_middleware(every chain, root first) and its own middleware arguments, in order: express-jwt (Bearer;getTokenmakes the scheme unknown,credentialsRequired: falsethe requirement intended), express-oauth2-jwt-bearer (Bearer or theaccess_tokenquery parameter; the body form keeps the section partial), express-basic-auth (Basic),passport.authenticatewith the strategy itspassport.useregisters (passport-jwt'sfromAuthHeaderAsBearerToken,fromHeaderwith a lower-case name andfromUrlQueryParameter; passport-http-bearer; passport-http Basic; a strategy whose registration or class is not read, or a strategy list, is an intended requirement, and the built-insessionstrategy states none) and express-openid-connect'srequiresAuth()(a session cookie: scheme unknown; with arequiresLoginCheckargument the requirement is intended). The section is complete when every other middleware is on a closed list of libraries that never refuse for credentials (cors, helmet, morgan, compression, the parsers, celebrate, express-validator) and no mounted middleware is unknown. - Axum.
TypedHeader<Authorization<Bearer>>and<Basic>extractors (Optionmakes the requirement intended), tower-httpValidateRequestHeaderLayer::bearerand::basiclayers, axum-login'slogin_required!(scheme unknown). Always partial: layers outside the router are not read. - gin and chi. The Go route linker stores router-level middleware on
routes:
group_middleware(a ginUseorGroupargument, a chiUseor aWithabove the route,gin.Default's Logger and Recovery, applied when it is registered before the route or the child router that leads to it, in the same function, unconditionally, or in a function called with the router before that point) andgroup_middleware_unknown(order not proven, conditional, in a function holding agotoor labeledbreakorcontinue, on some chains only, a router served through a wrapper). A chi route whose method and full path another route of the same served router has may not serve it (chi keeps the last registration and prefers a parent's static route to a mounted router's): its section is never complete and its requirements are intended. gin'sBasicAuthandBasicAuthForRealm, chi'smiddleware.BasicAuthand jwtauth'sVerifier/Verifywith a laterAuthenticator(Bearer, or thejwtcookie or query parameter) are read; complete when every other middleware is gin's Logger or Recovery or chi's Logger, Recoverer, RequestID or RealIP. - Next.js.
getServerSessionof next-auth 4 in a route handler: a session cookie whose name depends on the configuration (key name not read), requirement intended. next-auth 5'sauth()exported by destructuring is not resolved. - Generated document. A complete section of fact requirements with
complete schemes becomes the operation's
securityandcomponents.securitySchemes(OG-87); everything else stays inx-graphvein.shape.
The oracle scripts/oracle/route_security serves the fixture
testdata/fixtures/route-shape-security with the real libraries (Express
4.21.1 and the npm versions its package.json pins, gin v1.12.0, chi
v5.5.0, jwtauth v5.4.0, axum 0.8.8, axum-extra 0.10.3, tower-http 0.6.8) on
127.0.0.1 and checks that a request with each claimed requirement's
credentials reaches the handler and that one without them (or missing one
scheme of a requirement) does not.
Committed specs
A route documented by a committed OpenAPI 3.0, 3.1 or 3.2 or Swagger 2.0
operation (one inferred documents_route edge of the
OpenAPI import, exact matches only) also shows what that
operation says: rows SH-O1..SH-O19 of the
committed spec claim contract.
The items are added at link time, after every framework stored its own
shape, and no syntax is cached.
- Kind. Every item, scheme and model from a spec is
mapped, with the link's confidence (0.9, or 0.7 when the spec's server names an origin) and the spec file and line it was read from; schema models are named by their file and JSON pointer. Nothing from a spec is afact. - Side by side. The code's items, states and models are never
changed. A section the code did not read and the spec fills becomes
partialwith the reason "not read in the code: every item is mapped from the committed spec"; a section the code read keeps its state and takes the spec's items beside its own; aprovably_nonesection takes none. A route documented by several operations takes none. - Spec differs. Where a code fact and the spec contradict each other
(a parameter's presence or type, parameter names of a proven section, a
body where the code proves none, a success status the spec does not
document, authentication), the section's reason says "spec differs:"
and what differs. Graphvein never decides which side is right. Media
types compare by type and subtype without parameters, and a media range
such as
*/*covers what it names. - What is read. Parameters (merged from the path item, with
OpenAPI's ignored headers left out), request bodies per media type and
whether the spec requires one (in the reason: the model has no body
presence), responses per status and media type (a response without
content is the empty body), security requirements and schemes. Schemas:
types,
nullable(3.0), type lists and anullmember ofanyOforoneOf(3.1; aoneOfonly when its other member rejects null), enums andconst(a number float64 would change makes the enumunknown), object fields withrequired,additionalProperties, arrays, references within the document (cycles end at the model; a cycle of references alone isunknown, "reference cycle") and a singleallOfmember. A field markedreadOnlyorwriteOnlyanywhere its type is read through has presenceunknown, and the section's reason says so: the shape keeps one view of a schema for requests and responses. Other compositions, discriminators, conditionals, references to other documents and anything deeper than 32 levels areunknownwith the reason. Swagger 2.0 response keys such as2XXare not stored (ranges are OpenAPI 3). - Generated document. The generated OpenAPI
document still describes the
code only: mapped items stay in
x-graphvein.shape.not_standard, and a section filled only by the spec reads as not read there. The Explorer shows mapped items with their chip and the notes under each section.
Report a problem with this pageSource: docs/extract/route-shape.md