import "../../_dnt.polyfills.js"; import type { OasUnknown } from '../unknown/Unknown.js'; import type { SchemaPath } from '../../types/SchemaPath.js'; import type { OasSchema, ToJsonSchemaOptions } from '../schema/Schema.js'; import type { OasRef } from '../ref/Ref.js'; import type { OpenAPIV3 } from 'openapi-types'; import { OasBase } from '../../types/OasBase.js'; import type { ParseContextType } from '../../context/parseTypes.js'; /** * Constructor fields for {@link OasArray}. * * @template Nullable - Whether the array value can be null */ export type ArrayFields = { /** Schema definition for array items */ items: OasSchema | OasRef<'schema'>; /** A short summary of the array schema */ title?: string; /** A description of the array schema */ description?: string; /** Whether the array value can be null */ nullable?: Nullable; /** Whether array items must be unique */ uniqueItems?: boolean; /** Custom extension fields (x-* properties) */ extensionFields?: Record; /** Example array value */ example?: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; /** Maximum number of items allowed */ maxItems?: number; /** Minimum number of items required */ minItems?: number; /** Array of allowed enum values for the entire array */ enums?: Nullable extends true ? (unknown | null)[] | undefined : unknown[] | undefined; /** Default value for the array */ defaultValue?: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; /** Whether the array is read-only */ readOnly?: boolean; /** Whether the array is write-only */ writeOnly?: boolean; /** Whether the array is deprecated */ deprecated?: boolean; }; export declare class OasArray extends OasBase { /** * Object is part the 'schema' set which is used * to define data types in an OpenAPI document. */ oasType: "schema"; /** * Constant value 'array' useful for type narrowing and tagged unions. */ type: "array"; /** * Defines the type of items in the array. */ items: OasSchema | OasRef<'schema'>; /** * A short summary of the array. */ title: string | undefined; /** * A description of the array. */ description: string | undefined; /** * Indicates whether value can be null. */ nullable: Nullable | undefined; /** * Indicates whether the array items must be unique. */ uniqueItems: boolean | undefined; /** Specification Extension fields */ extensionFields: Record | undefined; /** * An example of the array. */ example: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; /** * The maximum number of items in the array. */ maxItems: number | undefined; /** * The minimum number of items in the array. */ minItems: number | undefined; /** * The enum values for the array. */ enums: Nullable extends true ? (unknown | null)[] | undefined : unknown[] | undefined; /** * The default value for the array. */ defaultValue: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined; /** * Creates a new OasArray instance. * * @param fields - Array configuration fields including items schema, validation constraints, and metadata */ /** * Whether the array is read-only. */ readOnly: boolean | undefined; /** * Whether the array is write-only. */ writeOnly: boolean | undefined; /** * Whether the array is deprecated. */ deprecated: boolean | undefined; /** * The schema's `not`, kept as an `OasUnknown` under `client.json` * `system.not: unknown`: the document says "not something", and core does * not read what. `undefined` otherwise. */ not: OasUnknown | undefined; constructor(fields: ArrayFields, context?: ParseContextType); /** * Determines if this array is a reference object. * * @returns Always returns false since this is a concrete array instance, not a reference */ isRef(): this is OasRef<'schema'>; /** Whether the value is `readOnly`: sent by the API only, never in a request. */ isReadOnly(): boolean; /** Whether the value is `writeOnly`: sent in a request only, never by the API. */ isWriteOnly(): boolean; /** * A copy of this schema with what `ref` adds at its site applied: its * `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that * this type takes, a sibling's value winning. A value that does not fit * this type is left out (the parser reports it). For `OasRef.resolve()`. * This schema does not change, and the copy shares its child schemas. */ clone(ref?: OasRef<'schema'>): OasArray; traverse(path: SchemaPath): OasSchema | OasRef<'schema'>; /** * Resolves this array object. * * @returns The array instance itself since it's already a concrete object, not a reference */ resolve(): OasArray; /** * Resolves this array object one level. * * @returns The array instance itself since it's already a concrete object, not a reference */ resolveOnce(): OasArray; /** * Converts this OAS array to an OpenAPI v3 JSON schema representation. * * @param options - Conversion options including reference handling and formatting preferences * @returns OpenAPI v3 array schema object with type, items schema, and all validation constraints */ toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.ArraySchemaObject; }