OapiCodemode.Ingest.Deref (oapi_codemode v0.5.0)

Copy Markdown View Source

Resolves all same-document $refs inline, in one pass over a whole document.

The parity oracle — tests only. Nothing on the request path calls this any more: OapiCodemode.Ingest.decompose/1 stores refs intact and OapiCodemode.Resolve follows only the ones the operation being read needs. What this module is still for is being the other implementation the resolve suite checks against, so a change to lazy resolution has to answer for any difference from the whole-document expansion 0.4.0 shipped (test/oapi_codemode/resolve_parity_test.exs, which also documents the two licensed divergences). Do not reach for it in library code.

Circular refs become %{"$circular" => name}; external or dangling refs become %{"$unresolved" => ref} — the markers Resolve still emits.

A ref's expansion is memoized by pointer, but only cached when it completed without producing a $circular marker anywhere inside it — a cycle-hitting expansion is stack-dependent (its shape depends on which refs are currently being expanded above it) and must be recomputed for every call site.

One sanctioned production caller exists for the length of Gentility's release A: Integrations.ingest_spec/1 measures the dereferenced size at acceptance so pre-A nodes never meet a document they cannot expand. That call dies with the legacy jsonb columns in release B; after that this is tests-only again.

Summary

Functions

dereference(spec)

@spec dereference(map()) :: map()