import type { $JSONSchema, JSONSchemaType } from "./jsonSchema"; export type JSONSchemaExtension = Record; export type ExtendedJSONSchema = boolean | (Readonly<{ [$JSONSchema]?: $JSONSchema; $id?: string | undefined; $ref?: string | undefined; $schema?: string | undefined; $comment?: string | undefined; type?: JSONSchemaType | readonly JSONSchemaType[]; const?: unknown; enum?: unknown; multipleOf?: number | undefined; maximum?: number | undefined; exclusiveMaximum?: number | undefined; minimum?: number | undefined; exclusiveMinimum?: number | undefined; maxLength?: number | undefined; minLength?: number | undefined; pattern?: string | undefined; items?: ExtendedJSONSchema | readonly ExtendedJSONSchema[]; additionalItems?: ExtendedJSONSchema; contains?: ExtendedJSONSchema; maxItems?: number | undefined; minItems?: number | undefined; uniqueItems?: boolean | undefined; maxProperties?: number | undefined; minProperties?: number | undefined; required?: readonly string[]; properties?: Readonly>>; patternProperties?: Readonly>>; additionalProperties?: ExtendedJSONSchema; dependencies?: Readonly | readonly string[]>>; propertyNames?: ExtendedJSONSchema; if?: ExtendedJSONSchema; then?: ExtendedJSONSchema; else?: ExtendedJSONSchema; allOf?: readonly ExtendedJSONSchema[]; anyOf?: readonly ExtendedJSONSchema[]; oneOf?: readonly ExtendedJSONSchema[]; not?: ExtendedJSONSchema; format?: string | undefined; contentMediaType?: string | undefined; contentEncoding?: string | undefined; definitions?: Readonly>>; title?: string | undefined; description?: string | undefined; default?: unknown; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; examples?: readonly unknown[]; nullable?: boolean; }> & Readonly>); export type ExtendedJSONSchemaReference = ExtendedJSONSchema & Readonly<{ $id: string; }>; type UnextendJSONSchemaTuple[]> = EXTENDED_SCHEMAS extends [ infer EXTENDED_SCHEMAS_HEAD, ...infer EXTENDED_SCHEMAS_TAIL ] ? EXTENDED_SCHEMAS_HEAD extends ExtendedJSONSchema ? EXTENDED_SCHEMAS_TAIL extends ExtendedJSONSchema[] ? [ UnextendJSONSchema, ...UnextendJSONSchemaTuple ] : never : never : []; type UnextendJSONSchemaRecord> = { [KEY in keyof EXTENDED_SCHEMA_RECORD]: EXTENDED_SCHEMA_RECORD[KEY] extends ExtendedJSONSchema ? UnextendJSONSchema : EXTENDED_SCHEMA_RECORD[KEY]; }; export type UnextendJSONSchema = EXTENDED_SCHEMA extends boolean ? EXTENDED_SCHEMA : { [KEY in $JSONSchema | keyof EXTENDED_SCHEMA]: KEY extends keyof EXTENDED_SCHEMA ? EXTENDED_SCHEMA extends { [K in KEY]: ExtendedJSONSchema; } ? UnextendJSONSchema : EXTENDED_SCHEMA extends { [K in KEY]: ExtendedJSONSchema[]; } ? number extends EXTENDED_SCHEMA[KEY]["length"] ? UnextendJSONSchema[] : EXTENDED_SCHEMA[KEY] extends ExtendedJSONSchema[] ? UnextendJSONSchemaTuple : never : EXTENDED_SCHEMA extends { [K in KEY]: Record; } ? UnextendJSONSchemaRecord : EXTENDED_SCHEMA[KEY] : KEY extends $JSONSchema ? $JSONSchema : never; }; export {};