import type { Schema } from 'effect'; /** * A derived JSON-Schema fragment in the `validateStructural` / `CommandJsonSchema` * dialect. Every field is optional at the fragment level; the TOP-LEVEL result * of a `Schema.Struct` is the tighter `JsonSchemaObject` (always `type:'object'` * with `properties`). * * `const`/`enum` carry JSON-primitive literal values (string | number | boolean * | null) — the only literal kinds Effect's `Literal` AST and the structural * validator both model. */ export interface JsonSchemaFragment { readonly type?: string | readonly string[]; readonly properties?: Readonly>; readonly required?: readonly string[]; readonly enum?: readonly (string | number | boolean | null)[]; readonly const?: string | number | boolean | null; readonly items?: JsonSchemaFragment; } /** * The TOP-LEVEL object shape a command descriptor's `inputSchema` / * `outputSchema` carries. Structurally a `JsonSchemaFragment` pinned to * `type:'object'` — assignable to `@czap/_spine`'s `CommandJsonSchema` (the * `properties` values are `unknown` there; here they are typed fragments). */ export interface JsonSchemaObject extends JsonSchemaFragment { readonly type: 'object'; readonly properties: Readonly>; readonly required?: readonly string[]; } /** * Walk a `Schema` AST and derive the JSON-Schema OBJECT a command descriptor's * `inputSchema` / `outputSchema` carries. The top-level schema MUST be a * `Schema.Struct` (`TypeLiteral`) — a command's I/O contract is always an * object — so the result is the tighter `JsonSchemaObject` * (`{ type:'object', properties, required? }`). Throws `UnsupportedError` when * the root is not an object, or when any nested node has no sound mapping in the * structural dialect. * * Accepts any `Schema.Schema` — only `.ast` is read. */ export declare function schemaToJsonSchema(schema: Schema.Schema): JsonSchemaObject; //# sourceMappingURL=json-schema-from-schema.d.ts.map