/** * $ref Resolution Utilities for JSON Structure * * Handles resolution of $ref references within JSON Structure schemas. */ import type { JSONStructureSchema, TypeDefinition, Namespace, TypeReference } from './structure-types'; /** * Parse a $ref path into segments * Examples: * "#/definitions/Address" -> ["definitions", "Address"] * "#/definitions/Types/Email" -> ["definitions", "Types", "Email"] * "Address" -> ["definitions", "Address"] (shorthand) */ export declare function parseRefPath(ref: string): string[]; /** * Resolve a $ref path to its definition within the schema */ export declare function resolveRefPath(schema: JSONStructureSchema, segments: string[]): TypeDefinition | Namespace | undefined; /** * Resolve a $ref string to its type definition */ export declare function resolveRef(ref: string, schema: JSONStructureSchema): TypeDefinition | undefined; /** * Resolve a TypeReference object to its type definition */ export declare function resolveTypeReference(ref: TypeReference, schema: JSONStructureSchema): TypeDefinition | undefined; /** * Check if a definition contains a $ref and resolve it if so * Returns the resolved definition merged with any sibling properties */ export declare function resolveDefinitionRef(definition: TypeDefinition, schema: JSONStructureSchema): TypeDefinition; /** * Track visited refs to detect circular references */ export declare class RefResolver { private readonly schema; private readonly visited; constructor(schema: JSONStructureSchema); /** * Resolve a reference, tracking visited refs to prevent infinite loops */ resolve(ref: string): TypeDefinition | undefined; /** * Resolve a type definition, handling any $ref in its type specifier */ resolveDefinition(definition: TypeDefinition): TypeDefinition; /** * Reset the visited tracking (use between independent resolution calls) */ reset(): void; } /** * Create a ref resolver for a schema */ export declare function createRefResolver(schema: JSONStructureSchema): RefResolver;