Skip to content

Commit d8a2465

Browse files
committed
TS 2.1 compatible version.
1 parent e2d2e8f commit d8a2465

4 files changed

+97
-76
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-json-schema",
3-
"version": "0.3.5",
3+
"version": "0.4.0",
44
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources",
55
"main": "typescript-json-schema.js",
66
"typings": "typescript-json-schema.d.ts",

Diff for: typescript-json-schema.d.ts

+30-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,34 @@ export declare function getDefaultArgs(): {
1111
strictNullChecks: boolean;
1212
out: string;
1313
};
14+
export declare type Definition = {
15+
$ref?: string;
16+
description?: string;
17+
allOf?: Definition[];
18+
oneOf?: Definition[];
19+
anyOf?: Definition[];
20+
title?: string;
21+
type?: string | string[];
22+
definitions?: {
23+
[key: string]: any;
24+
};
25+
format?: string;
26+
items?: Definition;
27+
minItems?: number;
28+
additionalItems?: {
29+
anyOf: Definition;
30+
};
31+
enum?: string[] | Definition[];
32+
default?: string | number | boolean | Object;
33+
additionalProperties?: Definition;
34+
required?: string[];
35+
propertyOrder?: string[];
36+
properties?: {};
37+
defaultProperties?: string[];
38+
};
1439
export declare class JsonSchemaGenerator {
1540
private args;
1641
private static validationKeywords;
17-
private static annotedValidationKeywordPattern;
1842
private allSymbols;
1943
private inheritingTypes;
2044
private tc;
@@ -36,10 +60,9 @@ export declare class JsonSchemaGenerator {
3660
out: string;
3761
});
3862
readonly ReffedDefinitions: {
39-
[key: string]: any;
63+
[key: string]: Definition;
4064
};
41-
private copyValidationKeywords(comment, to, otherAnnotations);
42-
private copyDescription(comment, to);
65+
private parseValue(value);
4366
private parseCommentsIntoDefinition(symbol, definition, otherAnnotations);
4467
private extractLiteralValue(typ);
4568
private resolveTupleType(propertyType);
@@ -53,10 +76,10 @@ export declare class JsonSchemaGenerator {
5376
private addSimpleType(def, type);
5477
private makeNullable(def);
5578
private getTypeDefinition(typ, tc, asRef?, unionModifier?, prop?, reffedType?);
56-
getSchemaForSymbol(symbolName: string, includeReffedDefinitions?: boolean): any;
79+
getSchemaForSymbol(symbolName: string, includeReffedDefinitions?: boolean): Definition;
5780
getSchemaForSymbols(symbols: {
5881
[name: string]: ts.Type;
59-
}): any;
82+
}): Definition;
6083
}
6184
export declare function getProgramFromFiles(files: string[], compilerOptions?: ts.CompilerOptions): ts.Program;
6285
export declare function generateSchema(program: ts.Program, fullTypeName: string, args?: {
@@ -70,7 +93,7 @@ export declare function generateSchema(program: ts.Program, fullTypeName: string
7093
generateRequired: boolean;
7194
strictNullChecks: boolean;
7295
out: string;
73-
}): any;
96+
}): Definition;
7497
export declare function programFromConfig(configFileName: string): ts.Program;
7598
export declare function exec(filePattern: string, fullTypeName: string, args?: {
7699
useRef: boolean;

Diff for: typescript-json-schema.js

+65-67
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: typescript-json-schema.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)