/** * Generic JSON Schema resolution utilities for lexicon code generation. * * These functions handle the common subset of JSON Schema used by * infrastructure-as-code formats (CloudFormation, Terraform, Azure ARM, etc.). * Lexicon-specific entry points call these with a `resolveDefName` callback * to produce their own naming conventions. */ export interface JsonSchemaDocument { definitions?: Record; [key: string]: unknown; } export interface JsonSchemaProperty { type?: string | string[]; $ref?: string; items?: JsonSchemaProperty; oneOf?: JsonSchemaProperty[]; anyOf?: JsonSchemaProperty[]; properties?: Record; required?: string[]; enum?: string[]; pattern?: string; minLength?: number; maxLength?: number; minimum?: number; maximum?: number; format?: string; const?: unknown; default?: unknown; description?: string; } export interface JsonSchemaDefinition extends JsonSchemaProperty { enum?: string[]; } export interface PropertyConstraints { pattern?: string; minLength?: number; maxLength?: number; minimum?: number; maximum?: number; format?: string; const?: unknown; default?: unknown; enum?: string[]; } /** * Get the primary type from a type field that can be string or string[]. * Returns first non-"null" type, or "any" if empty. */ export declare function primaryType(type: string | string[] | undefined): string; /** * Resolve a schema property to its TypeScript type string. * * @param prop - The property to resolve * @param schema - The containing schema document (for $ref resolution) * @param resolveDefName - Callback to produce a TypeScript name from a definition. * Receives (defName: string) and should return the TS type name for that definition. * When null, $ref to object definitions resolves to "any". */ export declare function resolvePropertyType(prop: JsonSchemaProperty | undefined, schema: JsonSchemaDocument, resolveDefName: ((defName: string) => string) | null): string; /** * Resolve a $ref pointer to a TypeScript type name. * * @param ref - The $ref string (e.g. "#/definitions/Foo") * @param schema - The containing schema document * @param resolveDefName - Callback to produce a TS name for object definitions. * Receives (defName: string). When null, object defs resolve to "any". */ export declare function resolveRef(ref: string, schema: JsonSchemaDocument, resolveDefName: ((defName: string) => string) | null): string; /** * Extract property constraints from a schema property. */ export declare function extractConstraints(prop: JsonSchemaProperty): PropertyConstraints; /** * Check whether a PropertyConstraints object is empty (all fields undefined/absent). */ export declare function constraintsIsEmpty(c: PropertyConstraints): boolean; /** * Check whether a schema definition is a pure string enum (no properties). */ export declare function isEnumDefinition(def: JsonSchemaDefinition): boolean; //# sourceMappingURL=json-schema.d.ts.map