typescript-json-schema
Advanced tools
Comparing version 0.9.2 to 0.10.0
{ | ||
"name": "typescript-json-schema", | ||
"version": "0.9.2", | ||
"version": "0.10.0", | ||
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources", | ||
@@ -11,11 +11,14 @@ "main": "typescript-json-schema.js", | ||
"author": "Yousef El-Dardiry and Dominik Moritz", | ||
"contributors": [{ | ||
"name": "Yousef El-Dardiry", | ||
"email": "yousef@tweetbeam.com", | ||
"url": "http://www.twitter.com/yousefed" | ||
},{ | ||
"name": "Dominik Moritz", | ||
"email": "domoritz@gmail.com", | ||
"url": "https://www.domoritz.de/" | ||
}], | ||
"contributors": [ | ||
{ | ||
"name": "Yousef El-Dardiry", | ||
"email": "yousef@tweetbeam.com", | ||
"url": "http://www.twitter.com/yousefed" | ||
}, | ||
{ | ||
"name": "Dominik Moritz", | ||
"email": "domoritz@gmail.com", | ||
"url": "https://www.domoritz.de/" | ||
} | ||
], | ||
"repository": { | ||
@@ -46,12 +49,12 @@ "type": "git", | ||
"@types/assertion-error": "^1.0.30", | ||
"@types/chai": "^3.4.34", | ||
"@types/chai": "^3.4.35", | ||
"@types/glob": "^5.0.30", | ||
"@types/json-stable-stringify": "^1.0.29", | ||
"@types/mocha": "^2.2.38", | ||
"@types/node": "^7.0.4", | ||
"ajv": "^4.11.2", | ||
"@types/json-stable-stringify": "^1.0.30", | ||
"@types/mocha": "^2.2.39", | ||
"@types/node": "^7.0.5", | ||
"ajv": "^4.11.3", | ||
"chai": "^3.5.0", | ||
"mocha": "^3.2.0", | ||
"source-map-support": "^0.4.10", | ||
"tslint": "^4.4.2" | ||
"source-map-support": "^0.4.11", | ||
"tslint": "^4.5.0" | ||
}, | ||
@@ -58,0 +61,0 @@ "scripts": { |
@@ -27,11 +27,12 @@ # typescript-json-schema | ||
Options: | ||
--refs Create shared ref definitions. [boolean] [default: true] | ||
--aliasRefs Create shared ref definitions for the type aliases. [boolean] [default: false] | ||
--topRef Create a top-level ref definition. [boolean] [default: false] | ||
--titles Creates titles in the output schema. [boolean] [default: false] | ||
--defaultProps Create default properties definitions. [boolean] [default: false] | ||
--noExtraProps Disable additional properties in objects by default. [boolean] [default: false] | ||
--propOrder Create property order definitions. [boolean] [default: false] | ||
--required Create required array for non-optional properties. [boolean] [default: false] | ||
--strictNullChecks Make values non-nullable by default. [boolean] [default: false] | ||
--refs Create shared ref definitions. [boolean] [default: true] | ||
--aliasRefs Create shared ref definitions for the type aliases. [boolean] [default: false] | ||
--topRef Create a top-level ref definition. [boolean] [default: false] | ||
--titles Creates titles in the output schema. [boolean] [default: false] | ||
--defaultProps Create default properties definitions. [boolean] [default: false] | ||
--noExtraProps Disable additional properties in objects by default. [boolean] [default: false] | ||
--propOrder Create property order definitions. [boolean] [default: false] | ||
--required Create required array for non-optional properties. [boolean] [default: false] | ||
--strictNullChecks Make values non-nullable by default. [boolean] [default: false] | ||
--useTypeOfKeyword Use `typeOf` keyword (https://goo.gl/DC6sni) for functions. [boolean] [default: false] | ||
--out, -o The output file, defaults to using stdout | ||
@@ -38,0 +39,0 @@ ``` |
@@ -109,3 +109,4 @@ "use strict"; | ||
assertSchema("annotation-default", "main.ts", "MyObject"); | ||
assertSchema("typeof-keyword", "main.ts", "MyObject", { useTypeOfKeyword: true }); | ||
}); | ||
//# sourceMappingURL=schema.test.js.map |
@@ -11,2 +11,3 @@ import * as ts from "typescript"; | ||
usePropertyOrder: boolean; | ||
useTypeOfKeyword: boolean; | ||
generateRequired: boolean; | ||
@@ -43,2 +44,3 @@ strictNullChecks: boolean; | ||
defaultProperties?: string[]; | ||
typeof?: "function"; | ||
}; | ||
@@ -45,0 +47,0 @@ export declare class JsonSchemaGenerator { |
@@ -18,2 +18,3 @@ "use strict"; | ||
usePropertyOrder: false, | ||
useTypeOfKeyword: false, | ||
generateRequired: false, | ||
@@ -349,2 +350,6 @@ strictNullChecks: false, | ||
var node = clazzType.getSymbol().getDeclarations()[0]; | ||
if (this.args.useTypeOfKeyword && node.kind === ts.SyntaxKind.FunctionType) { | ||
definition.typeof = "function"; | ||
return definition; | ||
} | ||
var clazz = node; | ||
@@ -748,2 +753,4 @@ var props = tc.getPropertiesOfType(clazzType); | ||
.describe("propOrder", "Create property order definitions.") | ||
.boolean("useTypeOfKeyword").default("useTypeOfKeyword", defaultArgs.usePropertyOrder) | ||
.describe("useTypeOfKeyword", "Use typeOf keyword (https://goo.gl/DC6sni) for functions.") | ||
.boolean("required").default("required", defaultArgs.generateRequired) | ||
@@ -766,2 +773,3 @@ .describe("required", "Create required array for non-optional properties.") | ||
usePropertyOrder: args.propOrder, | ||
useTypeOfKeyword: args.useTypeOfKeyword, | ||
generateRequired: args.required, | ||
@@ -768,0 +776,0 @@ strictNullChecks: args.strictNullChecks, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125948
105
2762
119