schema-components - v3.7.0
    Preparing search index...

    Interface ResolveRefChainOptions<T>

    Configuration for a single chain resolution.

    lookup(ref) returns the dereferenced node for a given $ref string, or undefined when the ref cannot be resolved. The chain follows further $ref indirection on the returned node until either:

    • The node is not a ref wrapper (final value reached) → returns the node.
    • The same ref string is encountered twice → calls onCycle(ref).
    • The hop count exceeds maxHops → calls onDepthExceeded(ref).
    • lookup returns undefined → returns undefined.

    Callers decide whether onCycle / onDepthExceeded should throw, emit a diagnostic, or return a fallback value.

    interface ResolveRefChainOptions<T> {
        lookup: (ref: string) => T | undefined;
        extractRef?: (node: T) => string | undefined;
        onCycle?: (ref: string) => T | undefined;
        onDepthExceeded?: (ref: string) => T | undefined;
        maxHops?: number;
        visited?: Set<string>;
    }

    Type Parameters

    • T
    Index

    Properties

    lookup: (ref: string) => T | undefined

    Resolve a $ref string to its target node, or undefined.

    extractRef?: (node: T) => string | undefined

    Extract a $ref string from a node, or undefined when the node is not a ref wrapper. The default reads node.$ref when node is an object with a string $ref property.

    onCycle?: (ref: string) => T | undefined

    Called when a previously-visited $ref is encountered. Returns the value the resolver should return in place of further resolution.

    onDepthExceeded?: (ref: string) => T | undefined

    Called when maxHops is exceeded. Returns the value the resolver should return in place of further resolution.

    maxHops?: number

    Maximum number of $ref hops permitted before onDepthExceeded fires. Defaults to MAX_PATH_ITEM_REF_HOPS from core/limits.ts, the canonical cap shared with the OpenAPI Path Item ref walker.

    visited?: Set<string>

    Pre-seeded visited-set. Useful when the caller has already followed one or more hops outside this helper.