dtsgenerator 3.17.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/README.md CHANGED
@@ -143,6 +143,11 @@ Output debug message by [debug](https://www.npmjs.com/package/debug) library.
143
143
 
144
144
  ## ChangeLog
145
145
 
146
+ ### [v3.18.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.18.0) (2023-03-02)
147
+
148
+ - features:
149
+ - Support 'application/json' with parameter media type for #551. Thank you @denizkenan :+1:
150
+
146
151
  ### [v3.17.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.17.0) (2023-02-21)
147
152
 
148
153
  - features:
@@ -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(' pre process plugin:', pc.plugin.meta.name, pc.plugin.meta.description);
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 || content.additionalProperties)) {
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 === undefined
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 &&
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const JsonPointer = tslib_1.__importStar(require("../jsonPointer"));
6
6
  const schemaId_1 = tslib_1.__importDefault(require("./schemaId"));
7
7
  const type_1 = require("./type");
8
+ const utils_1 = require("./utils");
8
9
  function getSubSchema(rootSchema, pointer, id) {
9
10
  const content = JsonPointer.get(rootSchema.content, JsonPointer.parse(pointer));
10
11
  if (id == null) {
@@ -258,7 +259,7 @@ function searchAllSubSchema(schema, onFoundSchema, onFoundReference) {
258
259
  return;
259
260
  }
260
261
  for (const mime of Object.keys(types)) {
261
- if (/^text\/|^(?:application\/x-www-form-urlencoded$|^application\/([a-z0-9-_.]+\+)?json)$|^application\/octet-stream$|^application\/jwt$|^application\/vnd.apple.pkpass$|^multipart\/form-data$|^image\//.test(mime)) {
262
+ if ((0, utils_1.checkValidMIMEType)(mime)) {
262
263
  const mt = types[mime];
263
264
  if (mt != null) {
264
265
  setSubId(mt.schema, keys);
@@ -41,7 +41,7 @@ export declare namespace OpenApisV3 {
41
41
  url?: string;
42
42
  email?: string;
43
43
  }
44
- type DefaultType = null | any[] | unknown | number | boolean | string;
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 | unknown | any[];
245
+ type SpecificationExtension = null | number | boolean | string | any[];
246
246
  interface Strings {
247
247
  [name: string]: string;
248
248
  }
@@ -71,5 +71,5 @@ class SchemaId {
71
71
  return ids.map(validateIdentifier_1.toTypeName);
72
72
  }
73
73
  }
74
- exports.default = SchemaId;
75
74
  SchemaId.empty = new SchemaId('');
75
+ exports.default = SchemaId;
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 (_a = name, Promise.resolve().then(() => tslib_1.__importStar(require(_a)))));
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;
@@ -4,4 +4,5 @@ import { JsonSchemaObject } from './type';
4
4
  import SimpleTypes = JsonSchemaDraft04.Schema.Definitions.SimpleTypes;
5
5
  export declare function toTSType(type: string, debugSource?: JsonSchemaObject): ts.KeywordTypeSyntaxKind | ts.SyntaxKind.NullKeyword | undefined;
6
6
  export declare function reduceTypes(types: SimpleTypes[]): SimpleTypes[];
7
+ export declare function checkValidMIMEType(mime: string): boolean;
7
8
  export declare function mergeSchema(a: any, b: any): boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeSchema = exports.reduceTypes = exports.toTSType = void 0;
3
+ exports.mergeSchema = exports.checkValidMIMEType = exports.reduceTypes = exports.toTSType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const debug_1 = tslib_1.__importDefault(require("debug"));
6
6
  const ts = tslib_1.__importStar(require("typescript"));
@@ -42,6 +42,27 @@ function reduceTypes(types) {
42
42
  return Array.from(set.values());
43
43
  }
44
44
  exports.reduceTypes = reduceTypes;
45
+ function checkValidMIMEType(mime) {
46
+ var _a;
47
+ const type = (_a = mime.toLowerCase().split(';')[0]) === null || _a === void 0 ? void 0 : _a.trim();
48
+ if (type == null) {
49
+ return false;
50
+ }
51
+ if ([
52
+ 'application/octet-stream',
53
+ 'application/x-www-form-urlencoded',
54
+ 'multipart/form-data',
55
+ 'application/jwt',
56
+ 'application/vnd.apple.pkpass',
57
+ ].includes(type)) {
58
+ return true;
59
+ }
60
+ if (type.startsWith('text/') || type.startsWith('image/')) {
61
+ return true;
62
+ }
63
+ return /^application\/(?:[a-z0-9-_.]+\+)?json5?$/.test(type);
64
+ }
65
+ exports.checkValidMIMEType = checkValidMIMEType;
45
66
  function mergeSchema(a, b) {
46
67
  if ('$ref' in a || '$ref' in b) {
47
68
  a.$ref = b.$ref || a.$ref;
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import glob from 'glob';
3
+ import { GlobOptions } from 'glob';
4
4
  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: string): RequestInit | undefined;
9
- export declare function globFiles(pattern: string, options?: glob.IOptions): Promise<string[]>;
8
+ export declare function buildProxyOptions<Uri extends string>(url: Uri): RequestInit | undefined;
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 = tslib_1.__importDefault(require("glob"));
8
- const https_proxy_agent_1 = tslib_1.__importDefault(require("https-proxy-agent"));
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,39 +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
- proxyUrl = new url_1.URL(process.env.HTTP_PROXY);
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
- proxyUrl = new url_1.URL(process.env.HTTPS_PROXY);
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
- function globFiles(pattern, options) {
66
- return new Promise((resolve, reject) => {
67
- (0, glob_1.default)(pattern, options !== null && options !== void 0 ? options : {}, (err, matches) => {
68
- if (err) {
69
- reject(err);
70
- }
71
- else {
72
- resolve(matches);
73
- }
74
- });
75
- });
59
+ async function globFiles(pattern, options) {
60
+ const result = [];
61
+ for await (const r of (0, glob_1.globIterate)(pattern, options !== null && options !== void 0 ? options : {})) {
62
+ if (typeof r === 'string') {
63
+ result.push(r);
64
+ }
65
+ else {
66
+ result.push(r.fullpath());
67
+ }
68
+ }
69
+ return result;
76
70
  }
77
71
  exports.globFiles = globFiles;
78
72
  function readConfig(options) {
@@ -150,6 +144,10 @@ function convertToScriptTarget(target) {
150
144
  return typescript_1.ScriptTarget.ES2019;
151
145
  case 'es2020':
152
146
  return typescript_1.ScriptTarget.ES2020;
147
+ case 'es2021':
148
+ return typescript_1.ScriptTarget.ES2021;
149
+ case 'es2022':
150
+ return typescript_1.ScriptTarget.ES2022;
153
151
  case 'esnext':
154
152
  return typescript_1.ScriptTarget.ESNext;
155
153
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtsgenerator",
3
- "version": "3.17.0",
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": ">= 14.0"
44
+ "node": ">= 16.0"
45
45
  },
46
46
  "dependencies": {
47
- "commander": "^10.0.0",
48
- "cross-fetch": "^3.1.5",
47
+ "commander": "^11.0.0",
48
+ "cross-fetch": "^4.0.0",
49
49
  "debug": "^4.3.4",
50
- "glob": "^8.1.0",
51
- "https-proxy-agent": "^5.0.1",
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.5.0",
54
- "typescript": "^4.9.5"
54
+ "tslib": "^2.6.2",
55
+ "typescript": "^5.1.6"
55
56
  },
56
57
  "devDependencies": {
57
- "@dtsgenerator/do-nothing": "^2.5.3",
58
- "@dtsgenerator/eslint-config": "^0.6.4",
59
- "@dtsgenerator/replace-namespace": "^1.5.4",
60
- "@dtsgenerator/single-quote": "^1.6.3",
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.7",
63
- "@types/glob": "^8.0.1",
63
+ "@types/debug": "^4.1.8",
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.12",
67
+ "@types/node": "^16.18.41",
67
68
  "cross-env": "^7.0.3",
68
- "eslint": "^8.34.0",
69
+ "eslint": "^8.47.0",
69
70
  "husky": "^8.0.3",
70
- "lint-staged": "^13.1.2",
71
+ "lint-staged": "^14.0.1",
71
72
  "mocha": "^10.2.0",
72
73
  "nyc": "^15.1.0",
73
- "prettier": "^2.8.4",
74
- "rimraf": "^4.1.2",
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);
@@ -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
 
@@ -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;
@@ -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();