forked from YousefED/typescript-json-schema
-
Notifications
You must be signed in to change notification settings - Fork 1
/
typescript-json-schema.d.ts
87 lines (87 loc) · 3.08 KB
/
typescript-json-schema.d.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
80
81
82
83
84
85
86
87
import * as ts from "typescript";
export declare function getDefaultArgs(): {
useRef: boolean;
useTypeAliasRef: boolean;
useRootRef: boolean;
useTitle: boolean;
useDefaultProperties: boolean;
disableExtraProperties: boolean;
usePropertyOrder: boolean;
generateRequired: boolean;
strictNullChecks: boolean;
out: any;
};
export declare class JsonSchemaGenerator {
private args;
private static validationKeywords;
private static annotedValidationKeywordPattern;
private allSymbols;
private inheritingTypes;
private tc;
private reffedDefinitions;
constructor(allSymbols: {
[name: string]: ts.Type;
}, inheritingTypes: {
[baseName: string]: string[];
}, tc: ts.TypeChecker, args?: {
useRef: boolean;
useTypeAliasRef: boolean;
useRootRef: boolean;
useTitle: boolean;
useDefaultProperties: boolean;
disableExtraProperties: boolean;
usePropertyOrder: boolean;
generateRequired: boolean;
strictNullChecks: boolean;
out: any;
});
readonly ReffedDefinitions: {
[key: string]: any;
};
private copyValidationKeywords(comment, to, otherAnnotations);
private copyDescription(comment, to);
private parseCommentsIntoDefinition(symbol, definition, otherAnnotations);
private extractLiteralValue(typ);
private resolveTupleType(propertyType);
private getDefinitionForRootType(propertyType, tc, reffedType, definition);
private getReferencedTypeSymbol(prop, tc);
private getDefinitionForProperty(prop, tc, node);
private getEnumDefinition(clazzType, tc, definition);
private getUnionDefinition(unionType, prop, tc, unionModifier, definition);
private getClassDefinition(clazzType, tc, definition);
private simpleTypesAllowedProperties;
private addSimpleType(def, type);
private makeNullable(def);
private getTypeDefinition(typ, tc, asRef?, unionModifier?, prop?, reffedType?);
getSchemaForSymbol(symbolName: string, includeReffedDefinitions?: boolean): any;
getSchemaForSymbols(symbols: {
[name: string]: ts.Type;
}): any;
}
export declare function getProgramFromFiles(files: string[], compilerOptions?: ts.CompilerOptions): ts.Program;
export declare function generateSchema(program: ts.Program, fullTypeName: string, args?: {
useRef: boolean;
useTypeAliasRef: boolean;
useRootRef: boolean;
useTitle: boolean;
useDefaultProperties: boolean;
disableExtraProperties: boolean;
usePropertyOrder: boolean;
generateRequired: boolean;
strictNullChecks: boolean;
out: any;
}): any;
export declare function programFromConfig(configFileName: string): ts.Program;
export declare function exec(filePattern: string, fullTypeName: string, args?: {
useRef: boolean;
useTypeAliasRef: boolean;
useRootRef: boolean;
useTitle: boolean;
useDefaultProperties: boolean;
disableExtraProperties: boolean;
usePropertyOrder: boolean;
generateRequired: boolean;
strictNullChecks: boolean;
out: any;
}): void;
export declare function run(): void;