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