1 | import { JSONSchema4 } from 'json-schema';
|
2 | import { Options as $RefOptions } from '@bcherny/json-schema-ref-parser';
|
3 | import { Options as PrettierOptions } from 'prettier';
|
4 | export { EnumJSONSchema, JSONSchema, NamedEnumJSONSchema, CustomTypeJSONSchema } from './types/JSONSchema';
|
5 | export interface Options {
|
6 | /**
|
7 | * [$RefParser](https://github.com/BigstickCarpet/json-schema-ref-parser) Options, used when resolving `$ref`s
|
8 | */
|
9 | $refOptions: $RefOptions;
|
10 | /**
|
11 | * Default value for additionalProperties, when it is not explicitly set.
|
12 | */
|
13 | additionalProperties: boolean;
|
14 | /**
|
15 | * Disclaimer comment prepended to the top of each generated file.
|
16 | */
|
17 | bannerComment: string;
|
18 | /**
|
19 | * Root directory for resolving [`$ref`](https://tools.ietf.org/id/draft-pbryan-zyp-json-ref-03.html)s.
|
20 | */
|
21 | cwd: string;
|
22 | /**
|
23 | * Declare external schemas referenced via `$ref`?
|
24 | */
|
25 | declareExternallyReferenced: boolean;
|
26 | /**
|
27 | * Prepend enums with [`const`](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members)?
|
28 | */
|
29 | enableConstEnums: boolean;
|
30 | /**
|
31 | * Format code? Set this to `false` to improve performance.
|
32 | */
|
33 | format: boolean;
|
34 | /**
|
35 | * Ignore maxItems and minItems for `array` types, preventing tuples being generated.
|
36 | */
|
37 | ignoreMinAndMaxItems: boolean;
|
38 | /**
|
39 | * Maximum number of unioned tuples to emit when representing bounded-size array types,
|
40 | * before falling back to emitting unbounded arrays. Increase this to improve precision
|
41 | * of emitted types, decrease it to improve performance, or set it to `-1` to ignore
|
42 | * `minItems` and `maxItems`.
|
43 | */
|
44 | maxItems: number;
|
45 | /**
|
46 | * Append all index signatures with `| undefined` so that they are strictly typed.
|
47 | *
|
48 | * This is required to be compatible with `strictNullChecks`.
|
49 | */
|
50 | strictIndexSignatures: boolean;
|
51 | /**
|
52 | * A [Prettier](https://prettier.io/docs/en/options.html) configuration.
|
53 | */
|
54 | style: PrettierOptions;
|
55 | /**
|
56 | * Generate code for `definitions` that aren't referenced by the schema?
|
57 | */
|
58 | unreachableDefinitions: boolean;
|
59 | /**
|
60 | * Generate unknown type instead of any
|
61 | */
|
62 | unknownAny: boolean;
|
63 | }
|
64 | export declare const DEFAULT_OPTIONS: Options;
|
65 | export declare function compileFromFile(filename: string, options?: Partial<Options>): Promise<string>;
|
66 | export declare function compile(schema: JSONSchema4, name: string, options?: Partial<Options>): Promise<string>;
|
67 | export declare class ValidationError extends Error {
|
68 | }
|