import * as z from 'zod/v4'; import type { Core } from '@strapi/types'; import type { OpenAPIV3_1 } from 'openapi-types'; /** * OpenAPI 3.1 uses the JSON Schema 2020-12 dialect. Zod 4.4.3 has no `openapi-3.1` * target, so `draft-2020-12` preserves valid 3.1 schemas. Explicit output mode preserves * the conversion direction used before these defaults were pinned. */ export declare const OPENAPI_SCHEMA_CONVERSION_OPTIONS: { readonly target: "draft-2020-12"; readonly io: "output"; }; /** * Zod 4.4.3 embeds `$id` in registry `toJSONSchema` output when `uri` is configured. * Strip it so OpenAPI documents stay stable — inline schemas use random UUIDs * as registry IDs. */ export declare const stripJsonSchemaId: (schema: T) => T; /** * Generates a path string for referencing a component schema by its identifier. * * @param id - The identifier of the component schema. * @returns The constructed path string for the specified component schema. */ export declare const toComponentsPath: (id: string) => string; /** * Moves Zod's sibling `__shared` bucket into named component schemas and rewrites * `$ref`s that targeted that bucket. * * Zod 4.4.3 emits `#/components/schemas/__shared#/$defs/` when an identified * nested schema is not in the conversion registry. Those definitions must become * first-class `components.schemas` entries; `__shared` is never written out. * * @returns Named schemas lifted from `__shared` (after `$id` stripping). Route * conversion copies these into the shared harvest bag so ComponentsWriter can * merge them into the document. */ export declare const liftZodSharedDefinitions: (schemas: Record) => Record; export type ZodToOpenAPIOptions = { /** * Shared harvest bag filled with named schemas lifted from Zod's `__shared` * bucket. Assemblers pass `context.registries.extractedComponentSchemas` so * ComponentsWriter can merge them into `components.schemas`. */ extractedComponentSchemas?: Record; }; /** * Converts a Zod schema to an OpenAPI Schema Object. * * @description * Takes a Zod schema and converts it into an OpenAPI Schema Object (v3.1). * It uses a local registry to handle the conversion process and generates the appropriate * OpenAPI components. Identified nested schemas that Zod would otherwise park in * `__shared` are rewritten to `#/components/schemas/` and copied into * `options.extractedComponentSchemas` when that bag is provided. * * @param zodSchema - The Zod schema to convert to OpenAPI format. Can be any valid Zod schema. * @param schemaStore - The application-owned content-API schema store to copy named * component definitions from. Conversion uses a local registry and does not read a * live Zod registry from the store. * @param options - Optional harvest bag shared across assemblers and ComponentsWriter. * * @returns An OpenAPI Schema Object representing the input Zod schema structure. * If the conversion cannot be completed, returns undefined. * * @example * ```typescript * import * as z from 'zod/v4'; * * // Create a Zod schema * const userSchema = z.object({ * id: z.number(), * name: z.string(), * email: z.string().email() * }); * * // Convert to OpenAPI schema * const openAPISchema = zodToOpenAPI(userSchema, strapi.contentAPISchemaRegistry); * ``` */ export declare const zodToOpenAPI: (zodSchema: z.ZodType, schemaStore: Core.ContentAPISchemaRegistry, options?: ZodToOpenAPIOptions) => OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; //# sourceMappingURL=zod.d.ts.map