@twin.org/tools-core 0.0.3-next.2 → 0.0.3-next.21
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 +2 -2
- package/dist/es/index.js +20 -11
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/ITypeScriptToSchemaContext.js +2 -0
- package/dist/es/models/ITypeScriptToSchemaContext.js.map +1 -0
- package/dist/es/models/ITypeScriptToSchemaDiagnostics.js +4 -0
- package/dist/es/models/ITypeScriptToSchemaDiagnostics.js.map +1 -0
- package/dist/es/models/ITypeScriptToSchemaOptions.js +4 -0
- package/dist/es/models/ITypeScriptToSchemaOptions.js.map +1 -0
- package/dist/es/utils/constants.js +43 -0
- package/dist/es/utils/constants.js.map +1 -0
- package/dist/es/utils/diagnosticReporter.js +32 -0
- package/dist/es/utils/diagnosticReporter.js.map +1 -0
- package/dist/es/utils/disallowedTypeGuard.js +151 -0
- package/dist/es/utils/disallowedTypeGuard.js.map +1 -0
- package/dist/es/utils/enum.js +152 -0
- package/dist/es/utils/enum.js.map +1 -0
- package/dist/es/utils/fileUtils.js +130 -0
- package/dist/es/utils/fileUtils.js.map +1 -0
- package/dist/es/utils/importTypeQuerySchemaResolver.js +328 -0
- package/dist/es/utils/importTypeQuerySchemaResolver.js.map +1 -0
- package/dist/es/utils/indexSignaturePatternResolver.js +94 -0
- package/dist/es/utils/indexSignaturePatternResolver.js.map +1 -0
- package/dist/es/utils/intersectionSchemaMerger.js +85 -0
- package/dist/es/utils/intersectionSchemaMerger.js.map +1 -0
- package/dist/es/utils/jsDoc.js +120 -0
- package/dist/es/utils/jsDoc.js.map +1 -0
- package/dist/es/utils/jsonSchemaBuilder.js +3373 -0
- package/dist/es/utils/jsonSchemaBuilder.js.map +1 -0
- package/dist/es/utils/mappedTypeSchemaResolver.js +231 -0
- package/dist/es/utils/mappedTypeSchemaResolver.js.map +1 -0
- package/dist/es/utils/objectTransformer.js +162 -0
- package/dist/es/utils/objectTransformer.js.map +1 -0
- package/dist/es/utils/regEx.js +128 -0
- package/dist/es/utils/regEx.js.map +1 -0
- package/dist/es/utils/resolver.js +164 -0
- package/dist/es/utils/resolver.js.map +1 -0
- package/dist/es/utils/templateLiteralPatternBuilder.js +94 -0
- package/dist/es/utils/templateLiteralPatternBuilder.js.map +1 -0
- package/dist/es/utils/typeScriptToSchema.js +112 -0
- package/dist/es/utils/typeScriptToSchema.js.map +1 -0
- package/dist/es/utils/utilityTypeSchemaMapper.js +412 -0
- package/dist/es/utils/utilityTypeSchemaMapper.js.map +1 -0
- package/dist/types/index.d.ts +20 -11
- package/dist/types/models/ITypeScriptToSchemaContext.d.ts +64 -0
- package/dist/types/models/ITypeScriptToSchemaDiagnostics.d.ts +31 -0
- package/dist/types/models/ITypeScriptToSchemaOptions.d.ts +22 -0
- package/dist/types/utils/constants.d.ts +13 -0
- package/dist/types/utils/diagnosticReporter.d.ts +17 -0
- package/dist/types/utils/disallowedTypeGuard.d.ts +16 -0
- package/dist/types/utils/enum.d.ts +42 -0
- package/dist/types/utils/fileUtils.d.ts +66 -0
- package/dist/types/utils/importTypeQuerySchemaResolver.d.ts +52 -0
- package/dist/types/utils/indexSignaturePatternResolver.d.ts +21 -0
- package/dist/types/utils/intersectionSchemaMerger.d.ts +16 -0
- package/dist/types/utils/jsDoc.d.ts +46 -0
- package/dist/types/utils/jsonSchemaBuilder.d.ts +747 -0
- package/dist/types/utils/mappedTypeSchemaResolver.d.ts +46 -0
- package/dist/types/utils/objectTransformer.d.ts +33 -0
- package/dist/types/utils/regEx.d.ts +24 -0
- package/dist/types/utils/resolver.d.ts +16 -0
- package/dist/types/utils/templateLiteralPatternBuilder.d.ts +12 -0
- package/dist/types/utils/typeScriptToSchema.d.ts +31 -0
- package/dist/types/utils/utilityTypeSchemaMapper.d.ts +92 -0
- package/docs/changelog.md +176 -1
- package/docs/examples.md +87 -1
- package/docs/reference/classes/Constants.md +29 -0
- package/docs/reference/classes/DiagnosticReporter.md +49 -0
- package/docs/reference/classes/DisallowedTypeGuard.md +35 -0
- package/docs/reference/classes/Enum.md +93 -0
- package/docs/reference/classes/FileUtils.md +237 -0
- package/docs/reference/classes/ImportTypeQuerySchemaResolver.md +87 -0
- package/docs/reference/classes/IndexSignaturePatternResolver.md +69 -0
- package/docs/reference/classes/IntersectionSchemaMerger.md +48 -0
- package/docs/reference/classes/JsDoc.md +141 -0
- package/docs/reference/classes/JsonSchemaBuilder.md +2870 -0
- package/docs/reference/classes/MappedTypeSchemaResolver.md +211 -0
- package/docs/reference/classes/ObjectTransformer.md +119 -0
- package/docs/reference/classes/RegEx.md +99 -0
- package/docs/reference/classes/Resolver.md +41 -0
- package/docs/reference/classes/TemplateLiteralPatternBuilder.md +35 -0
- package/docs/reference/classes/TypeScriptToSchema.md +91 -0
- package/docs/reference/classes/UtilityTypeSchemaMapper.md +341 -0
- package/docs/reference/index.md +20 -14
- package/docs/reference/interfaces/ITypeScriptToSchemaContext.md +113 -0
- package/docs/reference/interfaces/ITypeScriptToSchemaDiagnostics.md +55 -0
- package/docs/reference/interfaces/ITypeScriptToSchemaOptions.md +44 -0
- package/locales/en.json +32 -1
- package/package.json +4 -3
- package/dist/es/models/IJsonSchema.js +0 -2
- package/dist/es/models/IJsonSchema.js.map +0 -1
- package/dist/es/models/IOpenApi.js +0 -2
- package/dist/es/models/IOpenApi.js.map +0 -1
- package/dist/es/models/IOpenApiExample.js +0 -4
- package/dist/es/models/IOpenApiExample.js.map +0 -1
- package/dist/es/models/IOpenApiHeader.js +0 -4
- package/dist/es/models/IOpenApiHeader.js.map +0 -1
- package/dist/es/models/IOpenApiPathMethod.js +0 -2
- package/dist/es/models/IOpenApiPathMethod.js.map +0 -1
- package/dist/es/models/IOpenApiResponse.js +0 -2
- package/dist/es/models/IOpenApiResponse.js.map +0 -1
- package/dist/es/models/IOpenApiSecurityScheme.js +0 -4
- package/dist/es/models/IOpenApiSecurityScheme.js.map +0 -1
- package/dist/es/models/IPackageJson.js +0 -4
- package/dist/es/models/IPackageJson.js.map +0 -1
- package/dist/es/models/jsonTypeName.js +0 -2
- package/dist/es/models/jsonTypeName.js.map +0 -1
- package/dist/es/utils/jsonSchemaHelper.js +0 -258
- package/dist/es/utils/jsonSchemaHelper.js.map +0 -1
- package/dist/es/utils/openApiHelper.js +0 -12
- package/dist/es/utils/openApiHelper.js.map +0 -1
- package/dist/types/models/IJsonSchema.d.ts +0 -5
- package/dist/types/models/IOpenApi.d.ts +0 -54
- package/dist/types/models/IOpenApiExample.d.ts +0 -13
- package/dist/types/models/IOpenApiHeader.d.ts +0 -19
- package/dist/types/models/IOpenApiPathMethod.d.ts +0 -65
- package/dist/types/models/IOpenApiResponse.d.ts +0 -32
- package/dist/types/models/IOpenApiSecurityScheme.d.ts +0 -25
- package/dist/types/models/IPackageJson.d.ts +0 -15
- package/dist/types/models/jsonTypeName.d.ts +0 -5
- package/dist/types/utils/jsonSchemaHelper.d.ts +0 -78
- package/dist/types/utils/openApiHelper.d.ts +0 -9
- package/docs/reference/classes/JsonSchemaHelper.md +0 -233
- package/docs/reference/classes/OpenApiHelper.md +0 -21
- package/docs/reference/interfaces/IOpenApi.md +0 -103
- package/docs/reference/interfaces/IOpenApiExample.md +0 -19
- package/docs/reference/interfaces/IOpenApiHeader.md +0 -31
- package/docs/reference/interfaces/IOpenApiPathMethod.md +0 -119
- package/docs/reference/interfaces/IOpenApiResponse.md +0 -35
- package/docs/reference/interfaces/IOpenApiSecurityScheme.md +0 -43
- package/docs/reference/interfaces/IPackageJson.md +0 -23
- package/docs/reference/type-aliases/IJsonSchema.md +0 -5
- package/docs/reference/type-aliases/JsonTypeName.md +0 -5
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Class: Enum
|
|
2
|
+
|
|
3
|
+
Utility methods for extracting enum values from TypeScript AST nodes.
|
|
4
|
+
|
|
5
|
+
Handles three distinct patterns used to define enumerable sets of values:
|
|
6
|
+
- Native enum declarations: `enum Color { Red = "red" }`
|
|
7
|
+
- Const-object-with-matching-type patterns: `const Foo = { A: "a" } as const` paired with a type alias named identically to the const
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new Enum**(): `Enum`
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
`Enum`
|
|
18
|
+
|
|
19
|
+
## Methods
|
|
20
|
+
|
|
21
|
+
### extractEnumValuesFromConstAndType() {#extractenumvaluesfromconstandtype}
|
|
22
|
+
|
|
23
|
+
> `static` **extractEnumValuesFromConstAndType**(`name`, `sourceFile`): `object`[] \| `undefined`
|
|
24
|
+
|
|
25
|
+
Extract enum values from a const-and-type pair where a const object and a type alias share the
|
|
26
|
+
same name. The const object is located first because its members may carry JSDoc descriptions
|
|
27
|
+
that would be lost if the type alias were processed in isolation.
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
##### name
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
The name to search for.
|
|
36
|
+
|
|
37
|
+
##### sourceFile
|
|
38
|
+
|
|
39
|
+
`SourceFile`
|
|
40
|
+
|
|
41
|
+
The source file to search.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`object`[] \| `undefined`
|
|
46
|
+
|
|
47
|
+
The extracted enum entries or undefined when the pattern is not present.
|
|
48
|
+
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### extractEnumEntriesFromConstObject() {#extractenumentriesfromconstobject}
|
|
52
|
+
|
|
53
|
+
> `static` **extractEnumEntriesFromConstObject**(`objLiteral`): `object`[]
|
|
54
|
+
|
|
55
|
+
Extract enum entries from a const object literal.
|
|
56
|
+
Only properties whose initializer is a string or numeric literal are included.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### objLiteral
|
|
61
|
+
|
|
62
|
+
`ObjectLiteralExpression`
|
|
63
|
+
|
|
64
|
+
The object literal expression.
|
|
65
|
+
|
|
66
|
+
#### Returns
|
|
67
|
+
|
|
68
|
+
`object`[]
|
|
69
|
+
|
|
70
|
+
The extracted enum entries.
|
|
71
|
+
|
|
72
|
+
***
|
|
73
|
+
|
|
74
|
+
### extractEnumValuesFromEnumDeclaration() {#extractenumvaluesfromenumdeclaration}
|
|
75
|
+
|
|
76
|
+
> `static` **extractEnumValuesFromEnumDeclaration**(`declaration`): `object`[]
|
|
77
|
+
|
|
78
|
+
Extract enum values from a native TypeScript enum declaration.
|
|
79
|
+
Numeric members without an explicit initializer are auto-incremented from the previous value.
|
|
80
|
+
|
|
81
|
+
#### Parameters
|
|
82
|
+
|
|
83
|
+
##### declaration
|
|
84
|
+
|
|
85
|
+
`EnumDeclaration`
|
|
86
|
+
|
|
87
|
+
The enum declaration.
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`object`[]
|
|
92
|
+
|
|
93
|
+
The extracted enum entries.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Class: FileUtils
|
|
2
|
+
|
|
3
|
+
Utility helpers for TypeScript file and directory paths.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new FileUtils**(): `FileUtils`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`FileUtils`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### fileExists() {#fileexists}
|
|
18
|
+
|
|
19
|
+
> `static` **fileExists**(`filePath`): `boolean`
|
|
20
|
+
|
|
21
|
+
Does the file exist.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### filePath
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
The file path.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`boolean`
|
|
34
|
+
|
|
35
|
+
True if the file exists.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### readFile() {#readfile}
|
|
40
|
+
|
|
41
|
+
> `static` **readFile**(`filePath`): `string`
|
|
42
|
+
|
|
43
|
+
Read the file.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### filePath
|
|
48
|
+
|
|
49
|
+
`string`
|
|
50
|
+
|
|
51
|
+
The file path.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The file contents.
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
### resolvePath() {#resolvepath}
|
|
62
|
+
|
|
63
|
+
> `static` **resolvePath**(`filePath`): `string`
|
|
64
|
+
|
|
65
|
+
Resolve a path.
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
##### filePath
|
|
70
|
+
|
|
71
|
+
`string`
|
|
72
|
+
|
|
73
|
+
The file path.
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`string`
|
|
78
|
+
|
|
79
|
+
The resolved path.
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### getCurrentWorkingDirectory() {#getcurrentworkingdirectory}
|
|
84
|
+
|
|
85
|
+
> `static` **getCurrentWorkingDirectory**(): `string`
|
|
86
|
+
|
|
87
|
+
Get the current working directory.
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`string`
|
|
92
|
+
|
|
93
|
+
The current working directory.
|
|
94
|
+
|
|
95
|
+
***
|
|
96
|
+
|
|
97
|
+
### normalizeFilePath() {#normalizefilepath}
|
|
98
|
+
|
|
99
|
+
> `static` **normalizeFilePath**(`filePath`): `string`
|
|
100
|
+
|
|
101
|
+
Normalize path separators for consistent comparisons.
|
|
102
|
+
|
|
103
|
+
#### Parameters
|
|
104
|
+
|
|
105
|
+
##### filePath
|
|
106
|
+
|
|
107
|
+
`string`
|
|
108
|
+
|
|
109
|
+
The file path.
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
`string`
|
|
114
|
+
|
|
115
|
+
The normalized file path.
|
|
116
|
+
|
|
117
|
+
***
|
|
118
|
+
|
|
119
|
+
### getDirectoryPath() {#getdirectorypath}
|
|
120
|
+
|
|
121
|
+
> `static` **getDirectoryPath**(`filePath`): `string`
|
|
122
|
+
|
|
123
|
+
Get the directory portion of a file path.
|
|
124
|
+
|
|
125
|
+
#### Parameters
|
|
126
|
+
|
|
127
|
+
##### filePath
|
|
128
|
+
|
|
129
|
+
`string`
|
|
130
|
+
|
|
131
|
+
The file path.
|
|
132
|
+
|
|
133
|
+
#### Returns
|
|
134
|
+
|
|
135
|
+
`string`
|
|
136
|
+
|
|
137
|
+
The directory path.
|
|
138
|
+
|
|
139
|
+
***
|
|
140
|
+
|
|
141
|
+
### resolveRelativePath() {#resolverelativepath}
|
|
142
|
+
|
|
143
|
+
> `static` **resolveRelativePath**(`baseDirectory`, `relativePath`): `string`
|
|
144
|
+
|
|
145
|
+
Resolve a relative path against a base directory.
|
|
146
|
+
|
|
147
|
+
#### Parameters
|
|
148
|
+
|
|
149
|
+
##### baseDirectory
|
|
150
|
+
|
|
151
|
+
`string`
|
|
152
|
+
|
|
153
|
+
The base directory.
|
|
154
|
+
|
|
155
|
+
##### relativePath
|
|
156
|
+
|
|
157
|
+
`string`
|
|
158
|
+
|
|
159
|
+
The relative path.
|
|
160
|
+
|
|
161
|
+
#### Returns
|
|
162
|
+
|
|
163
|
+
`string`
|
|
164
|
+
|
|
165
|
+
The resolved path.
|
|
166
|
+
|
|
167
|
+
***
|
|
168
|
+
|
|
169
|
+
### resolveImportSourceFilePath() {#resolveimportsourcefilepath}
|
|
170
|
+
|
|
171
|
+
> `static` **resolveImportSourceFilePath**(`sourceFilePath`, `importPath`): `string` \| `undefined`
|
|
172
|
+
|
|
173
|
+
Resolve a local import specifier to a TypeScript source file path.
|
|
174
|
+
|
|
175
|
+
#### Parameters
|
|
176
|
+
|
|
177
|
+
##### sourceFilePath
|
|
178
|
+
|
|
179
|
+
`string`
|
|
180
|
+
|
|
181
|
+
The importing source file path.
|
|
182
|
+
|
|
183
|
+
##### importPath
|
|
184
|
+
|
|
185
|
+
`string`
|
|
186
|
+
|
|
187
|
+
The import specifier.
|
|
188
|
+
|
|
189
|
+
#### Returns
|
|
190
|
+
|
|
191
|
+
`string` \| `undefined`
|
|
192
|
+
|
|
193
|
+
The resolved source file path.
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
### isGlobPattern() {#isglobpattern}
|
|
198
|
+
|
|
199
|
+
> `static` **isGlobPattern**(`sourceFileOrGlob`): `boolean`
|
|
200
|
+
|
|
201
|
+
Determine if the provided path includes glob pattern tokens.
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
##### sourceFileOrGlob
|
|
206
|
+
|
|
207
|
+
`string`
|
|
208
|
+
|
|
209
|
+
The direct source file path or glob pattern.
|
|
210
|
+
|
|
211
|
+
#### Returns
|
|
212
|
+
|
|
213
|
+
`boolean`
|
|
214
|
+
|
|
215
|
+
True if the value is a glob pattern.
|
|
216
|
+
|
|
217
|
+
***
|
|
218
|
+
|
|
219
|
+
### resolveSourceFiles() {#resolvesourcefiles}
|
|
220
|
+
|
|
221
|
+
> `static` **resolveSourceFiles**(`sourceFileOrGlob`): `string`[]
|
|
222
|
+
|
|
223
|
+
Resolve source files from a direct path or a glob pattern.
|
|
224
|
+
|
|
225
|
+
#### Parameters
|
|
226
|
+
|
|
227
|
+
##### sourceFileOrGlob
|
|
228
|
+
|
|
229
|
+
`string`
|
|
230
|
+
|
|
231
|
+
The direct source file path or glob pattern.
|
|
232
|
+
|
|
233
|
+
#### Returns
|
|
234
|
+
|
|
235
|
+
`string`[]
|
|
236
|
+
|
|
237
|
+
The resolved source file paths.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Class: ImportTypeQuerySchemaResolver
|
|
2
|
+
|
|
3
|
+
Static helpers for import type and type query schema resolution.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new ImportTypeQuerySchemaResolver**(): `ImportTypeQuerySchemaResolver`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`ImportTypeQuerySchemaResolver`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### mapImportTypeNodeToSchema() {#mapimporttypenodetoschema}
|
|
18
|
+
|
|
19
|
+
> `static` **mapImportTypeNodeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
20
|
+
|
|
21
|
+
Map import type nodes (e.g. import("pkg").Type) to schema references.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### context
|
|
26
|
+
|
|
27
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
28
|
+
|
|
29
|
+
##### typeNode
|
|
30
|
+
|
|
31
|
+
`ImportTypeNode`
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`IJsonSchema` \| `undefined`
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### mapTypeQueryNodeToSchema() {#maptypequerynodetoschema}
|
|
40
|
+
|
|
41
|
+
> `static` **mapTypeQueryNodeToSchema**(`context`, `typeNode`): `IJsonSchema`
|
|
42
|
+
|
|
43
|
+
Map a type query node (typeof expr) to schema by resolving the referenced variable.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### context
|
|
48
|
+
|
|
49
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
50
|
+
|
|
51
|
+
##### typeNode
|
|
52
|
+
|
|
53
|
+
`TypeQueryNode`
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`IJsonSchema`
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
### resolveImportTypeReferenceSchemaId() {#resolveimporttypereferenceschemaid}
|
|
62
|
+
|
|
63
|
+
> `static` **resolveImportTypeReferenceSchemaId**(`context`, `moduleSpecifier`, `typeName`, `title`): `string` \| `undefined`
|
|
64
|
+
|
|
65
|
+
Resolve import-type references to local or external schema ids.
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
##### context
|
|
70
|
+
|
|
71
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
72
|
+
|
|
73
|
+
##### moduleSpecifier
|
|
74
|
+
|
|
75
|
+
`string`
|
|
76
|
+
|
|
77
|
+
##### typeName
|
|
78
|
+
|
|
79
|
+
`string`
|
|
80
|
+
|
|
81
|
+
##### title
|
|
82
|
+
|
|
83
|
+
`string`
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`string` \| `undefined`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Class: IndexSignaturePatternResolver
|
|
2
|
+
|
|
3
|
+
Resolves regex patterns for index signature key types.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new IndexSignaturePatternResolver**(): `IndexSignaturePatternResolver`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`IndexSignaturePatternResolver`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### isSupportedIndexSignature() {#issupportedindexsignature}
|
|
18
|
+
|
|
19
|
+
> `static` **isSupportedIndexSignature**(`member`): `boolean`
|
|
20
|
+
|
|
21
|
+
Determine whether an index signature can be represented as JSON object additionalProperties.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### member
|
|
26
|
+
|
|
27
|
+
`IndexSignatureDeclaration`
|
|
28
|
+
|
|
29
|
+
The index signature declaration.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`boolean`
|
|
34
|
+
|
|
35
|
+
True if supported.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### extractIndexSignaturePattern() {#extractindexsignaturepattern}
|
|
40
|
+
|
|
41
|
+
> `static` **extractIndexSignaturePattern**(`context`, `member`, `getTypeParameterBinding`): `string` \| `undefined`
|
|
42
|
+
|
|
43
|
+
Extract a regex pattern for an index signature key type when representable.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### context
|
|
48
|
+
|
|
49
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
50
|
+
|
|
51
|
+
The generation context.
|
|
52
|
+
|
|
53
|
+
##### member
|
|
54
|
+
|
|
55
|
+
`IndexSignatureDeclaration`
|
|
56
|
+
|
|
57
|
+
The index signature declaration.
|
|
58
|
+
|
|
59
|
+
##### getTypeParameterBinding
|
|
60
|
+
|
|
61
|
+
(`context`, `typeName`) => `TypeNode` \| `null` \| `undefined`
|
|
62
|
+
|
|
63
|
+
Callback for resolving generic bindings.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`string` \| `undefined`
|
|
68
|
+
|
|
69
|
+
The property-name pattern, if derivable.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Class: IntersectionSchemaMerger
|
|
2
|
+
|
|
3
|
+
Merges compatible object intersections into a single JSON schema object.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new IntersectionSchemaMerger**(): `IntersectionSchemaMerger`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`IntersectionSchemaMerger`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### mergeIntersectionObjectSchemas() {#mergeintersectionobjectschemas}
|
|
18
|
+
|
|
19
|
+
> `static` **mergeIntersectionObjectSchemas**(`context`, `schemas`, `toInlineUtilityObjectSchema`): `IJsonSchema` \| `undefined`
|
|
20
|
+
|
|
21
|
+
Merge simple object intersection parts into a single object schema.
|
|
22
|
+
Supports local/known object refs by expanding them before merge.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
##### context
|
|
27
|
+
|
|
28
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
29
|
+
|
|
30
|
+
The generation context.
|
|
31
|
+
|
|
32
|
+
##### schemas
|
|
33
|
+
|
|
34
|
+
`IJsonSchema`[]
|
|
35
|
+
|
|
36
|
+
The mapped intersection schemas.
|
|
37
|
+
|
|
38
|
+
##### toInlineUtilityObjectSchema
|
|
39
|
+
|
|
40
|
+
(`schema`) => `IJsonSchema`
|
|
41
|
+
|
|
42
|
+
Callback for converting referenced schemas to inline forms.
|
|
43
|
+
|
|
44
|
+
#### Returns
|
|
45
|
+
|
|
46
|
+
`IJsonSchema` \| `undefined`
|
|
47
|
+
|
|
48
|
+
The merged schema, or undefined when merge is not safe.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Class: JsDoc
|
|
2
|
+
|
|
3
|
+
General-purpose utility methods for working with JsDoc.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new JsDoc**(): `JsDoc`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`JsDoc`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### getNodeJsDocDescription() {#getnodejsdocdescription}
|
|
18
|
+
|
|
19
|
+
> `static` **getNodeJsDocDescription**(`node`): `string` \| `undefined`
|
|
20
|
+
|
|
21
|
+
Extract the JSDoc description comment for an AST node.
|
|
22
|
+
Only top-level JSDoc block comments are considered; inline tags are ignored.
|
|
23
|
+
|
|
24
|
+
#### Parameters
|
|
25
|
+
|
|
26
|
+
##### node
|
|
27
|
+
|
|
28
|
+
`Node`
|
|
29
|
+
|
|
30
|
+
The node to inspect.
|
|
31
|
+
|
|
32
|
+
#### Returns
|
|
33
|
+
|
|
34
|
+
`string` \| `undefined`
|
|
35
|
+
|
|
36
|
+
The trimmed description text, or undefined when absent.
|
|
37
|
+
|
|
38
|
+
***
|
|
39
|
+
|
|
40
|
+
### getJSDocTagCommentText() {#getjsdoctagcommenttext}
|
|
41
|
+
|
|
42
|
+
> `static` **getJSDocTagCommentText**(`jsDocTag`): `string` \| `undefined`
|
|
43
|
+
|
|
44
|
+
Convert a JSDoc tag's comment portion to a plain text string.
|
|
45
|
+
JSDoc tag comments may be plain strings or arrays of link/text parts.
|
|
46
|
+
|
|
47
|
+
#### Parameters
|
|
48
|
+
|
|
49
|
+
##### jsDocTag
|
|
50
|
+
|
|
51
|
+
`JSDocTag`
|
|
52
|
+
|
|
53
|
+
The JSDoc tag.
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`string` \| `undefined`
|
|
58
|
+
|
|
59
|
+
The comment text, or undefined when absent.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### getNodeTags() {#getnodetags}
|
|
64
|
+
|
|
65
|
+
> `static` **getNodeTags**(`node`, `tagName`): `object`
|
|
66
|
+
|
|
67
|
+
Read all custom JSDoc tags matching a tag name from a node and convert them to key/value pairs.
|
|
68
|
+
Each matching tag's comment must be in the form "key: value"; entries that do not follow this
|
|
69
|
+
convention are silently skipped.
|
|
70
|
+
|
|
71
|
+
#### Parameters
|
|
72
|
+
|
|
73
|
+
##### node
|
|
74
|
+
|
|
75
|
+
`Node`
|
|
76
|
+
|
|
77
|
+
The node to inspect.
|
|
78
|
+
|
|
79
|
+
##### tagName
|
|
80
|
+
|
|
81
|
+
`string`
|
|
82
|
+
|
|
83
|
+
The tag name to filter by (e.g., 'json-schema').
|
|
84
|
+
|
|
85
|
+
#### Returns
|
|
86
|
+
|
|
87
|
+
`object`
|
|
88
|
+
|
|
89
|
+
The extracted key/value pairs.
|
|
90
|
+
|
|
91
|
+
***
|
|
92
|
+
|
|
93
|
+
### getNodeTagComment() {#getnodetagcomment}
|
|
94
|
+
|
|
95
|
+
> `static` **getNodeTagComment**(`node`, `tagName`): `string` \| `undefined`
|
|
96
|
+
|
|
97
|
+
Read the plain comment text for the first matching JSDoc tag on a node.
|
|
98
|
+
|
|
99
|
+
#### Parameters
|
|
100
|
+
|
|
101
|
+
##### node
|
|
102
|
+
|
|
103
|
+
`Node`
|
|
104
|
+
|
|
105
|
+
The node to inspect.
|
|
106
|
+
|
|
107
|
+
##### tagName
|
|
108
|
+
|
|
109
|
+
`string`
|
|
110
|
+
|
|
111
|
+
The tag name to filter by (e.g., 'default').
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`string` \| `undefined`
|
|
116
|
+
|
|
117
|
+
The trimmed comment text, or undefined when absent.
|
|
118
|
+
|
|
119
|
+
***
|
|
120
|
+
|
|
121
|
+
### parseTagValue() {#parsetagvalue}
|
|
122
|
+
|
|
123
|
+
> `static` **parseTagValue**(`value`): `unknown`
|
|
124
|
+
|
|
125
|
+
Parse a custom JSDoc tag value into JSON-compatible data.
|
|
126
|
+
Values that begin with a JSON token character ({, [, ", true, false, null) or look like a
|
|
127
|
+
number are parsed with JSON.parse. All other values are returned as plain strings.
|
|
128
|
+
|
|
129
|
+
#### Parameters
|
|
130
|
+
|
|
131
|
+
##### value
|
|
132
|
+
|
|
133
|
+
`string`
|
|
134
|
+
|
|
135
|
+
The raw value text.
|
|
136
|
+
|
|
137
|
+
#### Returns
|
|
138
|
+
|
|
139
|
+
`unknown`
|
|
140
|
+
|
|
141
|
+
The parsed value.
|