dtsgenerator 3.19.0 → 3.19.2

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.
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-interface */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
3
  /* eslint-disable @typescript-eslint/no-namespace */
4
4
  import { JsonSchemaDraft07 } from './jsonSchemaDraft07';
5
5
 
@@ -20,21 +20,18 @@ export namespace OpenApisV3 {
20
20
  }
21
21
  export namespace SchemaJson {
22
22
  export namespace Definitions {
23
- export interface Any {
24
- [name: string]: any;
25
- }
23
+ export type Any = Record<string, any>;
26
24
  export type AnyOrExpression = Any | Expression;
27
- export interface AnysOrExpressions {
28
- [name: string]: AnyOrExpression;
29
- }
25
+ export type AnysOrExpressions = Record<string, AnyOrExpression>;
30
26
  /**
31
27
  * A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
32
28
  */
33
29
  export interface Callback {}
34
30
  export type CallbackOrReference = Callback | Reference;
35
- export interface CallbacksOrReferences {
36
- [name: string]: CallbackOrReference;
37
- }
31
+ export type CallbacksOrReferences = Record<
32
+ string,
33
+ CallbackOrReference
34
+ >;
38
35
  /**
39
36
  * Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
40
37
  */
@@ -75,9 +72,7 @@ export namespace OpenApisV3 {
75
72
  explode?: boolean;
76
73
  allowReserved?: boolean;
77
74
  }
78
- export interface Encodings {
79
- [name: string]: Encoding;
80
- }
75
+ export type Encodings = Record<string, Encoding>;
81
76
  /**
82
77
  *
83
78
  */
@@ -88,12 +83,11 @@ export namespace OpenApisV3 {
88
83
  externalValue?: string;
89
84
  }
90
85
  export type ExampleOrReference = Example | Reference;
91
- export interface ExamplesOrReferences {
92
- [name: string]: ExampleOrReference;
93
- }
94
- export interface Expression {
95
- [name: string]: any;
96
- }
86
+ export type ExamplesOrReferences = Record<
87
+ string,
88
+ ExampleOrReference
89
+ >;
90
+ export type Expression = Record<string, any>;
97
91
  /**
98
92
  * Allows referencing an external resource for extended documentation.
99
93
  */
@@ -118,9 +112,7 @@ export namespace OpenApisV3 {
118
112
  content?: MediaTypes;
119
113
  }
120
114
  export type HeaderOrReference = Header | Reference;
121
- export interface HeadersOrReferences {
122
- [name: string]: HeaderOrReference;
123
- }
115
+ export type HeadersOrReferences = Record<string, HeaderOrReference>;
124
116
  /**
125
117
  * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
126
118
  */
@@ -151,9 +143,7 @@ export namespace OpenApisV3 {
151
143
  server?: Server;
152
144
  }
153
145
  export type LinkOrReference = Link | Reference;
154
- export interface LinksOrReferences {
155
- [name: string]: LinkOrReference;
156
- }
146
+ export type LinksOrReferences = Record<string, LinkOrReference>;
157
147
  /**
158
148
  * Each Media Type Object provides schema and examples for the media type identified by its key.
159
149
  */
@@ -163,9 +153,7 @@ export namespace OpenApisV3 {
163
153
  examples?: ExamplesOrReferences;
164
154
  encoding?: Encodings;
165
155
  }
166
- export interface MediaTypes {
167
- [name: string]: MediaType;
168
- }
156
+ export type MediaTypes = Record<string, MediaType>;
169
157
  /**
170
158
  * Configuration details for a supported OAuth Flow
171
159
  */
@@ -220,9 +208,10 @@ export namespace OpenApisV3 {
220
208
  content?: MediaTypes;
221
209
  }
222
210
  export type ParameterOrReference = Parameter | Reference;
223
- export interface ParametersOrReferences {
224
- [name: string]: ParameterOrReference;
225
- }
211
+ export type ParametersOrReferences = Record<
212
+ string,
213
+ ParameterOrReference
214
+ >;
226
215
  /**
227
216
  * Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
228
217
  */
@@ -245,18 +234,17 @@ export namespace OpenApisV3 {
245
234
  /**
246
235
  * Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.
247
236
  */
248
- export interface Paths {
249
- [name: string]: PathItemOrReference;
250
- }
237
+ export type Paths = Record<string, PathItemOrReference>;
251
238
  /**
252
239
  * A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
253
240
  */
254
241
  export interface Reference {
255
242
  $ref: string;
256
243
  }
257
- export interface RequestBodiesOrReferences {
258
- [name: string]: RequestBodyOrReference;
259
- }
244
+ export type RequestBodiesOrReferences = Record<
245
+ string,
246
+ RequestBodyOrReference
247
+ >;
260
248
  /**
261
249
  * Describes a single request body.
262
250
  */
@@ -279,15 +267,14 @@ export namespace OpenApisV3 {
279
267
  /**
280
268
  * A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
281
269
  */
282
- export interface ResponsesOrReferences {
283
- [name: string]: ResponseOrReference;
284
- }
270
+ export type ResponsesOrReferences = Record<
271
+ string,
272
+ ResponseOrReference
273
+ >;
285
274
  export type SchemaOrReference =
286
275
  | JsonSchemaDraft07.SchemaObject
287
276
  | Reference;
288
- export interface SchemasOrReferences {
289
- [name: string]: SchemaOrReference;
290
- }
277
+ export type SchemasOrReferences = Record<string, SchemaOrReference>;
291
278
  /**
292
279
  * Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.
293
280
  */
@@ -306,9 +293,10 @@ export namespace OpenApisV3 {
306
293
  openIdConnectUrl?: string;
307
294
  }
308
295
  export type SecuritySchemeOrReference = SecurityScheme | Reference;
309
- export interface SecuritySchemesOrReferences {
310
- [name: string]: SecuritySchemeOrReference;
311
- }
296
+ export type SecuritySchemesOrReferences = Record<
297
+ string,
298
+ SecuritySchemeOrReference
299
+ >;
312
300
  /**
313
301
  * An object representing a Server.
314
302
  */
@@ -325,9 +313,7 @@ export namespace OpenApisV3 {
325
313
  default: string;
326
314
  description?: string;
327
315
  }
328
- export interface ServerVariables {
329
- [name: string]: ServerVariable;
330
- }
316
+ export type ServerVariables = Record<string, ServerVariable>;
331
317
  /**
332
318
  * Any property starting with x- is valid.
333
319
  */
@@ -337,9 +323,7 @@ export namespace OpenApisV3 {
337
323
  | boolean
338
324
  | string
339
325
  | any[];
340
- export interface Strings {
341
- [name: string]: string;
342
- }
326
+ export type Strings = Record<string, string>;
343
327
  /**
344
328
  * Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
345
329
  */
package/src/core/type.ts CHANGED
@@ -12,7 +12,7 @@ import { OpenApisV3 } from './openApiV3';
12
12
  import SchemaId from './schemaId';
13
13
 
14
14
  // export `ts` for using the same version of TypeScript in all plugins.
15
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+
16
16
  export import ts = require('typescript');
17
17
 
18
18
  // Schema types
@@ -119,7 +119,7 @@ export interface PluginContext {
119
119
 
120
120
  export type PreProcessHandler = (contents: Schema[]) => Schema[];
121
121
 
122
- export type Plugin = {
122
+ export interface Plugin {
123
123
  meta: {
124
124
  name: string;
125
125
  version: string;
@@ -131,7 +131,7 @@ export type Plugin = {
131
131
  postProcess?: (
132
132
  context: PluginContext,
133
133
  ) => Promise<TransformerFactory<SourceFile> | undefined>;
134
- };
134
+ }
135
135
 
136
136
  export async function loadPlugin(
137
137
  name: string,
package/src/core/utils.ts CHANGED
@@ -78,7 +78,6 @@ export function checkValidMIMEType(mime: string): boolean {
78
78
  return /^application\/(?:[a-z0-9-_.]+\+)?json5?$/.test(type);
79
79
  }
80
80
 
81
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
82
81
  export function mergeSchema(a: any, b: any): boolean {
83
82
  if ('$ref' in a || '$ref' in b) {
84
83
  a.$ref = b.$ref || a.$ref;
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
1
  /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
3
2
  import { ScriptTarget } from 'typescript';
4
3
 
@@ -785,16 +784,16 @@ function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) {
785
784
  return languageVersion >= ScriptTarget.ES2015
786
785
  ? lookupInUnicodeMap(code, unicodeESNextIdentifierStart)
787
786
  : languageVersion === ScriptTarget.ES5
788
- ? lookupInUnicodeMap(code, unicodeES5IdentifierStart)
789
- : lookupInUnicodeMap(code, unicodeES3IdentifierStart);
787
+ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart)
788
+ : lookupInUnicodeMap(code, unicodeES3IdentifierStart);
790
789
  }
791
790
 
792
791
  function isUnicodeIdentifierPart(code: number, languageVersion: ScriptTarget) {
793
792
  return languageVersion >= ScriptTarget.ES2015
794
793
  ? lookupInUnicodeMap(code, unicodeESNextIdentifierPart)
795
794
  : languageVersion === ScriptTarget.ES5
796
- ? lookupInUnicodeMap(code, unicodeES5IdentifierPart)
797
- : lookupInUnicodeMap(code, unicodeES3IdentifierPart);
795
+ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart)
796
+ : lookupInUnicodeMap(code, unicodeES3IdentifierPart);
798
797
  }
799
798
 
800
799
  function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean {
@@ -1,7 +1,5 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
1
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
2
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
- /* eslint-disable @typescript-eslint/no-unsafe-return */
5
3
 
6
4
  export function get(
7
5
  obj: any,