Skip to content

Commit 8778e04

Browse files
authored
Merge pull request YousefED#67 from benbabic/master
Exposing the JsonSchemaGenerator class
2 parents ba137c8 + 99b597d commit 8778e04

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

typescript-json-schema.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,54 @@ export declare function getDefaultArgs(): {
1111
strictNullChecks: boolean;
1212
out: any;
1313
};
14+
export declare class JsonSchemaGenerator {
15+
private args;
16+
private static validationKeywords;
17+
private static annotedValidationKeywordPattern;
18+
private allSymbols;
19+
private inheritingTypes;
20+
private tc;
21+
private sandbox;
22+
private reffedDefinitions;
23+
constructor(allSymbols: {
24+
[name: string]: ts.Type;
25+
}, inheritingTypes: {
26+
[baseName: string]: string[];
27+
}, tc: ts.TypeChecker, args?: {
28+
useRef: boolean;
29+
useTypeAliasRef: boolean;
30+
useRootRef: boolean;
31+
useTitle: boolean;
32+
useDefaultProperties: boolean;
33+
disableExtraProperties: boolean;
34+
usePropertyOrder: boolean;
35+
generateRequired: boolean;
36+
strictNullChecks: boolean;
37+
out: any;
38+
});
39+
readonly ReffedDefinitions: {
40+
[key: string]: any;
41+
};
42+
private copyValidationKeywords(comment, to, otherAnnotations);
43+
private copyDescription(comment, to);
44+
private parseCommentsIntoDefinition(symbol, definition, otherAnnotations);
45+
private extractLiteralValue(typ);
46+
private resolveTupleType(propertyType);
47+
private getDefinitionForRootType(propertyType, tc, reffedType, definition);
48+
private getReferencedTypeSymbol(prop, tc);
49+
private getDefinitionForProperty(prop, tc, node);
50+
private getEnumDefinition(clazzType, tc, definition);
51+
private getUnionDefinition(unionType, prop, tc, unionModifier, definition);
52+
private getClassDefinition(clazzType, tc, definition);
53+
private simpleTypesAllowedProperties;
54+
private addSimpleType(def, type);
55+
private makeNullable(def);
56+
private getTypeDefinition(typ, tc, asRef?, unionModifier?, prop?, reffedType?);
57+
getSchemaForSymbol(symbolName: string, includeReffedDefinitions?: boolean): any;
58+
getSchemaForSymbols(symbols: {
59+
[name: string]: ts.Type;
60+
}): any;
61+
}
1462
export declare function getProgramFromFiles(files: string[], compilerOptions?: ts.CompilerOptions): ts.Program;
1563
export declare function generateSchema(program: ts.Program, fullTypeName: string, args?: {
1664
useRef: boolean;

typescript-json-schema.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)