UNPKG

json-machete

Version:
27 lines (26 loc) 1.11 kB
export declare const resolvePath: (path: string, root: any) => any; export declare function getAbsolutePath(path: string, cwd: string): string; export declare function getCwd(path: string): string; /** Maps $id URIs to schema nodes and $id#anchor compound keys to anchored sub-schemas. */ interface SchemaIndex { ids: Map<string, any>; anchors: Map<string, any>; } /** * Walks an object graph and resolves every $ref in-place on its parent. * Tries three strategies in order: the schema index ($id/$anchor), * external file/URL loading, and same-document JSON Pointer. */ export declare function dereferenceObject<T extends object, TRoot = T>(obj: T, { cwd, externalFileCache, refMap, root, debugLogFn, readFileOrUrl, resolvedObjects, schemaIndex: schemaIndexOpt, }: { cwd?: string; externalFileCache?: Map<string, any>; refMap?: Map<string, any>; root?: TRoot; debugLogFn?(message?: any): void; readFileOrUrl(path: string, opts: { cwd: string; }): Promise<any> | any; resolvedObjects?: WeakSet<any>; schemaIndex?: SchemaIndex; }): Promise<T>; export {};