/** * A schema as a flow's author writes it, read into the one type model. * * Two notations, one result. The short one is YAML read as a type: `string`, * `number`, `boolean`, `a | b | c` for an enum, `[]` for a list, * `{ field: , optional?: }` for an object, and the named * `Question`. The long one, `{ json-schema: }`, is for what the short * one cannot say, which is a description for the model filling the value; it * takes `type`, `properties`, `required`, `items`, `enum` and `description`, * and nothing else. * * Both are closed. Anything outside them is refused with the path inside the * schema and what would have been accepted, never read as "any": a value a * flow cannot name the shape of is text. */ import type { ValueType } from "./type.ts"; /** One reason a schema is refused. `at` is the path inside the schema, `""` at its root. */ export type SchemaProblem = { readonly code: "schema-invalid"; readonly at: string; readonly message: string; }; /** The outcome of reading a schema: its type, or every problem found in it. */ export type ReadSchema = { readonly ok: true; readonly type: ValueType; } | { readonly ok: false; readonly problems: readonly SchemaProblem[]; }; /** The question an `ask-from` puts to a person, in the shape the card draws. */ export declare const QUESTION: ValueType; /** `written`, as YAML parsed it, read as a schema in either notation. */ export declare function readSchema(written: unknown): ReadSchema; //# sourceMappingURL=schema.d.ts.map