import { type Plugin } from '../bundle/index.js'; import type { UnknownObject } from '../types.js'; type DereferenceResult = { success: true; data: UnknownObject; } | { success: false; errors: string[]; }; type ReturnDereferenceResult = Opt['sync'] extends true ? DereferenceResult : Promise; /** * Dereferences a JSON object, resolving all $ref pointers. * * This function can operate synchronously (no remote refs, no async plugins) or asynchronously (with remote refs). * If `options.sync` is true, it simply wraps the input in a magic proxy and returns it. * Otherwise, it bundles the document, resolving all $refs (including remote ones), and returns a promise. * * @param input - JSON Schema object to dereference. * @param options - Optional settings. If `sync` is true, dereferencing is synchronous. If `plugins` is provided, those plugins are used for resolution instead of the default `fetchUrls()`. * @returns A DereferenceResult (or Promise thereof) indicating success and the dereferenced data, or errors. * * @example * // Synchronous dereference (no remote refs) * const result = dereference({ openapi: '3.0.0', info: { title: 'My API', version: '1.0.0' } }, { sync: true }); * if (result.success) { * console.log(result.data); // Magic proxy-wrapped document * } * * @example * // Asynchronous dereference (with remote refs) * dereference({ $ref: 'https://example.com/api.yaml' }) * .then(result => { * if (result.success) { * console.log(result.data); // Fully dereferenced document * } else { * console.error(result.errors); * } * }); * * @example * // Asynchronous dereference (with custom loader plugin) * const plugin = { type: 'loader', validate: (v) => v.startsWith('workspace:'), exec: (v) => resolve(v) }; * const result = await dereference({ $ref: 'workspace:my-schema' }, { plugins: [plugin] }); */ export declare const dereference: (input: UnknownObject, options?: Opts) => ReturnDereferenceResult; export {}; //# sourceMappingURL=dereference.d.ts.map