ts-runtime-validation 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/SchemaGenerator.ts +7 -6
- package/src/writeLine.ts +4 -0
package/package.json
CHANGED
package/src/SchemaGenerator.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import * as tsj from "ts-json-schema-generator";
|
|
18
18
|
import { Config, Schema } from "ts-json-schema-generator";
|
|
19
19
|
import assert from "assert";
|
|
20
|
+
import { writeLine } from "./writeLine";
|
|
20
21
|
|
|
21
22
|
const defaultTsMorphProjectSettings: ProjectOptions = {
|
|
22
23
|
manipulationSettings: {
|
|
@@ -49,25 +50,25 @@ export class SchemaGenerator {
|
|
|
49
50
|
const { helpers, glob } = this.options;
|
|
50
51
|
const fileList = await this.getMatchingFiles();
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
console.log(`Found ${fileList.length} schema file(s)`);
|
|
53
54
|
if (fileList.length === 0) {
|
|
54
|
-
|
|
55
|
+
writeLine(`Aborting - no files found with glob: ${glob}`);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
const fileSchemas = await this.getJsonSchemasForFiles(fileList);
|
|
58
59
|
|
|
59
60
|
if (fileSchemas.size === 0) {
|
|
60
|
-
|
|
61
|
+
writeLine(`Aborting - no types found: ${glob}`);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
this.writeSchemaMapToValidationSchema(fileSchemas);
|
|
64
65
|
if (helpers === false) {
|
|
65
|
-
|
|
66
|
+
writeLine("Skipping helper file generation");
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
69
|
await this.writeSchemaMapToValidationTypes(fileSchemas);
|
|
69
70
|
this.writeValidatorFunction();
|
|
70
|
-
|
|
71
|
+
writeLine("Writing validation types file");
|
|
71
72
|
this.writeValidationTypes(fileSchemas);
|
|
72
73
|
};
|
|
73
74
|
|
|
@@ -90,7 +91,7 @@ export class SchemaGenerator {
|
|
|
90
91
|
const schemaMap = new Map<string, Schema>();
|
|
91
92
|
const tsconfig = tsconfigPath.length > 0 ? tsconfigPath : undefined;
|
|
92
93
|
filesList.forEach((file, index) => {
|
|
93
|
-
|
|
94
|
+
writeLine(`\rProcessing file ${index + 1} of ${filesList.length}: ${file}`);
|
|
94
95
|
const config: Config = {
|
|
95
96
|
path: file,
|
|
96
97
|
type: "*",
|
package/src/writeLine.ts
ADDED