dtsgenerator 3.18.0 → 3.19.0
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/dist/core/dtsGenerator.js +4 -5
- package/dist/core/openApiV3.d.ts +2 -2
- package/dist/core/schemaId.js +1 -1
- package/dist/core/type.js +1 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +15 -20
- package/package.json +19 -18
- package/src/cli.ts +3 -3
- package/src/commandOptions.ts +4 -4
- package/src/core/astBuilder.ts +28 -28
- package/src/core/config.ts +1 -1
- package/src/core/dtsGenerator.ts +63 -63
- package/src/core/jsonSchema.ts +37 -37
- package/src/core/openApiV2.ts +2 -2
- package/src/core/openApiV3.ts +1 -8
- package/src/core/referenceResolver.ts +9 -9
- package/src/core/schemaId.ts +4 -1
- package/src/core/type.ts +9 -9
- package/src/core/utils.ts +3 -3
- package/src/core/validateIdentifier.ts +2 -1
- package/src/jsonPointer.ts +1 -1
- package/src/utils.ts +23 -25
|
@@ -90,7 +90,7 @@ class DtsGenerator {
|
|
|
90
90
|
const factory = await p({ inputSchemas, option: pc.option });
|
|
91
91
|
if (factory != null) {
|
|
92
92
|
result.push(factory);
|
|
93
|
-
debug('
|
|
93
|
+
debug(' post process plugin:', pc.plugin.meta.name, pc.plugin.meta.description);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
return result;
|
|
@@ -140,6 +140,7 @@ class DtsGenerator {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
normalizeSchemaContent(content) {
|
|
143
|
+
var _a;
|
|
143
144
|
if (typeof content === 'boolean') {
|
|
144
145
|
content = content ? {} : { not: {} };
|
|
145
146
|
}
|
|
@@ -163,7 +164,7 @@ class DtsGenerator {
|
|
|
163
164
|
content = Object.assign(content, work);
|
|
164
165
|
}
|
|
165
166
|
if (content.type === undefined &&
|
|
166
|
-
(content.properties
|
|
167
|
+
((_a = content.properties) !== null && _a !== void 0 ? _a : content.additionalProperties)) {
|
|
167
168
|
content.type = 'object';
|
|
168
169
|
}
|
|
169
170
|
if (content.nullable) {
|
|
@@ -379,9 +380,7 @@ class DtsGenerator {
|
|
|
379
380
|
const additionalItemsNode = getAdditionalItemNode();
|
|
380
381
|
return additionalItemsNode === false
|
|
381
382
|
? ast.buildTupleTypeNode([], 0, 0, additionalItemsNode)
|
|
382
|
-
: ast.buildSimpleArrayNode(additionalItemsNode
|
|
383
|
-
? ast.buildAnyKeyword()
|
|
384
|
-
: additionalItemsNode);
|
|
383
|
+
: ast.buildSimpleArrayNode(additionalItemsNode !== null && additionalItemsNode !== void 0 ? additionalItemsNode : ast.buildAnyKeyword());
|
|
385
384
|
}
|
|
386
385
|
else if (minItems != null &&
|
|
387
386
|
maxItems != null &&
|
package/dist/core/openApiV3.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare namespace OpenApisV3 {
|
|
|
41
41
|
url?: string;
|
|
42
42
|
email?: string;
|
|
43
43
|
}
|
|
44
|
-
type DefaultType = null | any[] |
|
|
44
|
+
type DefaultType = null | any[] | number | boolean | string;
|
|
45
45
|
interface Discriminator {
|
|
46
46
|
propertyName: string;
|
|
47
47
|
mapping?: Strings;
|
|
@@ -242,7 +242,7 @@ export declare namespace OpenApisV3 {
|
|
|
242
242
|
interface ServerVariables {
|
|
243
243
|
[name: string]: ServerVariable;
|
|
244
244
|
}
|
|
245
|
-
type SpecificationExtension = null | number | boolean | string |
|
|
245
|
+
type SpecificationExtension = null | number | boolean | string | any[];
|
|
246
246
|
interface Strings {
|
|
247
247
|
[name: string]: string;
|
|
248
248
|
}
|
package/dist/core/schemaId.js
CHANGED
package/dist/core/type.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.loadPlugin = exports.parseFileContent = exports.readSchemaFromUrl = exports.readSchemasFromFile = exports.readSchemaFromStdin = exports.parseSchema = exports.isJsonSchemaDraft04 = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -82,7 +81,7 @@ async function loadPlugin(name, option) {
|
|
|
82
81
|
if (!option) {
|
|
83
82
|
return undefined;
|
|
84
83
|
}
|
|
85
|
-
const mod = (await
|
|
84
|
+
const mod = (await Promise.resolve(`${name}`).then(s => tslib_1.__importStar(require(s))));
|
|
86
85
|
if (!mod.default) {
|
|
87
86
|
console.warn(`The plugin (${name}) is invalid module. That is not default export format.`);
|
|
88
87
|
return undefined;
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import { CommandOptions } from './commandOptions';
|
|
|
5
5
|
import { PartialConfig } from './core/config';
|
|
6
6
|
export declare function readStream(stream: NodeJS.ReadableStream, encoding?: BufferEncoding): Promise<string>;
|
|
7
7
|
export declare function readUrl(url: string): Promise<string>;
|
|
8
|
-
export declare function buildProxyOptions(url:
|
|
8
|
+
export declare function buildProxyOptions<Uri extends string>(url: Uri): RequestInit | undefined;
|
|
9
9
|
export declare function globFiles(pattern: string, options?: GlobOptions): Promise<string[]>;
|
|
10
10
|
export declare function readConfig(options: CommandOptions): PartialConfig;
|
package/dist/utils.js
CHANGED
|
@@ -4,8 +4,9 @@ exports.readConfig = exports.globFiles = exports.buildProxyOptions = exports.rea
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const url_1 = require("url");
|
|
7
|
-
const glob_1 =
|
|
8
|
-
const
|
|
7
|
+
const glob_1 = require("glob");
|
|
8
|
+
const http_proxy_agent_1 = require("http-proxy-agent");
|
|
9
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
9
10
|
const typescript_1 = require("typescript");
|
|
10
11
|
const commandOptions_1 = require("./commandOptions");
|
|
11
12
|
function readStream(stream, encoding = 'utf8') {
|
|
@@ -40,38 +41,32 @@ function noProxy(url) {
|
|
|
40
41
|
}
|
|
41
42
|
function buildProxyOptions(url) {
|
|
42
43
|
const parsedUrl = new url_1.URL(url);
|
|
43
|
-
let proxyUrl;
|
|
44
44
|
if (!noProxy(parsedUrl)) {
|
|
45
45
|
if (parsedUrl.protocol === 'http:' && process.env.HTTP_PROXY) {
|
|
46
|
-
|
|
46
|
+
return {
|
|
47
|
+
agent: new http_proxy_agent_1.HttpProxyAgent(process.env.HTTP_PROXY),
|
|
48
|
+
};
|
|
47
49
|
}
|
|
48
50
|
else if (parsedUrl.protocol === 'https:' && process.env.HTTPS_PROXY) {
|
|
49
|
-
|
|
51
|
+
return {
|
|
52
|
+
agent: new https_proxy_agent_1.HttpsProxyAgent(process.env.HTTPS_PROXY),
|
|
53
|
+
};
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
|
-
if (proxyUrl) {
|
|
53
|
-
const agentOptions = {};
|
|
54
|
-
agentOptions.protocol = proxyUrl.protocol;
|
|
55
|
-
agentOptions.host = proxyUrl.hostname;
|
|
56
|
-
agentOptions.port = proxyUrl.port;
|
|
57
|
-
if (proxyUrl.username) {
|
|
58
|
-
agentOptions.auth = proxyUrl.username + ':' + proxyUrl.password;
|
|
59
|
-
}
|
|
60
|
-
return { agent: (0, https_proxy_agent_1.default)(agentOptions) };
|
|
61
|
-
}
|
|
62
56
|
return undefined;
|
|
63
57
|
}
|
|
64
58
|
exports.buildProxyOptions = buildProxyOptions;
|
|
65
59
|
async function globFiles(pattern, options) {
|
|
66
|
-
const
|
|
67
|
-
|
|
60
|
+
const result = [];
|
|
61
|
+
for await (const r of (0, glob_1.globIterate)(pattern, options !== null && options !== void 0 ? options : {})) {
|
|
68
62
|
if (typeof r === 'string') {
|
|
69
|
-
|
|
63
|
+
result.push(r);
|
|
70
64
|
}
|
|
71
65
|
else {
|
|
72
|
-
|
|
66
|
+
result.push(r.fullpath());
|
|
73
67
|
}
|
|
74
|
-
}
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
75
70
|
}
|
|
76
71
|
exports.globFiles = globFiles;
|
|
77
72
|
function readConfig(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtsgenerator",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "TypeScript d.ts file generator for JSON Schema file",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dtsgen": "bin/dtsgen"
|
|
@@ -41,37 +41,38 @@
|
|
|
41
41
|
"url": "https://github.com/horiuchi/dtsgenerator/issues"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">= 16.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"commander": "^
|
|
48
|
-
"cross-fetch": "^
|
|
47
|
+
"commander": "^11.0.0",
|
|
48
|
+
"cross-fetch": "^4.0.0",
|
|
49
49
|
"debug": "^4.3.4",
|
|
50
|
-
"glob": "^
|
|
51
|
-
"
|
|
50
|
+
"glob": "^10.3.3",
|
|
51
|
+
"http-proxy-agent": "^7.0.0",
|
|
52
|
+
"https-proxy-agent": "^7.0.1",
|
|
52
53
|
"js-yaml": "^4.1.0",
|
|
53
|
-
"tslib": "^2.
|
|
54
|
-
"typescript": "^
|
|
54
|
+
"tslib": "^2.6.2",
|
|
55
|
+
"typescript": "^5.1.6"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@dtsgenerator/do-nothing": "^2.5.
|
|
58
|
-
"@dtsgenerator/eslint-config": "^0.6.
|
|
59
|
-
"@dtsgenerator/replace-namespace": "^1.5.
|
|
60
|
-
"@dtsgenerator/single-quote": "^1.6.
|
|
58
|
+
"@dtsgenerator/do-nothing": "^2.5.4",
|
|
59
|
+
"@dtsgenerator/eslint-config": "^0.6.5",
|
|
60
|
+
"@dtsgenerator/replace-namespace": "^1.5.5",
|
|
61
|
+
"@dtsgenerator/single-quote": "^1.6.5",
|
|
61
62
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
62
|
-
"@types/debug": "^4.1.
|
|
63
|
+
"@types/debug": "^4.1.8",
|
|
63
64
|
"@types/glob": "^8.1.0",
|
|
64
65
|
"@types/js-yaml": "^4.0.5",
|
|
65
66
|
"@types/mocha": "^10.0.1",
|
|
66
|
-
"@types/node": "^16.18.
|
|
67
|
+
"@types/node": "^16.18.41",
|
|
67
68
|
"cross-env": "^7.0.3",
|
|
68
|
-
"eslint": "^8.
|
|
69
|
+
"eslint": "^8.47.0",
|
|
69
70
|
"husky": "^8.0.3",
|
|
70
|
-
"lint-staged": "^
|
|
71
|
+
"lint-staged": "^14.0.1",
|
|
71
72
|
"mocha": "^10.2.0",
|
|
72
73
|
"nyc": "^15.1.0",
|
|
73
|
-
"prettier": "^
|
|
74
|
-
"rimraf": "^
|
|
74
|
+
"prettier": "^3.0.2",
|
|
75
|
+
"rimraf": "^5.0.1",
|
|
75
76
|
"source-map-support": "^0.5.21",
|
|
76
77
|
"ts-node": "^10.9.1"
|
|
77
78
|
},
|
package/src/cli.ts
CHANGED
|
@@ -17,21 +17,21 @@ async function loadContents(): Promise<Schema[]> {
|
|
|
17
17
|
ps.push(
|
|
18
18
|
readSchemaFromStdin().then((s) => {
|
|
19
19
|
contents.push(s);
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
for (const pattern of config.input.files) {
|
|
24
24
|
ps.push(
|
|
25
25
|
readSchemasFromFile(pattern).then((ss) => {
|
|
26
26
|
contents = contents.concat(ss);
|
|
27
|
-
})
|
|
27
|
+
}),
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
for (const url of config.input.urls) {
|
|
31
31
|
ps.push(
|
|
32
32
|
readSchemaFromUrl(url).then((s) => {
|
|
33
33
|
contents.push(s);
|
|
34
|
-
})
|
|
34
|
+
}),
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
await Promise.all(ps);
|
package/src/commandOptions.ts
CHANGED
|
@@ -53,17 +53,17 @@ function parse(options: CommandOptions, argv: string[]): commander.Command {
|
|
|
53
53
|
'--url <url>',
|
|
54
54
|
'input json schema from the url.',
|
|
55
55
|
collectUrl,
|
|
56
|
-
[]
|
|
56
|
+
[],
|
|
57
57
|
)
|
|
58
58
|
.option('--stdin', 'read stdin with other files or urls.')
|
|
59
59
|
.option('-o, --out <file>', 'output filename.')
|
|
60
60
|
.option(
|
|
61
61
|
'-t, --target <version>',
|
|
62
|
-
"Specify ECMAScript target version: 'ES3', 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT' (default)."
|
|
62
|
+
"Specify ECMAScript target version: 'ES3', 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT' (default).",
|
|
63
63
|
)
|
|
64
64
|
.option(
|
|
65
65
|
'--info',
|
|
66
|
-
'for developer mode. output loaded config and plugin details only.'
|
|
66
|
+
'for developer mode. output loaded config and plugin details only.',
|
|
67
67
|
)
|
|
68
68
|
.option('--output-ast', 'output TypeScript AST instead of d.ts file.')
|
|
69
69
|
.addHelpText(
|
|
@@ -76,7 +76,7 @@ Examples:
|
|
|
76
76
|
$ dtsgen -o swaggerSchema.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json
|
|
77
77
|
$ dtsgen -o petstore.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml
|
|
78
78
|
$ dtsgen -c dtsgen-test.json --info
|
|
79
|
-
|
|
79
|
+
`,
|
|
80
80
|
)
|
|
81
81
|
.parse(argv);
|
|
82
82
|
|
package/src/core/astBuilder.ts
CHANGED
|
@@ -17,7 +17,7 @@ function buildPropertyNameIdentifier(name: string): ts.PropertyName {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function buildKeyword(
|
|
20
|
-
kind: ts.KeywordTypeSyntaxKind
|
|
20
|
+
kind: ts.KeywordTypeSyntaxKind,
|
|
21
21
|
): ts.KeywordTypeNode {
|
|
22
22
|
return ts.factory.createKeywordTypeNode(kind);
|
|
23
23
|
}
|
|
@@ -41,7 +41,7 @@ export function buildSimpleArrayNode(element: ts.TypeNode): ts.ArrayTypeNode {
|
|
|
41
41
|
}
|
|
42
42
|
export function buildNullKeyword(): ts.LiteralTypeNode {
|
|
43
43
|
return ts.factory.createLiteralTypeNode(
|
|
44
|
-
ts.factory.createToken(ts.SyntaxKind.NullKeyword)
|
|
44
|
+
ts.factory.createToken(ts.SyntaxKind.NullKeyword),
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
export function buildStringLiteralTypeNode(s: string): ts.LiteralTypeNode {
|
|
@@ -52,14 +52,14 @@ export function buildNumericLiteralTypeNode(n: string): ts.LiteralTypeNode {
|
|
|
52
52
|
}
|
|
53
53
|
export function buildBooleanLiteralTypeNode(b: boolean): ts.LiteralTypeNode {
|
|
54
54
|
return ts.factory.createLiteralTypeNode(
|
|
55
|
-
b ? ts.factory.createTrue() : ts.factory.createFalse()
|
|
55
|
+
b ? ts.factory.createTrue() : ts.factory.createFalse(),
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function buildNamespaceNode(
|
|
60
60
|
name: string,
|
|
61
61
|
statements: ts.Statement[],
|
|
62
|
-
root: boolean
|
|
62
|
+
root: boolean,
|
|
63
63
|
): ts.ModuleDeclaration {
|
|
64
64
|
const modifiers = root
|
|
65
65
|
? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
|
|
@@ -70,14 +70,14 @@ export function buildNamespaceNode(
|
|
|
70
70
|
ts.factory.createModuleBlock(statements),
|
|
71
71
|
ts.NodeFlags.Namespace |
|
|
72
72
|
ts.NodeFlags.ExportContext |
|
|
73
|
-
ts.NodeFlags.ContextFlags
|
|
73
|
+
ts.NodeFlags.ContextFlags,
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export function buildInterfaceNode(
|
|
78
78
|
id: SchemaId,
|
|
79
79
|
members: ts.TypeElement[],
|
|
80
|
-
root: boolean
|
|
80
|
+
root: boolean,
|
|
81
81
|
): ts.InterfaceDeclaration {
|
|
82
82
|
const name = getLastTypeName(id);
|
|
83
83
|
const modifiers = root
|
|
@@ -88,14 +88,14 @@ export function buildInterfaceNode(
|
|
|
88
88
|
buildTypeNameIdentifier(name),
|
|
89
89
|
undefined,
|
|
90
90
|
undefined,
|
|
91
|
-
members
|
|
91
|
+
members,
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export function buildTypeAliasNode(
|
|
96
96
|
id: SchemaId,
|
|
97
97
|
type: ts.TypeNode,
|
|
98
|
-
root: boolean
|
|
98
|
+
root: boolean,
|
|
99
99
|
): ts.TypeAliasDeclaration {
|
|
100
100
|
const name = getLastTypeName(id);
|
|
101
101
|
const modifiers = root
|
|
@@ -105,7 +105,7 @@ export function buildTypeAliasNode(
|
|
|
105
105
|
modifiers,
|
|
106
106
|
buildTypeNameIdentifier(name),
|
|
107
107
|
undefined,
|
|
108
|
-
type
|
|
108
|
+
type,
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -114,7 +114,7 @@ export function buildPropertySignature(
|
|
|
114
114
|
propertyName: string,
|
|
115
115
|
valueType: ts.TypeNode,
|
|
116
116
|
required: string[] | undefined,
|
|
117
|
-
isPattern: boolean | undefined
|
|
117
|
+
isPattern: boolean | undefined,
|
|
118
118
|
): ts.PropertySignature | ts.IndexSignatureDeclaration {
|
|
119
119
|
const modifiers = undefined;
|
|
120
120
|
const questionToken =
|
|
@@ -131,24 +131,24 @@ export function buildPropertySignature(
|
|
|
131
131
|
ts.factory.createIdentifier('pattern'),
|
|
132
132
|
undefined,
|
|
133
133
|
ts.factory.createTypeReferenceNode('string', []),
|
|
134
|
-
undefined
|
|
134
|
+
undefined,
|
|
135
135
|
),
|
|
136
136
|
],
|
|
137
|
-
valueType
|
|
137
|
+
valueType,
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
return ts.factory.createPropertySignature(
|
|
141
141
|
modifiers,
|
|
142
142
|
buildPropertyNameIdentifier(propertyName),
|
|
143
143
|
questionToken,
|
|
144
|
-
valueType
|
|
144
|
+
valueType,
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
export function buildIndexSignatureNode(
|
|
149
149
|
name: string,
|
|
150
150
|
indexType: ts.TypeNode,
|
|
151
|
-
valueType: ts.TypeNode
|
|
151
|
+
valueType: ts.TypeNode,
|
|
152
152
|
): ts.IndexSignatureDeclaration {
|
|
153
153
|
return ts.factory.createIndexSignature(
|
|
154
154
|
undefined,
|
|
@@ -159,10 +159,10 @@ export function buildIndexSignatureNode(
|
|
|
159
159
|
buildTypeNameIdentifier(name),
|
|
160
160
|
undefined,
|
|
161
161
|
indexType,
|
|
162
|
-
undefined
|
|
162
|
+
undefined,
|
|
163
163
|
),
|
|
164
164
|
],
|
|
165
|
-
valueType
|
|
165
|
+
valueType,
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -179,7 +179,7 @@ export function buildFreeFormObjectTypeLiteralNode(): ts.TypeNode {
|
|
|
179
179
|
export function buildUnionTypeNode<T>(
|
|
180
180
|
types: T[],
|
|
181
181
|
builder: (t: T, index: number) => ts.TypeNode,
|
|
182
|
-
terminate: boolean
|
|
182
|
+
terminate: boolean,
|
|
183
183
|
): ts.TypeNode {
|
|
184
184
|
const node = ts.factory.createUnionTypeNode(types.map(builder));
|
|
185
185
|
if (terminate) {
|
|
@@ -190,7 +190,7 @@ export function buildUnionTypeNode<T>(
|
|
|
190
190
|
|
|
191
191
|
export function buildIntersectionTypeNode(
|
|
192
192
|
types: readonly ts.TypeNode[],
|
|
193
|
-
terminate: boolean
|
|
193
|
+
terminate: boolean,
|
|
194
194
|
): ts.TypeNode {
|
|
195
195
|
const node = ts.factory.createIntersectionTypeNode(types);
|
|
196
196
|
if (terminate) {
|
|
@@ -203,7 +203,7 @@ export function buildTupleTypeNode(
|
|
|
203
203
|
types: ts.TypeNode | ts.TypeNode[],
|
|
204
204
|
minItems?: number,
|
|
205
205
|
maxItems?: number,
|
|
206
|
-
additionalItems?: ts.TypeNode | false
|
|
206
|
+
additionalItems?: ts.TypeNode | false,
|
|
207
207
|
): ts.TypeNode {
|
|
208
208
|
function typesIsArray<T>(types: T | T[]): types is T[] {
|
|
209
209
|
return Array.isArray(types);
|
|
@@ -247,9 +247,9 @@ export function buildTupleTypeNode(
|
|
|
247
247
|
? additionalItems !== undefined
|
|
248
248
|
? (additionalItems as ts.TypeNode)
|
|
249
249
|
: buildAnyKeyword()
|
|
250
|
-
: types
|
|
251
|
-
)
|
|
252
|
-
)
|
|
250
|
+
: types,
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
253
|
);
|
|
254
254
|
}
|
|
255
255
|
return ts.factory.createTupleTypeNode(nodes);
|
|
@@ -257,7 +257,7 @@ export function buildTupleTypeNode(
|
|
|
257
257
|
|
|
258
258
|
export function buildTypeReferenceNode(
|
|
259
259
|
schema: NormalizedSchema,
|
|
260
|
-
currentSchema: Schema
|
|
260
|
+
currentSchema: Schema,
|
|
261
261
|
): ts.TypeReferenceNode {
|
|
262
262
|
const typeName = getTypename(schema.id, currentSchema);
|
|
263
263
|
let node: ts.EntityName | undefined;
|
|
@@ -267,7 +267,7 @@ export function buildTypeReferenceNode(
|
|
|
267
267
|
} else {
|
|
268
268
|
node = ts.factory.createQualifiedName(
|
|
269
269
|
node,
|
|
270
|
-
buildTypeNameIdentifier(name)
|
|
270
|
+
buildTypeNameIdentifier(name),
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -296,7 +296,7 @@ function getTypename(id: SchemaId, baseSchema: Schema): string[] {
|
|
|
296
296
|
export function addComment<T extends ts.Node>(
|
|
297
297
|
node: T,
|
|
298
298
|
schema: NormalizedSchema,
|
|
299
|
-
terminate: boolean
|
|
299
|
+
terminate: boolean,
|
|
300
300
|
): T {
|
|
301
301
|
const comments = getComment(schema);
|
|
302
302
|
if (comments.length === 0) {
|
|
@@ -306,7 +306,7 @@ export function addComment<T extends ts.Node>(
|
|
|
306
306
|
node,
|
|
307
307
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
308
308
|
` ${comments[0] ?? ''} `,
|
|
309
|
-
false
|
|
309
|
+
false,
|
|
310
310
|
);
|
|
311
311
|
} else {
|
|
312
312
|
let result = '*\n';
|
|
@@ -318,7 +318,7 @@ export function addComment<T extends ts.Node>(
|
|
|
318
318
|
node,
|
|
319
319
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
320
320
|
result,
|
|
321
|
-
true
|
|
321
|
+
true,
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
@@ -363,7 +363,7 @@ function getComment(schema: NormalizedSchema): string[] {
|
|
|
363
363
|
export function addOptionalInformation<T extends ts.Node>(
|
|
364
364
|
node: T,
|
|
365
365
|
schema: NormalizedSchema,
|
|
366
|
-
terminate: boolean
|
|
366
|
+
terminate: boolean,
|
|
367
367
|
): T {
|
|
368
368
|
const format = schema.content.format;
|
|
369
369
|
const pattern = schema.content.pattern;
|
package/src/core/config.ts
CHANGED
|
@@ -85,7 +85,7 @@ export async function showConfig(version: string, c: Config): Promise<void> {
|
|
|
85
85
|
console.log('Plugins: count=' + plugins.length.toString());
|
|
86
86
|
for (const p of plugins) {
|
|
87
87
|
console.log(
|
|
88
|
-
` ${p.meta.name}@${p.meta.version}: ${p.meta.description ?? ''}
|
|
88
|
+
` ${p.meta.name}@${p.meta.version}: ${p.meta.description ?? ''}`,
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
console.log();
|