import type { OpenAPIV3 } from 'openapi-types'; import { OasArray } from '../../../oas/array/Array.js'; import type { ParseContextType } from '../../../context/parseTypes.js'; import type { StackTrail } from '../../../context/StackTrail.js'; export type ToArrayArgs = { value: OpenAPIV3.ArraySchemaObject; stackTrail: StackTrail; context: ParseContextType; }; /** * Transforms an OpenAPI v3 array schema object into an internal OAS array representation. * * This function processes OpenAPI array schemas by extracting and parsing nullable values, * examples, enumerations, and default values. It handles the complete transformation from * raw OpenAPI JSON to the SKMTC internal array representation with proper type safety. * * The transformation follows a pipeline approach: * 1. Parse nullable flag and extract base value * 2. Parse example values with nullable support * 3. Parse enumeration constraints * 4. Parse default values * 5. Create final OasArray instance * * @param args - Transformation arguments * @param args.value - The OpenAPI v3 array schema object to transform * @param args.context - Parse context providing utilities and tracing * @returns Transformed OAS array object with parsed properties * * @example Basic array transformation * ```typescript * import { toArray } from '@skmtc/core'; * * const openApiArray = { * type: 'array', * items: { type: 'string' }, * maxItems: 10, * uniqueItems: true * }; * * const oasArray = toArray({ * value: openApiArray, * context: parseContext * }); * * console.log(oasArray.maxItems); // 10 * console.log(oasArray.uniqueItems); // true * ``` * * @example Array with nullable and examples * ```typescript * const complexArray = { * type: 'array', * items: { type: 'number' }, * nullable: true, * example: [1, 2, 3], * default: [], * enum: [[1, 2], [3, 4], null] * }; * * const oasArray = toArray({ * value: complexArray, * context: parseContext * }); * * console.log(oasArray.nullable); // true * console.log(oasArray.example); // [1, 2, 3] * ``` */ export declare const toArray: ({ value, context, stackTrail }: ToArrayArgs) => OasArray; type ToParsedArrayArgs = { value: Omit; stackTrail: StackTrail; context: ParseContextType; nullable: Nullable; example: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; enums: Nullable extends true ? (unknown[] | null)[] | undefined : unknown[] | undefined; defaultValue: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; }; export declare const toParsedArray: ({ context, stackTrail, nullable, example, enums, defaultValue, value }: ToParsedArrayArgs) => OasArray; export {};