Resolves an OpenAPI ref string to its JSON Schema, then parses it.
SOURCE-OF-TRUTH: mirrors runtime resolveRef in
packages/core/src/core/ref.ts (line 90), which is invoked by the
walker entry point in packages/core/src/core/walker.ts (lines
144-154) for OpenAPI documents. Any change to the runtime ref-resolution
rules (new ref forms, different cycle handling, JSON Pointer decoding)
must be reflected here and pinned in
packages/core/tests/typeInference-walker-parity.test.ts.
Handles:
#/components/schemas/Name (OpenAPI 3.x)
#/definitions/Name (Swagger 2.0)
#/paths/... (path-based refs, navigating the document tree)
When the resolved schema itself contains nested $refs, the helper
seeds FromJSONSchema's Defs parameter with the document's
components.schemas (OAS 3.x) and definitions (Swagger 2.0) maps
so the nested refs resolve correctly. Depth is threaded too so the
recursion budget is shared with the calling context. Earlier
revisions called FromJSONSchema<...> with the empty defaults and
silently produced unknown for any nested ref.
Resolves an OpenAPI
refstring to its JSON Schema, then parses it.SOURCE-OF-TRUTH: mirrors runtime
resolveRefinpackages/core/src/core/ref.ts(line 90), which is invoked by the walker entry point inpackages/core/src/core/walker.ts(lines 144-154) for OpenAPI documents. Any change to the runtime ref-resolution rules (new ref forms, different cycle handling, JSON Pointer decoding) must be reflected here and pinned inpackages/core/tests/typeInference-walker-parity.test.ts.Handles:
#/components/schemas/Name(OpenAPI 3.x)#/definitions/Name(Swagger 2.0)#/paths/...(path-based refs, navigating the document tree)When the resolved schema itself contains nested
$refs, the helper seeds FromJSONSchema'sDefsparameter with the document'scomponents.schemas(OAS 3.x) anddefinitions(Swagger 2.0) maps so the nested refs resolve correctly.Depthis threaded too so the recursion budget is shared with the calling context. Earlier revisions calledFromJSONSchema<...>with the empty defaults and silently producedunknownfor any nested ref.