import { type DynamicScope } from '../../../helpers/dynamic-ref.js'; import type { SchemaObject } from '../../../schemas/v3.2/strict/openapi-document.js'; import { EXAMPLE_EVALUATION, type ExampleEvaluationState } from './example-evaluation.js'; /** Select a composition branch once for both generated values and supplied example metadata. */ export declare const selectExampleComposition: (schema: SchemaObject, schemaPath: string[], options?: GetExampleFromSchemaOptions, arrayItem?: boolean, value?: Record) => SchemaObject | undefined; /** Options shared by data generation and schema-aware serializers. */ export type GetExampleFromSchemaOptions = { /** Declared document version; absent means a standalone modern schema. */ openapiVersion?: string; /** Original version when a loader upgraded the document. */ originalOpenapiVersion?: string; /** Default dialect, overridden by a schema resource's $schema. */ jsonSchemaDialect?: string; /** Internal provenance capture, excluded from persistent result caches. */ [EXAMPLE_EVALUATION]?: ExampleEvaluationState; /** Preserve binary filename examples as File objects for multipart serializers. */ binaryAsFile?: boolean; /** Fallback string for empty string values. */ emptyString?: string; /** @deprecated Use getXmlExampleFromSchema for schema-aware XML serialization. */ xml?: boolean; /** Whether to show read-only/write-only properties. */ mode?: 'read' | 'write'; /** Dynamic variables which can replace values via x-variable. */ variables?: Record; /** Whether to omit empty and optional properties. */ omitEmptyAndOptionalProperties?: boolean; /** Selected oneOf/anyOf variants keyed by schema path. */ compositionSelection?: Record; }; /** * Generate an example value from a given OpenAPI SchemaObject. * * This function recursively processes OpenAPI schemas to create realistic example data. * It handles all OpenAPI schema types including primitives, objects, arrays, and * composition schemas (allOf, oneOf, anyOf). * Uses a tonne of caching for maximum performance. * * @param schema - The OpenAPI SchemaObject to generate an example from. * @param options - Options to customize example generation. * @param level - The current recursion depth. * @param parentSchema - The parent schema, if any. * @param name - The name of the property being processed. * @returns An example value for the given schema. */ declare const generateExampleFromSchema: (schema: SchemaObject, options?: GetExampleFromSchemaOptions, { level, parentSchema, name, seen, schemaPath, dynamicScope, requiredScope, isRequiredProperty, }?: Partial<{ level: number; parentSchema: SchemaObject; name: string; seen: WeakSet; /** Internal traversal path used to resolve nested composition selections. */ schemaPath: string[]; /** Chain of schema resources entered so far, used to resolve `$dynamicRef` (JSON Schema 2020-12). */ dynamicScope: DynamicScope; /** Past the depth cap, the required names of the object a composition member belongs to. */ requiredScope: ReadonlySet; /** Use null for an unconstrained required property without confusing explicit values with the depth marker. */ isRequiredProperty: boolean; }>) => unknown; /** * Generate data, optionally retaining the exact schema decisions for another output format. * Treat returned values as read-only: cached results and padded items can share object references. * * An example too large to render at full depth is rendered at the deepest depth that fits instead, so * every branch is cut at the same level rather than the first ones using up the budget. */ export declare const getExampleFromSchema: (schema: SchemaObject, options?: GetExampleFromSchemaOptions, context?: Parameters[2]) => unknown; export {}; //# sourceMappingURL=get-example-from-schema.d.ts.map