typescript-json-schema
Advanced tools
Comparing version 0.29.0 to 0.30.0
{ | ||
"name": "typescript-json-schema", | ||
"version": "0.29.0", | ||
"version": "0.30.0", | ||
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources", | ||
@@ -5,0 +5,0 @@ "main": "typescript-json-schema.js", |
@@ -48,2 +48,3 @@ # typescript-json-schema | ||
--uniqueNames Use unique names for type symbols. [boolean] [default: false] | ||
--rejectDateType Rejects Date fields in type definitions. [boolean] [default: false] | ||
--id Set schema id. [string] [default: ""] | ||
@@ -50,0 +51,0 @@ ``` |
@@ -42,2 +42,4 @@ "use strict"; | ||
.describe("include", "Further limit tsconfig to include only matching files.") | ||
.boolean("rejectDateType").default("rejectDateType", defaultArgs.rejectDateType) | ||
.describe("rejectDateType", "Rejects Date fields in type definitions.") | ||
.string("id").default("id", defaultArgs.id) | ||
@@ -63,3 +65,4 @@ .describe("id", "ID of schema.") | ||
uniqueNames: args.uniqueNames, | ||
id: args.id | ||
rejectDateType: args.rejectDateType, | ||
id: args.id, | ||
}); | ||
@@ -66,0 +69,0 @@ } |
@@ -41,2 +41,4 @@ import { exec, getDefaultArgs } from "./typescript-json-schema"; | ||
.describe("include", "Further limit tsconfig to include only matching files.") | ||
.boolean("rejectDateType").default("rejectDateType", defaultArgs.rejectDateType) | ||
.describe("rejectDateType", "Rejects Date fields in type definitions.") | ||
.string("id").default("id", defaultArgs.id) | ||
@@ -63,3 +65,4 @@ .describe("id", "ID of schema.") | ||
uniqueNames: args.uniqueNames, | ||
id: args.id | ||
rejectDateType: args.rejectDateType, | ||
id: args.id, | ||
}); | ||
@@ -66,0 +69,0 @@ } |
@@ -24,2 +24,3 @@ import * as ts from "typescript"; | ||
uniqueNames: boolean; | ||
rejectDateType: boolean; | ||
id: string; | ||
@@ -26,0 +27,0 @@ }; |
@@ -38,3 +38,4 @@ "use strict"; | ||
uniqueNames: false, | ||
id: "" | ||
rejectDateType: false, | ||
id: "", | ||
}; | ||
@@ -268,3 +269,3 @@ } | ||
} | ||
else if (propertyTypeString === "Date") { | ||
else if (propertyTypeString === "Date" && !this.args.rejectDateType) { | ||
definition.type = "string"; | ||
@@ -289,8 +290,5 @@ definition.format = "date-time"; | ||
else { | ||
var info = propertyType; | ||
try { | ||
info = JSON.stringify(propertyType); | ||
} | ||
catch (err) { } | ||
console.error("Unsupported type: ", info); | ||
var error = new TypeError("Unsupported type: " + propertyTypeString); | ||
error.type = propertyType; | ||
throw error; | ||
} | ||
@@ -297,0 +295,0 @@ } |
@@ -33,3 +33,4 @@ import * as glob from "glob"; | ||
uniqueNames: false, | ||
id: "" | ||
rejectDateType: false, | ||
id: "", | ||
}; | ||
@@ -59,2 +60,3 @@ } | ||
uniqueNames: boolean; | ||
rejectDateType: boolean; | ||
id: string; | ||
@@ -403,3 +405,3 @@ }; | ||
// no type restriction, so that anything will match | ||
} else if (propertyTypeString === "Date") { | ||
} else if (propertyTypeString === "Date" && !this.args.rejectDateType) { | ||
definition.type = "string"; | ||
@@ -421,7 +423,5 @@ definition.format = "date-time"; | ||
// Report that type could not be processed | ||
let info: any = propertyType; | ||
try { | ||
info = JSON.stringify(propertyType); | ||
} catch(err) {} | ||
console.error("Unsupported type: ", info); | ||
const error = new TypeError("Unsupported type: " + propertyTypeString); | ||
(error as any).type = propertyType; | ||
throw error; | ||
// definition = this.getTypeDefinition(propertyType, tc); | ||
@@ -428,0 +428,0 @@ } |
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
175567
2392
173