-
Notifications
You must be signed in to change notification settings - Fork 14
/
GenerateOptions.ts
79 lines (64 loc) · 1.78 KB
/
GenerateOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { FormatsPluginOptions } from 'ajv-formats';
import { Options } from "prettier";
import { SchemaType } from "./parse-schema";
export type ValidatorOutput = "module" | "commonjs";
export interface StandaloneOptions {
/**
* Merge decoders into a single file
* This will reduce the build size, but might increase the time it takes to treeshake the bundle
* Only works for standalone builds
*/
mergeDecoders?: boolean;
/**
* JS format of the validators We can't generate TS yet. Ajv doesn't support it.
*/
validatorOutput: ValidatorOutput;
}
export interface GenerateOptions {
/** file location of the schema */
schemaFile: string;
schemaType: SchemaType;
/** location(s) where the output files will be stored. */
directory: string | string[];
/**
* adds the "ajv-formats" packages
* @default false
*/
addFormats?: boolean;
/**
* Options send to add the addFormats
* @default undefined
*/
formatOptions?: FormatsPluginOptions;
/**
* @default prettier typescript options
*/
prettierOptions?: Options;
/**
* list of definitions to generate decoders for
* @default generates decoder for every element
*/
decoders?: string[];
/**
* Generates all validators up front.
* Read more about it at the AJV 7 upgrade: https://openjsf.org/blog/2021/02/11/project-news-ajv-version-7-big-changes-and-improvements/
* @default undefined
*/
standalone?: StandaloneOptions;
/**
* don't output the meta file
*/
skipMetaFile?: boolean;
/**
* don't output the schema file
*/
skipSchemaFile?: boolean;
/**
* don't output decoder files
*/
skipDecoders?: boolean;
/**
* when this option is enabled, standaloneOptions.validatorOutput is automatically set to "module"
*/
esm?: boolean;
}