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 = { /** Internal provenance capture, excluded from persistent result caches. */ [EXAMPLE_EVALUATION]?: ExampleEvaluationState; /** 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; /** * Whether to keep schemas annotated `deprecated: true`. * * `deprecated` says a field is discouraged, not that it is absent from the wire, so a caller * that must produce a value satisfying the schema — a mock server response, for instance — * sets this. Defaults to omitting, which is what a request-body form-filler wants. */ includeDeprecated?: 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, }?: 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; }>) => unknown; /** Generate data, optionally retaining the exact schema decisions for another output format. */ export declare const getExampleFromSchema: (schema: SchemaObject, options?: GetExampleFromSchemaOptions, context?: Parameters[2]) => unknown; export {}; //# sourceMappingURL=get-example-from-schema.d.ts.map