Pure pipeline from raw spec source to something storable.
decompose/1 takes a document apart into %OapiCodemode.Decomposed{} —
canonical evidence, the document's own fields, this decomposer's
projection, one entry per operation and one per component — and inlines
nothing. Read-time resolution is OapiCodemode.Resolve's job, against
whatever OapiCodemode.SpecStore the pieces were put into.
Pure by design, so that a build-time mix task and runtime registration are thin callers of the same function.
Summary
Functions
The component kinds decomposition keeps, and therefore the kinds a store holds.
Takes a raw OpenAPI 3.x document apart into %Decomposed{}.
The decomposer version stored alongside every projection.
The slim-index entry for one operation.
Functions
@spec component_kinds() :: [String.t()]
The component kinds decomposition keeps, and therefore the kinds a store holds.
Read-time resolution needs the same list to decide which $refs are a bulk
SpecStore.components/3 read and which have to go the slow way through
SpecStore.pointer/4: a ref to #/components/examples/Sample is not a
stored component, so asking for it as one would answer $unresolved for
something the document plainly has. One list, two readers.
@spec decompose(String.t()) :: {:ok, OapiCodemode.Decomposed.t()} | {:error, term()}
Takes a raw OpenAPI 3.x document apart into %Decomposed{}.
Refs that decide which operations exist and how they are addressed are
resolved here — Path Item $refs, so every operation becomes a row;
security-scheme references, because the proxy consumes schemes directly;
and parameter references, identity-only (see Normalize). Refs that
describe payload shapes stay exactly as the document wrote them, the
requestBody node included: OapiCodemode.Resolve resolves it and then
chooses its media type, so an inline body and a referenced one go through
one implementation rather than two.
@spec decomposer_version() :: pos_integer()
The decomposer version stored alongside every projection.
@spec index_entry(OapiCodemode.Operation.t()) :: map()
The slim-index entry for one operation.
This is the definition of an index entry, not a copy of one: the
registry's index builder must call this function when it splices the
search index into the sandbox, so that the index_bytes measured at
ingest are the bytes actually spliced. Two independent copies of this
shape would let the cap enforced here guard a number nobody sees.
A pure projection of the operation row: every value here is a field of
%OapiCodemode.Operation{} as stored, under the key the sandbox reads it
by. Nothing is filtered or recomputed on the way out — a parameter whose
identity could not be resolved is already absent from param_index, which
OapiCodemode.Ingest.Normalize decided when it built the row. That is
what lets a store persist param_index and hand it straight back.