import { JSONSchema, JSONSchema as JSONSchema$1 } from "json-schema-typed/draft-2020-12"; //#region src/generator.d.ts /** options shared by every generator */ interface CommonOptions { /** * Name of the generated root type. * * Defaults to the schema's `title` (converted to PascalCase), or `"Schema"`. */ name?: string; /** * Indentation unit for the generated code. * * @default " " */ tab?: string; /** * Include properties marked `readOnly` (e.g. server-assigned fields). * * When included, they keep a `readonly` modifier in the output. * * @default false */ readOnly?: boolean; /** * Include properties marked `writeOnly` (e.g. passwords). * * @default false */ writeOnly?: boolean; } //#endregion //#region src/generate.d.ts interface GenerateOptions extends CommonOptions { /** * Generate only the schema this reference points to (along with everything * it depends on) instead of the entire document. * * Accepts any `$ref`-style reference, resolved against the schema root: * a JSON pointer (`#/$defs/user`), an anchor (`#user`), or the `$id` of a * bundled subschema (`https://example.com/user.json`). */ ref?: string; } interface GenerateFromDereferencedOptions extends CommonOptions { /** * Return the original location of a schema object as a `$ref`-style pointer * (e.g. `#/$defs/user`), or `undefined` for inline/anonymous schemas. * * Dereferencing discards the `$ref` structure, so shared and recursive * schemas are only recognizable by object identity. This callback restores * their canonical location, which is used to generate readable type names. */ getRawPath?: (schema: JSONSchema$1) => string | undefined; } /** * Generate TypeScript definitions from a JSON Schema (draft 2020-12). * * The schema doesn't need to be dereferenced, but external references must be * bundled into the document (e.g. under `$defs`) beforehand. */ declare function generate(schema: JSONSchema$1, options?: GenerateOptions): string; /** * Generate TypeScript definitions from a **dereferenced** JSON Schema. * * Every schema reached more than once (shared or recursive) becomes its own * named declaration; pass {@link GenerateFromDereferencedOptions.getRawPath} * to give those declarations readable names. */ declare function generateFromDereferenced(schema: JSONSchema$1, options?: GenerateFromDereferencedOptions): string; //#endregion export { type GenerateFromDereferencedOptions, type GenerateOptions, type JSONSchema, generate, generateFromDereferenced }; //# sourceMappingURL=index.d.mts.map