// const $schema = 'http://json-schema.org/draft-07/schema#' // type SchemaDraft = typeof $schema // export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'null' interface TypedJsonSchema { type: TypeName } interface StringJsonSchemaOptions extends TypedJsonSchema<'string'> {} interface NumberJsonSchemaOptions extends TypedJsonSchema<'number'> {} interface BooleanJsonSchemaOptions extends TypedJsonSchema<'boolean'> {} interface NullJsonSchemaOptions extends TypedJsonSchema<'null'> {} interface ConstJsonSchemaOptions { const: unknown } interface EnumJsonSchemaOptions { enum: unknown[] } interface ArrayJsonSchemaOptions extends TypedJsonSchema<'array'> { items: JsonSchemaOptions } interface ObjectJsonSchemaOptions extends TypedJsonSchema<'object'> { properties: { [key: string]: JsonSchemaOptions } required: string[] } interface AnyOfJsonSchemaOptions { anyOf: JsonSchemaOptions[] } interface AllOfJsonSchemaOptions { allOf: JsonSchemaOptions[] } export type JsonSchemaOptions = | StringJsonSchemaOptions | NumberJsonSchemaOptions | BooleanJsonSchemaOptions | NullJsonSchemaOptions | ConstJsonSchemaOptions | EnumJsonSchemaOptions | ArrayJsonSchemaOptions | ObjectJsonSchemaOptions | AnyOfJsonSchemaOptions | AllOfJsonSchemaOptions export type JsonSchema = JsonSchemaOptions /* & { $schema: SchemaDraft } */ // export function buildJsonSchema(schema: JsonSchemaOptions): JsonSchema { // return { // ...schema, // $schema, // } // }