@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.
Files changed (133) hide show
  1. package/README.md +2 -2
  2. package/dist/es/index.js +20 -11
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/es/models/ITypeScriptToSchemaContext.js +2 -0
  5. package/dist/es/models/ITypeScriptToSchemaContext.js.map +1 -0
  6. package/dist/es/models/ITypeScriptToSchemaDiagnostics.js +4 -0
  7. package/dist/es/models/ITypeScriptToSchemaDiagnostics.js.map +1 -0
  8. package/dist/es/models/ITypeScriptToSchemaOptions.js +4 -0
  9. package/dist/es/models/ITypeScriptToSchemaOptions.js.map +1 -0
  10. package/dist/es/utils/constants.js +43 -0
  11. package/dist/es/utils/constants.js.map +1 -0
  12. package/dist/es/utils/diagnosticReporter.js +32 -0
  13. package/dist/es/utils/diagnosticReporter.js.map +1 -0
  14. package/dist/es/utils/disallowedTypeGuard.js +151 -0
  15. package/dist/es/utils/disallowedTypeGuard.js.map +1 -0
  16. package/dist/es/utils/enum.js +152 -0
  17. package/dist/es/utils/enum.js.map +1 -0
  18. package/dist/es/utils/fileUtils.js +130 -0
  19. package/dist/es/utils/fileUtils.js.map +1 -0
  20. package/dist/es/utils/importTypeQuerySchemaResolver.js +328 -0
  21. package/dist/es/utils/importTypeQuerySchemaResolver.js.map +1 -0
  22. package/dist/es/utils/indexSignaturePatternResolver.js +94 -0
  23. package/dist/es/utils/indexSignaturePatternResolver.js.map +1 -0
  24. package/dist/es/utils/intersectionSchemaMerger.js +85 -0
  25. package/dist/es/utils/intersectionSchemaMerger.js.map +1 -0
  26. package/dist/es/utils/jsDoc.js +120 -0
  27. package/dist/es/utils/jsDoc.js.map +1 -0
  28. package/dist/es/utils/jsonSchemaBuilder.js +3373 -0
  29. package/dist/es/utils/jsonSchemaBuilder.js.map +1 -0
  30. package/dist/es/utils/mappedTypeSchemaResolver.js +231 -0
  31. package/dist/es/utils/mappedTypeSchemaResolver.js.map +1 -0
  32. package/dist/es/utils/objectTransformer.js +162 -0
  33. package/dist/es/utils/objectTransformer.js.map +1 -0
  34. package/dist/es/utils/regEx.js +128 -0
  35. package/dist/es/utils/regEx.js.map +1 -0
  36. package/dist/es/utils/resolver.js +164 -0
  37. package/dist/es/utils/resolver.js.map +1 -0
  38. package/dist/es/utils/templateLiteralPatternBuilder.js +94 -0
  39. package/dist/es/utils/templateLiteralPatternBuilder.js.map +1 -0
  40. package/dist/es/utils/typeScriptToSchema.js +112 -0
  41. package/dist/es/utils/typeScriptToSchema.js.map +1 -0
  42. package/dist/es/utils/utilityTypeSchemaMapper.js +412 -0
  43. package/dist/es/utils/utilityTypeSchemaMapper.js.map +1 -0
  44. package/dist/types/index.d.ts +20 -11
  45. package/dist/types/models/ITypeScriptToSchemaContext.d.ts +64 -0
  46. package/dist/types/models/ITypeScriptToSchemaDiagnostics.d.ts +31 -0
  47. package/dist/types/models/ITypeScriptToSchemaOptions.d.ts +22 -0
  48. package/dist/types/utils/constants.d.ts +13 -0
  49. package/dist/types/utils/diagnosticReporter.d.ts +17 -0
  50. package/dist/types/utils/disallowedTypeGuard.d.ts +16 -0
  51. package/dist/types/utils/enum.d.ts +42 -0
  52. package/dist/types/utils/fileUtils.d.ts +66 -0
  53. package/dist/types/utils/importTypeQuerySchemaResolver.d.ts +52 -0
  54. package/dist/types/utils/indexSignaturePatternResolver.d.ts +21 -0
  55. package/dist/types/utils/intersectionSchemaMerger.d.ts +16 -0
  56. package/dist/types/utils/jsDoc.d.ts +46 -0
  57. package/dist/types/utils/jsonSchemaBuilder.d.ts +747 -0
  58. package/dist/types/utils/mappedTypeSchemaResolver.d.ts +46 -0
  59. package/dist/types/utils/objectTransformer.d.ts +33 -0
  60. package/dist/types/utils/regEx.d.ts +24 -0
  61. package/dist/types/utils/resolver.d.ts +16 -0
  62. package/dist/types/utils/templateLiteralPatternBuilder.d.ts +12 -0
  63. package/dist/types/utils/typeScriptToSchema.d.ts +31 -0
  64. package/dist/types/utils/utilityTypeSchemaMapper.d.ts +92 -0
  65. package/docs/changelog.md +176 -1
  66. package/docs/examples.md +87 -1
  67. package/docs/reference/classes/Constants.md +29 -0
  68. package/docs/reference/classes/DiagnosticReporter.md +49 -0
  69. package/docs/reference/classes/DisallowedTypeGuard.md +35 -0
  70. package/docs/reference/classes/Enum.md +93 -0
  71. package/docs/reference/classes/FileUtils.md +237 -0
  72. package/docs/reference/classes/ImportTypeQuerySchemaResolver.md +87 -0
  73. package/docs/reference/classes/IndexSignaturePatternResolver.md +69 -0
  74. package/docs/reference/classes/IntersectionSchemaMerger.md +48 -0
  75. package/docs/reference/classes/JsDoc.md +141 -0
  76. package/docs/reference/classes/JsonSchemaBuilder.md +2870 -0
  77. package/docs/reference/classes/MappedTypeSchemaResolver.md +211 -0
  78. package/docs/reference/classes/ObjectTransformer.md +119 -0
  79. package/docs/reference/classes/RegEx.md +99 -0
  80. package/docs/reference/classes/Resolver.md +41 -0
  81. package/docs/reference/classes/TemplateLiteralPatternBuilder.md +35 -0
  82. package/docs/reference/classes/TypeScriptToSchema.md +91 -0
  83. package/docs/reference/classes/UtilityTypeSchemaMapper.md +341 -0
  84. package/docs/reference/index.md +20 -14
  85. package/docs/reference/interfaces/ITypeScriptToSchemaContext.md +113 -0
  86. package/docs/reference/interfaces/ITypeScriptToSchemaDiagnostics.md +55 -0
  87. package/docs/reference/interfaces/ITypeScriptToSchemaOptions.md +44 -0
  88. package/locales/en.json +32 -1
  89. package/package.json +4 -3
  90. package/dist/es/models/IJsonSchema.js +0 -2
  91. package/dist/es/models/IJsonSchema.js.map +0 -1
  92. package/dist/es/models/IOpenApi.js +0 -2
  93. package/dist/es/models/IOpenApi.js.map +0 -1
  94. package/dist/es/models/IOpenApiExample.js +0 -4
  95. package/dist/es/models/IOpenApiExample.js.map +0 -1
  96. package/dist/es/models/IOpenApiHeader.js +0 -4
  97. package/dist/es/models/IOpenApiHeader.js.map +0 -1
  98. package/dist/es/models/IOpenApiPathMethod.js +0 -2
  99. package/dist/es/models/IOpenApiPathMethod.js.map +0 -1
  100. package/dist/es/models/IOpenApiResponse.js +0 -2
  101. package/dist/es/models/IOpenApiResponse.js.map +0 -1
  102. package/dist/es/models/IOpenApiSecurityScheme.js +0 -4
  103. package/dist/es/models/IOpenApiSecurityScheme.js.map +0 -1
  104. package/dist/es/models/IPackageJson.js +0 -4
  105. package/dist/es/models/IPackageJson.js.map +0 -1
  106. package/dist/es/models/jsonTypeName.js +0 -2
  107. package/dist/es/models/jsonTypeName.js.map +0 -1
  108. package/dist/es/utils/jsonSchemaHelper.js +0 -258
  109. package/dist/es/utils/jsonSchemaHelper.js.map +0 -1
  110. package/dist/es/utils/openApiHelper.js +0 -12
  111. package/dist/es/utils/openApiHelper.js.map +0 -1
  112. package/dist/types/models/IJsonSchema.d.ts +0 -5
  113. package/dist/types/models/IOpenApi.d.ts +0 -54
  114. package/dist/types/models/IOpenApiExample.d.ts +0 -13
  115. package/dist/types/models/IOpenApiHeader.d.ts +0 -19
  116. package/dist/types/models/IOpenApiPathMethod.d.ts +0 -65
  117. package/dist/types/models/IOpenApiResponse.d.ts +0 -32
  118. package/dist/types/models/IOpenApiSecurityScheme.d.ts +0 -25
  119. package/dist/types/models/IPackageJson.d.ts +0 -15
  120. package/dist/types/models/jsonTypeName.d.ts +0 -5
  121. package/dist/types/utils/jsonSchemaHelper.d.ts +0 -78
  122. package/dist/types/utils/openApiHelper.d.ts +0 -9
  123. package/docs/reference/classes/JsonSchemaHelper.md +0 -233
  124. package/docs/reference/classes/OpenApiHelper.md +0 -21
  125. package/docs/reference/interfaces/IOpenApi.md +0 -103
  126. package/docs/reference/interfaces/IOpenApiExample.md +0 -19
  127. package/docs/reference/interfaces/IOpenApiHeader.md +0 -31
  128. package/docs/reference/interfaces/IOpenApiPathMethod.md +0 -119
  129. package/docs/reference/interfaces/IOpenApiResponse.md +0 -35
  130. package/docs/reference/interfaces/IOpenApiSecurityScheme.md +0 -43
  131. package/docs/reference/interfaces/IPackageJson.md +0 -23
  132. package/docs/reference/type-aliases/IJsonSchema.md +0 -5
  133. package/docs/reference/type-aliases/JsonTypeName.md +0 -5
@@ -0,0 +1,2870 @@
1
+ # Class: JsonSchemaBuilder
2
+
3
+ Builder for composing JSON schema fragments from TypeScript AST nodes.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new JsonSchemaBuilder**(): `JsonSchemaBuilder`
10
+
11
+ #### Returns
12
+
13
+ `JsonSchemaBuilder`
14
+
15
+ ## Properties
16
+
17
+ ### SCHEMA\_VERSION {#schema_version}
18
+
19
+ > `readonly` `static` **SCHEMA\_VERSION**: `"https://json-schema.org/draft/2020-12/schema"` = `"https://json-schema.org/draft/2020-12/schema"`
20
+
21
+ The JSON Schema version used.
22
+
23
+ ***
24
+
25
+ ### CLASS\_NAME {#class_name}
26
+
27
+ > `readonly` `static` **CLASS\_NAME**: `string`
28
+
29
+ Runtime name for the class.
30
+
31
+ ## Methods
32
+
33
+ ### parseAllObjectSchemas() {#parseallobjectschemas}
34
+
35
+ > `static` **parseAllObjectSchemas**(`context`, `sourceFilePath`, `source`, `visitedFiles`): `string`[]
36
+
37
+ Parse all object declarations from a source file.
38
+
39
+ #### Parameters
40
+
41
+ ##### context
42
+
43
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
44
+
45
+ The generation context.
46
+
47
+ ##### sourceFilePath
48
+
49
+ `string`
50
+
51
+ The source file path.
52
+
53
+ ##### source
54
+
55
+ `string`
56
+
57
+ The TypeScript source.
58
+
59
+ ##### visitedFiles
60
+
61
+ `string`[]
62
+
63
+ The list of visited source files.
64
+
65
+ #### Returns
66
+
67
+ `string`[]
68
+
69
+ The generated schema titles.
70
+
71
+ ***
72
+
73
+ ### applyJsonSchemaTags() {#applyjsonschematags}
74
+
75
+ > `static` **applyJsonSchemaTags**(`schema`, `node`): `void`
76
+
77
+ Apply
78
+
79
+ #### Parameters
80
+
81
+ ##### schema
82
+
83
+ `Partial`\<`IJsonSchema`\>
84
+
85
+ The schema to expand.
86
+
87
+ ##### node
88
+
89
+ `Node`
90
+
91
+ The node to inspect for tags.
92
+
93
+ #### Returns
94
+
95
+ `void`
96
+
97
+ #### Throws
98
+
99
+ GeneralError Thrown when a tag key is not supported by IJsonSchema.
100
+
101
+ ***
102
+
103
+ ### validateJsonSchemaTagConstraint() {#validatejsonschematagconstraint}
104
+
105
+ > `static` **validateJsonSchemaTagConstraint**(`schemaKey`, `schemaType`, `rawValue`): `void`
106
+
107
+ Validate that a
108
+
109
+ #### Parameters
110
+
111
+ ##### schemaKey
112
+
113
+ `string`
114
+
115
+ The mapped schema key being applied.
116
+
117
+ ##### schemaType
118
+
119
+ `string` \| `string`[] \| `undefined`
120
+
121
+ The type already set on the schema, if any.
122
+
123
+ ##### rawValue
124
+
125
+ `string`
126
+
127
+ The raw string value from the JSDoc tag.
128
+
129
+ #### Returns
130
+
131
+ `void`
132
+
133
+ #### Throws
134
+
135
+ GeneralError Thrown when the constraint is not valid for the schema type.
136
+
137
+ #### Throws
138
+
139
+ GeneralError Thrown when the format value is not a recognised JSON Schema format.
140
+
141
+ ***
142
+
143
+ ### isAllowedJsonSchemaTagKey() {#isallowedjsonschematagkey}
144
+
145
+ > `static` **isAllowedJsonSchemaTagKey**(`key`): `boolean`
146
+
147
+ Determine whether a mapped
148
+
149
+ #### Parameters
150
+
151
+ ##### key
152
+
153
+ `string`
154
+
155
+ The mapped schema key.
156
+
157
+ #### Returns
158
+
159
+ `boolean`
160
+
161
+ True if the key is supported.
162
+
163
+ ***
164
+
165
+ ### buildBaseSchema() {#buildbaseschema}
166
+
167
+ > `static` **buildBaseSchema**(`namespace`, `title`, `statement`): `Partial`\<`IJsonSchema`\>
168
+
169
+ Build the base schema with common properties.
170
+
171
+ #### Parameters
172
+
173
+ ##### namespace
174
+
175
+ `string`
176
+
177
+ The namespace for generated schema id.
178
+
179
+ ##### title
180
+
181
+ `string`
182
+
183
+ The schema title.
184
+
185
+ ##### statement
186
+
187
+ `Node`
188
+
189
+ The type statement node.
190
+
191
+ #### Returns
192
+
193
+ `Partial`\<`IJsonSchema`\>
194
+
195
+ The base schema to be expanded.
196
+
197
+ ***
198
+
199
+ ### buildEnumSchema() {#buildenumschema}
200
+
201
+ > `static` **buildEnumSchema**(`schema`, `entries`): `void`
202
+
203
+ Add enum information to a schema.
204
+
205
+ #### Parameters
206
+
207
+ ##### schema
208
+
209
+ `Partial`\<`IJsonSchema`\>
210
+
211
+ The schema to expand.
212
+
213
+ ##### entries
214
+
215
+ `object`[]
216
+
217
+ The enum entries.
218
+
219
+ #### Returns
220
+
221
+ `void`
222
+
223
+ ***
224
+
225
+ ### buildObjectSchema() {#buildobjectschema}
226
+
227
+ > `static` **buildObjectSchema**(`context`, `schema`, `members`): `void`
228
+
229
+ Build an object schema from interface or type literal members.
230
+
231
+ #### Parameters
232
+
233
+ ##### context
234
+
235
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
236
+
237
+ The generation context.
238
+
239
+ ##### schema
240
+
241
+ `Partial`\<`IJsonSchema`\>
242
+
243
+ The schema to expand.
244
+
245
+ ##### members
246
+
247
+ `NodeArray`\<`TypeElement`\>
248
+
249
+ The members to process.
250
+
251
+ #### Returns
252
+
253
+ `void`
254
+
255
+ ***
256
+
257
+ ### buildObjectMembersSchema() {#buildobjectmembersschema}
258
+
259
+ > `static` **buildObjectMembersSchema**(`context`, `members`): `object`
260
+
261
+ Build property schemas and required list from type members.
262
+
263
+ #### Parameters
264
+
265
+ ##### context
266
+
267
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
268
+
269
+ The generation context.
270
+
271
+ ##### members
272
+
273
+ `NodeArray`\<`TypeElement`\>
274
+
275
+ The members to process.
276
+
277
+ #### Returns
278
+
279
+ `object`
280
+
281
+ The object property schema map and required list.
282
+
283
+ ##### properties
284
+
285
+ > **properties**: `object`
286
+
287
+ ###### Index Signature
288
+
289
+ \[`key`: `string`\]: `IJsonSchema`
290
+
291
+ ##### required
292
+
293
+ > **required**: `string`[]
294
+
295
+ ##### patternProperties?
296
+
297
+ > `optional` **patternProperties?**: `object`
298
+
299
+ ###### Index Signature
300
+
301
+ \[`pattern`: `string`\]: `IJsonSchema`
302
+
303
+ ##### additionalProperties?
304
+
305
+ > `optional` **additionalProperties?**: `IJsonSchema`
306
+
307
+ ##### propertyNames?
308
+
309
+ > `optional` **propertyNames?**: `IJsonSchema`
310
+
311
+ ***
312
+
313
+ ### buildTypeLiteralSchema() {#buildtypeliteralschema}
314
+
315
+ > `static` **buildTypeLiteralSchema**(`context`, `typeNode`): `IJsonSchema`
316
+
317
+ Build an object schema from a type literal node.
318
+
319
+ #### Parameters
320
+
321
+ ##### context
322
+
323
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
324
+
325
+ The generation context.
326
+
327
+ ##### typeNode
328
+
329
+ `TypeLiteralNode`
330
+
331
+ The type literal node.
332
+
333
+ #### Returns
334
+
335
+ `IJsonSchema`
336
+
337
+ The object schema.
338
+
339
+ ***
340
+
341
+ ### mergePatternPropertySchemas() {#mergepatternpropertyschemas}
342
+
343
+ > `static` **mergePatternPropertySchemas**(`patternPropertySchemas`): \{\[`pattern`: `string`\]: `IJsonSchema`; \} \| `undefined`
344
+
345
+ Merge pattern property schemas by pattern, deduplicating equivalent branches.
346
+
347
+ #### Parameters
348
+
349
+ ##### patternPropertySchemas
350
+
351
+ `object`[]
352
+
353
+ Pattern and schema entries to merge.
354
+
355
+ #### Returns
356
+
357
+ \{\[`pattern`: `string`\]: `IJsonSchema`; \} \| `undefined`
358
+
359
+ Merged patternProperties map.
360
+
361
+ ***
362
+
363
+ ### mapMemberTypeToSchema() {#mapmembertypetoschema}
364
+
365
+ > `static` **mapMemberTypeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
366
+
367
+ Map a property type node to schema.
368
+
369
+ #### Parameters
370
+
371
+ ##### context
372
+
373
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
374
+
375
+ The generation context.
376
+
377
+ ##### typeNode
378
+
379
+ `TypeNode`
380
+
381
+ The member type node.
382
+
383
+ #### Returns
384
+
385
+ `IJsonSchema` \| `undefined`
386
+
387
+ The mapped member schema.
388
+
389
+ ***
390
+
391
+ ### mapTypeNodeToSchema() {#maptypenodetoschema}
392
+
393
+ > `static` **mapTypeNodeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
394
+
395
+ Map TypeScript type nodes to JSON schema.
396
+
397
+ #### Parameters
398
+
399
+ ##### context
400
+
401
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
402
+
403
+ The generation context.
404
+
405
+ ##### typeNode
406
+
407
+ `TypeNode`
408
+
409
+ The node to process.
410
+
411
+ #### Returns
412
+
413
+ `IJsonSchema` \| `undefined`
414
+
415
+ The mapped schema.
416
+
417
+ ***
418
+
419
+ ### isDisjointPrimitiveKeywordUnion() {#isdisjointprimitivekeywordunion}
420
+
421
+ > `static` **isDisjointPrimitiveKeywordUnion**(`unionTypeNode`, `unionTypeNodes`, `unionSchemas`): `boolean`
422
+
423
+ Determine whether a union of primitive keyword branches is pairwise disjoint.
424
+
425
+ #### Parameters
426
+
427
+ ##### unionTypeNode
428
+
429
+ `UnionTypeNode`
430
+
431
+ The union node being mapped.
432
+
433
+ ##### unionTypeNodes
434
+
435
+ `NodeArray`\<`TypeNode`\>
436
+
437
+ The original union branch type nodes.
438
+
439
+ ##### unionSchemas
440
+
441
+ `IJsonSchema`[]
442
+
443
+ The mapped union branch schemas.
444
+
445
+ #### Returns
446
+
447
+ `boolean`
448
+
449
+ True if every branch is a primitive keyword schema and no branches overlap.
450
+
451
+ ***
452
+
453
+ ### isNeverDiscriminatedObjectUnion() {#isneverdiscriminatedobjectunion}
454
+
455
+ > `static` **isNeverDiscriminatedObjectUnion**(`context`, `unionTypeNodes`, `unionSchemas`): `boolean`
456
+
457
+ Determine whether a union of schemas represents mutually exclusive object branches.
458
+
459
+ #### Parameters
460
+
461
+ ##### context
462
+
463
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
464
+
465
+ The generation context.
466
+
467
+ ##### unionTypeNodes
468
+
469
+ `NodeArray`\<`TypeNode`\>
470
+
471
+ The union branch type nodes for cross-checking with the mapped schemas.
472
+
473
+ ##### unionSchemas
474
+
475
+ `IJsonSchema`[]
476
+
477
+ The mapped union branch schemas.
478
+
479
+ #### Returns
480
+
481
+ `boolean`
482
+
483
+ True if each branch is an object schema with a unique required key set.
484
+
485
+ ***
486
+
487
+ ### isLiteralTagDiscriminatedObjectUnion() {#isliteraltagdiscriminatedobjectunion}
488
+
489
+ > `static` **isLiteralTagDiscriminatedObjectUnion**(`context`, `unionSchemas`): `boolean`
490
+
491
+ Determine whether object union branches are discriminated by a shared required literal tag.
492
+
493
+ #### Parameters
494
+
495
+ ##### context
496
+
497
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
498
+
499
+ The generation context.
500
+
501
+ ##### unionSchemas
502
+
503
+ `IJsonSchema`[]
504
+
505
+ The mapped union branch schemas.
506
+
507
+ #### Returns
508
+
509
+ `boolean`
510
+
511
+ True if the union can be safely represented as oneOf.
512
+
513
+ ***
514
+
515
+ ### resolveNeverDiscriminatorMembers() {#resolveneverdiscriminatormembers}
516
+
517
+ > `static` **resolveNeverDiscriminatorMembers**(`context`, `unionTypeNode`): `NodeArray`\<`TypeElement`\> \| `undefined`
518
+
519
+ Resolve branch members that can encode never-based discriminators.
520
+
521
+ #### Parameters
522
+
523
+ ##### context
524
+
525
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
526
+
527
+ The generation context.
528
+
529
+ ##### unionTypeNode
530
+
531
+ `TypeNode`
532
+
533
+ The union branch type node.
534
+
535
+ #### Returns
536
+
537
+ `NodeArray`\<`TypeElement`\> \| `undefined`
538
+
539
+ Type members for the branch when resolvable.
540
+
541
+ ***
542
+
543
+ ### resolveLocalSchemaReference() {#resolvelocalschemareference}
544
+
545
+ > `static` **resolveLocalSchemaReference**(`context`, `schema`): `IJsonSchema` \| `undefined`
546
+
547
+ Resolve a local $ref schema to its stored schema definition.
548
+
549
+ #### Parameters
550
+
551
+ ##### context
552
+
553
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
554
+
555
+ The generation context.
556
+
557
+ ##### schema
558
+
559
+ `IJsonSchema`
560
+
561
+ The schema that may contain a local reference.
562
+
563
+ #### Returns
564
+
565
+ `IJsonSchema` \| `undefined`
566
+
567
+ The resolved schema when available.
568
+
569
+ ***
570
+
571
+ ### resolveConstObjectProperty() {#resolveconstobjectproperty}
572
+
573
+ > `static` **resolveConstObjectProperty**(`context`, `objectName`, `propertyName`): `string` \| `number` \| `undefined`
574
+
575
+ Resolve a property value from a const object declaration in an imported source file.
576
+
577
+ #### Parameters
578
+
579
+ ##### context
580
+
581
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
582
+
583
+ The generation context.
584
+
585
+ ##### objectName
586
+
587
+ `string`
588
+
589
+ The name of the const object.
590
+
591
+ ##### propertyName
592
+
593
+ `string`
594
+
595
+ The name of the property to resolve.
596
+
597
+ #### Returns
598
+
599
+ `string` \| `number` \| `undefined`
600
+
601
+ The resolved string or number value, or undefined if unresolvable.
602
+
603
+ ***
604
+
605
+ ### findVariableDeclarationInModuleGraph() {#findvariabledeclarationinmodulegraph}
606
+
607
+ > `static` **findVariableDeclarationInModuleGraph**(`sourceFilePath`, `variableName`, `visitedFiles`): `VariableDeclaration` \| `undefined`
608
+
609
+ Find a variable declaration by traversing import and export chains.
610
+
611
+ #### Parameters
612
+
613
+ ##### sourceFilePath
614
+
615
+ `string`
616
+
617
+ The source file path to start from.
618
+
619
+ ##### variableName
620
+
621
+ `string`
622
+
623
+ The variable declaration name to find.
624
+
625
+ ##### visitedFiles
626
+
627
+ `Set`\<`string`\>
628
+
629
+ The file set already visited.
630
+
631
+ #### Returns
632
+
633
+ `VariableDeclaration` \| `undefined`
634
+
635
+ The variable declaration when found.
636
+
637
+ ***
638
+
639
+ ### findImportedValueReference() {#findimportedvaluereference}
640
+
641
+ > `static` **findImportedValueReference**(`sourceFile`, `localName`): \{ `moduleSpecifier`: `string`; `importedName`: `string`; \} \| `undefined`
642
+
643
+ Find an imported symbol reference by local identifier name.
644
+
645
+ #### Parameters
646
+
647
+ ##### sourceFile
648
+
649
+ `SourceFile`
650
+
651
+ The source file to inspect.
652
+
653
+ ##### localName
654
+
655
+ `string`
656
+
657
+ The local identifier name.
658
+
659
+ #### Returns
660
+
661
+ \{ `moduleSpecifier`: `string`; `importedName`: `string`; \} \| `undefined`
662
+
663
+ The module specifier and imported symbol name.
664
+
665
+ ***
666
+
667
+ ### resolveImportDeclarationSourceFile() {#resolveimportdeclarationsourcefile}
668
+
669
+ > `static` **resolveImportDeclarationSourceFile**(`containingSourceFilePath`, `moduleSpecifier`): `string` \| `undefined`
670
+
671
+ Resolve an import declaration module specifier to a source file.
672
+
673
+ #### Parameters
674
+
675
+ ##### containingSourceFilePath
676
+
677
+ `string`
678
+
679
+ The containing source file path.
680
+
681
+ ##### moduleSpecifier
682
+
683
+ `string`
684
+
685
+ The module specifier text.
686
+
687
+ #### Returns
688
+
689
+ `string` \| `undefined`
690
+
691
+ The resolved source file path.
692
+
693
+ ***
694
+
695
+ ### extractConstObjectPropertyFromDeclarationInitializer() {#extractconstobjectpropertyfromdeclarationinitializer}
696
+
697
+ > `static` **extractConstObjectPropertyFromDeclarationInitializer**(`objectDeclaration`, `propertyName`): `string` \| `number` \| `undefined`
698
+
699
+ Extract a const-object property value from a declaration initializer.
700
+
701
+ #### Parameters
702
+
703
+ ##### objectDeclaration
704
+
705
+ `VariableDeclaration`
706
+
707
+ The variable declaration.
708
+
709
+ ##### propertyName
710
+
711
+ `string`
712
+
713
+ The property to resolve.
714
+
715
+ #### Returns
716
+
717
+ `string` \| `number` \| `undefined`
718
+
719
+ The resolved value.
720
+
721
+ ***
722
+
723
+ ### extractConstObjectPropertyFromDeclarationType() {#extractconstobjectpropertyfromdeclarationtype}
724
+
725
+ > `static` **extractConstObjectPropertyFromDeclarationType**(`declarationTypeNode`, `propertyName`): `string` \| `number` \| `undefined`
726
+
727
+ Extract a const-object property value from a declaration type annotation.
728
+
729
+ #### Parameters
730
+
731
+ ##### declarationTypeNode
732
+
733
+ `TypeNode`
734
+
735
+ The declaration type annotation.
736
+
737
+ ##### propertyName
738
+
739
+ `string`
740
+
741
+ The property to resolve.
742
+
743
+ #### Returns
744
+
745
+ `string` \| `number` \| `undefined`
746
+
747
+ The resolved value.
748
+
749
+ ***
750
+
751
+ ### extractLiteralValueFromTypeNode() {#extractliteralvaluefromtypenode}
752
+
753
+ > `static` **extractLiteralValueFromTypeNode**(`typeNode`): `string` \| `number` \| `undefined`
754
+
755
+ Extract a literal value from a type node when possible.
756
+
757
+ #### Parameters
758
+
759
+ ##### typeNode
760
+
761
+ `TypeNode`
762
+
763
+ The type node.
764
+
765
+ #### Returns
766
+
767
+ `string` \| `number` \| `undefined`
768
+
769
+ The literal value.
770
+
771
+ ***
772
+
773
+ ### extractImportTypeName() {#extractimporttypename}
774
+
775
+ > `static` **extractImportTypeName**(`qualifier`): `string` \| `undefined`
776
+
777
+ Extract a referenced type name from an import type qualifier.
778
+
779
+ #### Parameters
780
+
781
+ ##### qualifier
782
+
783
+ `EntityName` \| `undefined`
784
+
785
+ The import type qualifier.
786
+
787
+ #### Returns
788
+
789
+ `string` \| `undefined`
790
+
791
+ The resolved type name.
792
+
793
+ ***
794
+
795
+ ### resolveImportTypeReferenceSchemaId() {#resolveimporttypereferenceschemaid}
796
+
797
+ > `static` **resolveImportTypeReferenceSchemaId**(`context`, `moduleSpecifier`, `typeName`, `title`): `string` \| `undefined`
798
+
799
+ Resolve import-type references to local or external schema ids.
800
+
801
+ #### Parameters
802
+
803
+ ##### context
804
+
805
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
806
+
807
+ The generation context.
808
+
809
+ ##### moduleSpecifier
810
+
811
+ `string`
812
+
813
+ The import module specifier.
814
+
815
+ ##### typeName
816
+
817
+ `string`
818
+
819
+ The imported type name.
820
+
821
+ ##### title
822
+
823
+ `string`
824
+
825
+ The derived schema title.
826
+
827
+ #### Returns
828
+
829
+ `string` \| `undefined`
830
+
831
+ The resolved schema id.
832
+
833
+ ***
834
+
835
+ ### inferSchemaFromExpression() {#inferschemafromexpression}
836
+
837
+ > `static` **inferSchemaFromExpression**(`context`, `expr`, `asConst?`): `IJsonSchema`
838
+
839
+ Infer a primitive JSON schema from a literal expression.
840
+
841
+ #### Parameters
842
+
843
+ ##### context
844
+
845
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
846
+
847
+ The generation context.
848
+
849
+ ##### expr
850
+
851
+ `Expression`
852
+
853
+ The expression to inspect.
854
+
855
+ ##### asConst?
856
+
857
+ `boolean` = `false`
858
+
859
+ Whether to produce exact const schemas matching an as-const assertion.
860
+
861
+ #### Returns
862
+
863
+ `IJsonSchema`
864
+
865
+ The inferred schema.
866
+
867
+ ***
868
+
869
+ ### inferObjectLiteralSchema() {#inferobjectliteralschema}
870
+
871
+ > `static` **inferObjectLiteralSchema**(`context`, `expr`, `asConst`): `IJsonSchema`
872
+
873
+ Infer an object schema from an object literal expression, using const or widened types.
874
+
875
+ #### Parameters
876
+
877
+ ##### context
878
+
879
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
880
+
881
+ The generation context.
882
+
883
+ ##### expr
884
+
885
+ `ObjectLiteralExpression`
886
+
887
+ The object literal expression.
888
+
889
+ ##### asConst
890
+
891
+ `boolean`
892
+
893
+ Whether property value schemas should be exact const types.
894
+
895
+ #### Returns
896
+
897
+ `IJsonSchema`
898
+
899
+ The inferred object schema.
900
+
901
+ ***
902
+
903
+ ### inferArrayLiteralSchema() {#inferarrayliteralschema}
904
+
905
+ > `static` **inferArrayLiteralSchema**(`context`, `expr`, `asConst`): `IJsonSchema`
906
+
907
+ Infer an array schema from an array literal expression.
908
+ For as-const arrays a fixed-length tuple schema is produced; otherwise a plain array schema.
909
+
910
+ #### Parameters
911
+
912
+ ##### context
913
+
914
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
915
+
916
+ The generation context.
917
+
918
+ ##### expr
919
+
920
+ `ArrayLiteralExpression`
921
+
922
+ The array literal expression.
923
+
924
+ ##### asConst
925
+
926
+ `boolean`
927
+
928
+ Whether to produce a const-exact tuple schema.
929
+
930
+ #### Returns
931
+
932
+ `IJsonSchema`
933
+
934
+ The inferred array schema.
935
+
936
+ ***
937
+
938
+ ### mapConditionalTypeToSchema() {#mapconditionaltypetoschema}
939
+
940
+ > `static` **mapConditionalTypeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
941
+
942
+ Map conditional type nodes (e.g. T extends U ? X : Y) to schema.
943
+
944
+ #### Parameters
945
+
946
+ ##### context
947
+
948
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
949
+
950
+ The generation context.
951
+
952
+ ##### typeNode
953
+
954
+ `ConditionalTypeNode`
955
+
956
+ The conditional type node.
957
+
958
+ #### Returns
959
+
960
+ `IJsonSchema` \| `undefined`
961
+
962
+ The mapped schema.
963
+
964
+ ***
965
+
966
+ ### mapIndexedAccessTypeToSchema() {#mapindexedaccesstypetoschema}
967
+
968
+ > `static` **mapIndexedAccessTypeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
969
+
970
+ Map indexed access type nodes (e.g. T["id"]) to schema.
971
+
972
+ #### Parameters
973
+
974
+ ##### context
975
+
976
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
977
+
978
+ The generation context.
979
+
980
+ ##### typeNode
981
+
982
+ `IndexedAccessTypeNode`
983
+
984
+ The indexed access type node.
985
+
986
+ #### Returns
987
+
988
+ `IJsonSchema` \| `undefined`
989
+
990
+ The mapped schema.
991
+
992
+ ***
993
+
994
+ ### mapTemplateLiteralTypeToSchema() {#maptemplateliteraltypetoschema}
995
+
996
+ > `static` **mapTemplateLiteralTypeToSchema**(`context`, `typeNode`): `IJsonSchema`
997
+
998
+ Map template literal type nodes to string schemas.
999
+
1000
+ #### Parameters
1001
+
1002
+ ##### context
1003
+
1004
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1005
+
1006
+ The generation context.
1007
+
1008
+ ##### typeNode
1009
+
1010
+ `TemplateLiteralTypeNode`
1011
+
1012
+ The template literal type node.
1013
+
1014
+ #### Returns
1015
+
1016
+ `IJsonSchema`
1017
+
1018
+ The mapped schema.
1019
+
1020
+ ***
1021
+
1022
+ ### mapMappedTypeToSchema() {#mapmappedtypetoschema}
1023
+
1024
+ > `static` **mapMappedTypeToSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1025
+
1026
+ Map mapped type nodes to object schemas.
1027
+
1028
+ #### Parameters
1029
+
1030
+ ##### context
1031
+
1032
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1033
+
1034
+ The generation context.
1035
+
1036
+ ##### typeNode
1037
+
1038
+ `MappedTypeNode`
1039
+
1040
+ The mapped type node.
1041
+
1042
+ #### Returns
1043
+
1044
+ `IJsonSchema` \| `undefined`
1045
+
1046
+ The mapped schema.
1047
+
1048
+ ***
1049
+
1050
+ ### isMappedTypeIndexedValueByTypeParameter() {#ismappedtypeindexedvaluebytypeparameter}
1051
+
1052
+ > `static` **isMappedTypeIndexedValueByTypeParameter**(`typeNode`, `mappedTypeParameterName`): `boolean`
1053
+
1054
+ Determine whether a mapped type value uses indexed access with the mapped key parameter.
1055
+
1056
+ #### Parameters
1057
+
1058
+ ##### typeNode
1059
+
1060
+ `MappedTypeNode`
1061
+
1062
+ The mapped type node.
1063
+
1064
+ ##### mappedTypeParameterName
1065
+
1066
+ `string`
1067
+
1068
+ The mapped type parameter name.
1069
+
1070
+ #### Returns
1071
+
1072
+ `boolean`
1073
+
1074
+ True if the value shape is based on source indexed access.
1075
+
1076
+ ***
1077
+
1078
+ ### checkTypeNodeAllowed() {#checktypenodeallowed}
1079
+
1080
+ > `static` **checkTypeNodeAllowed**(`context`, `typeNode`, `propertyName?`, `enclosingObjectName?`): `boolean`
1081
+
1082
+ Check whether a type node is allowed for schema generation.
1083
+
1084
+ #### Parameters
1085
+
1086
+ ##### context
1087
+
1088
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1089
+
1090
+ The generation context.
1091
+
1092
+ ##### typeNode
1093
+
1094
+ `TypeNode`
1095
+
1096
+ The type node to inspect.
1097
+
1098
+ ##### propertyName?
1099
+
1100
+ `string`
1101
+
1102
+ The optional property name when the type is a property type.
1103
+
1104
+ ##### enclosingObjectName?
1105
+
1106
+ `string`
1107
+
1108
+ The optional enclosing object name when the type is a property type.
1109
+
1110
+ #### Returns
1111
+
1112
+ `boolean`
1113
+
1114
+ True when the type is allowed.
1115
+
1116
+ ***
1117
+
1118
+ ### isFunctionPropertyType() {#isfunctionpropertytype}
1119
+
1120
+ > `static` **isFunctionPropertyType**(`typeNode`): `boolean`
1121
+
1122
+ Determine whether a property type should be treated as a function and skipped.
1123
+
1124
+ #### Parameters
1125
+
1126
+ ##### typeNode
1127
+
1128
+ `TypeNode`
1129
+
1130
+ The property type node.
1131
+
1132
+ #### Returns
1133
+
1134
+ `boolean`
1135
+
1136
+ True if the property type is function-like.
1137
+
1138
+ ***
1139
+
1140
+ ### isSymbolTypeNode() {#issymboltypenode}
1141
+
1142
+ > `static` **isSymbolTypeNode**(`typeNode`): `boolean`
1143
+
1144
+ Determine whether a type node represents symbol or unique symbol.
1145
+
1146
+ #### Parameters
1147
+
1148
+ ##### typeNode
1149
+
1150
+ `TypeNode`
1151
+
1152
+ The type node to inspect.
1153
+
1154
+ #### Returns
1155
+
1156
+ `boolean`
1157
+
1158
+ True when the type is symbol or unique symbol.
1159
+
1160
+ ***
1161
+
1162
+ ### isSymbolKeyedComputedExpression() {#issymbolkeyedcomputedexpression}
1163
+
1164
+ > `static` **isSymbolKeyedComputedExpression**(`context`, `expression`): `boolean`
1165
+
1166
+ Determine whether a computed property expression references a symbol.
1167
+ Covers well-known symbols (Symbol.iterator, etc.) and const variables
1168
+ declared with a unique symbol type annotation.
1169
+
1170
+ #### Parameters
1171
+
1172
+ ##### context
1173
+
1174
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1175
+
1176
+ The generation context.
1177
+
1178
+ ##### expression
1179
+
1180
+ `Expression`
1181
+
1182
+ The computed property expression.
1183
+
1184
+ #### Returns
1185
+
1186
+ `boolean`
1187
+
1188
+ True when the key is symbol-based.
1189
+
1190
+ ***
1191
+
1192
+ ### extractPropertyName() {#extractpropertyname}
1193
+
1194
+ > `static` **extractPropertyName**(`context`, `propertyName`): `string` \| `undefined`
1195
+
1196
+ Extract a property name from TypeScript property syntax.
1197
+ Computed names are resolved when they evaluate to concrete literals.
1198
+
1199
+ #### Parameters
1200
+
1201
+ ##### context
1202
+
1203
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1204
+
1205
+ The generation context.
1206
+
1207
+ ##### propertyName
1208
+
1209
+ `PropertyName`
1210
+
1211
+ The property name node.
1212
+
1213
+ #### Returns
1214
+
1215
+ `string` \| `undefined`
1216
+
1217
+ The normalized property name.
1218
+
1219
+ ***
1220
+
1221
+ ### findVariableDeclaration() {#findvariabledeclaration}
1222
+
1223
+ > `static` **findVariableDeclaration**(`sourceFile`, `variableName`): `VariableDeclaration` \| `undefined`
1224
+
1225
+ Find a variable declaration by name in a source file.
1226
+
1227
+ #### Parameters
1228
+
1229
+ ##### sourceFile
1230
+
1231
+ `SourceFile` \| `undefined`
1232
+
1233
+ The source file to search.
1234
+
1235
+ ##### variableName
1236
+
1237
+ `string`
1238
+
1239
+ The variable name.
1240
+
1241
+ #### Returns
1242
+
1243
+ `VariableDeclaration` \| `undefined`
1244
+
1245
+ The declaration if found.
1246
+
1247
+ ***
1248
+
1249
+ ### resolveImportedTypeQuerySchema() {#resolveimportedtypequeryschema}
1250
+
1251
+ > `static` **resolveImportedTypeQuerySchema**(`context`, `localName`): `IJsonSchema` \| `undefined`
1252
+
1253
+ Resolve a schema for an imported identifier used in a type query.
1254
+
1255
+ #### Parameters
1256
+
1257
+ ##### context
1258
+
1259
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1260
+
1261
+ The generation context.
1262
+
1263
+ ##### localName
1264
+
1265
+ `string`
1266
+
1267
+ The local imported symbol name.
1268
+
1269
+ #### Returns
1270
+
1271
+ `IJsonSchema` \| `undefined`
1272
+
1273
+ The mapped schema if resolvable.
1274
+
1275
+ ***
1276
+
1277
+ ### resolveComputedPropertyNameExpression() {#resolvecomputedpropertynameexpression}
1278
+
1279
+ > `static` **resolveComputedPropertyNameExpression**(`context`, `expression`, `resolvingIdentifiers`): `string` \| `undefined`
1280
+
1281
+ Resolve computed property name expressions when they can be evaluated to concrete keys.
1282
+
1283
+ #### Parameters
1284
+
1285
+ ##### context
1286
+
1287
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1288
+
1289
+ The generation context.
1290
+
1291
+ ##### expression
1292
+
1293
+ `Expression`
1294
+
1295
+ The computed property expression.
1296
+
1297
+ ##### resolvingIdentifiers
1298
+
1299
+ `Set`\<`string`\>
1300
+
1301
+ Identifier names currently being resolved.
1302
+
1303
+ #### Returns
1304
+
1305
+ `string` \| `undefined`
1306
+
1307
+ The resolved property key.
1308
+
1309
+ ***
1310
+
1311
+ ### findConstVariableDeclaration() {#findconstvariabledeclaration}
1312
+
1313
+ > `static` **findConstVariableDeclaration**(`context`, `variableName`): `VariableDeclaration` \| `undefined`
1314
+
1315
+ Find a local const variable declaration in the active source file.
1316
+
1317
+ #### Parameters
1318
+
1319
+ ##### context
1320
+
1321
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1322
+
1323
+ The generation context.
1324
+
1325
+ ##### variableName
1326
+
1327
+ `string`
1328
+
1329
+ The variable name.
1330
+
1331
+ #### Returns
1332
+
1333
+ `VariableDeclaration` \| `undefined`
1334
+
1335
+ The declaration when found.
1336
+
1337
+ ***
1338
+
1339
+ ### resolveLocalConstObjectProperty() {#resolvelocalconstobjectproperty}
1340
+
1341
+ > `static` **resolveLocalConstObjectProperty**(`context`, `objectName`, `propertyName`): `string` \| `number` \| `undefined`
1342
+
1343
+ Resolve a property value from a local const object declaration.
1344
+
1345
+ #### Parameters
1346
+
1347
+ ##### context
1348
+
1349
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1350
+
1351
+ The generation context.
1352
+
1353
+ ##### objectName
1354
+
1355
+ `string`
1356
+
1357
+ The const object name.
1358
+
1359
+ ##### propertyName
1360
+
1361
+ `string`
1362
+
1363
+ The property to resolve.
1364
+
1365
+ #### Returns
1366
+
1367
+ `string` \| `number` \| `undefined`
1368
+
1369
+ The resolved value when available.
1370
+
1371
+ ***
1372
+
1373
+ ### mapTupleTypeToSchema() {#maptupletypetoschema}
1374
+
1375
+ > `static` **mapTupleTypeToSchema**(`context`, `tupleTypeNode`): `IJsonSchema` \| `undefined`
1376
+
1377
+ Map a tuple type node to schema.
1378
+
1379
+ #### Parameters
1380
+
1381
+ ##### context
1382
+
1383
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1384
+
1385
+ The generation context.
1386
+
1387
+ ##### tupleTypeNode
1388
+
1389
+ `TupleTypeNode`
1390
+
1391
+ The tuple type node.
1392
+
1393
+ #### Returns
1394
+
1395
+ `IJsonSchema` \| `undefined`
1396
+
1397
+ The mapped tuple schema.
1398
+
1399
+ ***
1400
+
1401
+ ### extractRestElementSchema() {#extractrestelementschema}
1402
+
1403
+ > `static` **extractRestElementSchema**(`context`, `restElementType`): `IJsonSchema` \| `undefined`
1404
+
1405
+ Extract schema for a tuple rest element.
1406
+
1407
+ #### Parameters
1408
+
1409
+ ##### context
1410
+
1411
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1412
+
1413
+ The generation context.
1414
+
1415
+ ##### restElementType
1416
+
1417
+ `TypeNode`
1418
+
1419
+ The rest element type.
1420
+
1421
+ #### Returns
1422
+
1423
+ `IJsonSchema` \| `undefined`
1424
+
1425
+ The mapped rest element schema.
1426
+
1427
+ ***
1428
+
1429
+ ### findExistingSchemaIdByTitle() {#findexistingschemaidbytitle}
1430
+
1431
+ > `static` **findExistingSchemaIdByTitle**(`context`, `schemaTitle`): `string` \| `undefined`
1432
+
1433
+ Find an existing schema id by title in known package schemas.
1434
+
1435
+ #### Parameters
1436
+
1437
+ ##### context
1438
+
1439
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1440
+
1441
+ The generation context.
1442
+
1443
+ ##### schemaTitle
1444
+
1445
+ `string`
1446
+
1447
+ The schema title to find.
1448
+
1449
+ #### Returns
1450
+
1451
+ `string` \| `undefined`
1452
+
1453
+ The existing schema id if found.
1454
+
1455
+ ***
1456
+
1457
+ ### applyInterfaceExtendsSchema() {#applyinterfaceextendsschema}
1458
+
1459
+ > `static` **applyInterfaceExtendsSchema**(`context`, `schema`, `declaration`): `void`
1460
+
1461
+ Apply interface inheritance (`extends`) as `allOf` references.
1462
+
1463
+ #### Parameters
1464
+
1465
+ ##### context
1466
+
1467
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1468
+
1469
+ The generation context.
1470
+
1471
+ ##### schema
1472
+
1473
+ `Partial`\<`IJsonSchema`\>
1474
+
1475
+ The schema to expand.
1476
+
1477
+ ##### declaration
1478
+
1479
+ `InterfaceDeclaration`
1480
+
1481
+ The interface declaration.
1482
+
1483
+ #### Returns
1484
+
1485
+ `void`
1486
+
1487
+ ***
1488
+
1489
+ ### mapPartialUtilityType() {#mappartialutilitytype}
1490
+
1491
+ > `static` **mapPartialUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1492
+
1493
+ Map Partial<T> to an object schema with no required properties.
1494
+
1495
+ #### Parameters
1496
+
1497
+ ##### context
1498
+
1499
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1500
+
1501
+ The generation context.
1502
+
1503
+ ##### typeNode
1504
+
1505
+ `TypeReferenceNode`
1506
+
1507
+ The Partial type reference.
1508
+
1509
+ #### Returns
1510
+
1511
+ `IJsonSchema` \| `undefined`
1512
+
1513
+ The mapped schema.
1514
+
1515
+ ***
1516
+
1517
+ ### mapRequiredUtilityType() {#maprequiredutilitytype}
1518
+
1519
+ > `static` **mapRequiredUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1520
+
1521
+ Map Required<T> to an object schema with all properties required.
1522
+
1523
+ #### Parameters
1524
+
1525
+ ##### context
1526
+
1527
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1528
+
1529
+ The generation context.
1530
+
1531
+ ##### typeNode
1532
+
1533
+ `TypeReferenceNode`
1534
+
1535
+ The Required type reference.
1536
+
1537
+ #### Returns
1538
+
1539
+ `IJsonSchema` \| `undefined`
1540
+
1541
+ The mapped schema.
1542
+
1543
+ ***
1544
+
1545
+ ### mapPickUtilityType() {#mappickutilitytype}
1546
+
1547
+ > `static` **mapPickUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1548
+
1549
+ Map Pick<T, K> to an object schema with selected keys preserved.
1550
+
1551
+ #### Parameters
1552
+
1553
+ ##### context
1554
+
1555
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1556
+
1557
+ The generation context.
1558
+
1559
+ ##### typeNode
1560
+
1561
+ `TypeReferenceNode`
1562
+
1563
+ The Pick type reference.
1564
+
1565
+ #### Returns
1566
+
1567
+ `IJsonSchema` \| `undefined`
1568
+
1569
+ The mapped schema.
1570
+
1571
+ ***
1572
+
1573
+ ### mapOmitUtilityType() {#mapomitutilitytype}
1574
+
1575
+ > `static` **mapOmitUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1576
+
1577
+ Map Omit<T, K> to an object schema with selected keys removed.
1578
+
1579
+ #### Parameters
1580
+
1581
+ ##### context
1582
+
1583
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1584
+
1585
+ The generation context.
1586
+
1587
+ ##### typeNode
1588
+
1589
+ `TypeReferenceNode`
1590
+
1591
+ The Omit type reference.
1592
+
1593
+ #### Returns
1594
+
1595
+ `IJsonSchema` \| `undefined`
1596
+
1597
+ The mapped schema.
1598
+
1599
+ ***
1600
+
1601
+ ### mapExcludeUtilityType() {#mapexcludeutilitytype}
1602
+
1603
+ > `static` **mapExcludeUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1604
+
1605
+ Map Exclude<T, U> to a schema that removes U members from T.
1606
+
1607
+ #### Parameters
1608
+
1609
+ ##### context
1610
+
1611
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1612
+
1613
+ The generation context.
1614
+
1615
+ ##### typeNode
1616
+
1617
+ `TypeReferenceNode`
1618
+
1619
+ The Exclude type reference.
1620
+
1621
+ #### Returns
1622
+
1623
+ `IJsonSchema` \| `undefined`
1624
+
1625
+ The mapped schema.
1626
+
1627
+ ***
1628
+
1629
+ ### mapExtractUtilityType() {#mapextractutilitytype}
1630
+
1631
+ > `static` **mapExtractUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1632
+
1633
+ Map Extract<T, U> to a schema that keeps U members from T.
1634
+
1635
+ #### Parameters
1636
+
1637
+ ##### context
1638
+
1639
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1640
+
1641
+ The generation context.
1642
+
1643
+ ##### typeNode
1644
+
1645
+ `TypeReferenceNode`
1646
+
1647
+ The Extract type reference.
1648
+
1649
+ #### Returns
1650
+
1651
+ `IJsonSchema` \| `undefined`
1652
+
1653
+ The mapped schema.
1654
+
1655
+ ***
1656
+
1657
+ ### mapNonNullableUtilityType() {#mapnonnullableutilitytype}
1658
+
1659
+ > `static` **mapNonNullableUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1660
+
1661
+ Map NonNullable<T> by removing null and undefined branches from T.
1662
+
1663
+ #### Parameters
1664
+
1665
+ ##### context
1666
+
1667
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1668
+
1669
+ The generation context.
1670
+
1671
+ ##### typeNode
1672
+
1673
+ `TypeReferenceNode`
1674
+
1675
+ The NonNullable type reference.
1676
+
1677
+ #### Returns
1678
+
1679
+ `IJsonSchema` \| `undefined`
1680
+
1681
+ The mapped schema.
1682
+
1683
+ ***
1684
+
1685
+ ### mapRecordUtilityType() {#maprecordutilitytype}
1686
+
1687
+ > `static` **mapRecordUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1688
+
1689
+ Map Record<K, V> to an object schema with key constraints where possible.
1690
+
1691
+ #### Parameters
1692
+
1693
+ ##### context
1694
+
1695
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1696
+
1697
+ The generation context.
1698
+
1699
+ ##### typeNode
1700
+
1701
+ `TypeReferenceNode`
1702
+
1703
+ The Record type reference.
1704
+
1705
+ #### Returns
1706
+
1707
+ `IJsonSchema` \| `undefined`
1708
+
1709
+ The mapped schema.
1710
+
1711
+ ***
1712
+
1713
+ ### isNullOrUndefinedTypeNode() {#isnullorundefinedtypenode}
1714
+
1715
+ > `static` **isNullOrUndefinedTypeNode**(`typeNode`): `boolean`
1716
+
1717
+ Determine whether a type node represents null or undefined.
1718
+
1719
+ #### Parameters
1720
+
1721
+ ##### typeNode
1722
+
1723
+ `TypeNode`
1724
+
1725
+ The type node.
1726
+
1727
+ #### Returns
1728
+
1729
+ `boolean`
1730
+
1731
+ True if the node is null or undefined.
1732
+
1733
+ ***
1734
+
1735
+ ### extractRecordLiteralKeys() {#extractrecordliteralkeys}
1736
+
1737
+ > `static` **extractRecordLiteralKeys**(`keyTypeNode`): `string`[]
1738
+
1739
+ Extract literal keys from a Record key type argument.
1740
+
1741
+ #### Parameters
1742
+
1743
+ ##### keyTypeNode
1744
+
1745
+ `TypeNode`
1746
+
1747
+ The key type argument node.
1748
+
1749
+ #### Returns
1750
+
1751
+ `string`[]
1752
+
1753
+ The extracted literal keys.
1754
+
1755
+ ***
1756
+
1757
+ ### mapJsonLdObjectUtilityType() {#mapjsonldobjectutilitytype}
1758
+
1759
+ > `static` **mapJsonLdObjectUtilityType**(`context`, `typeNode`, `options`): `IJsonSchema` \| `undefined`
1760
+
1761
+ Map JsonLdObject utility types using key-removal and optional key-addition rules.
1762
+
1763
+ #### Parameters
1764
+
1765
+ ##### context
1766
+
1767
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1768
+
1769
+ The generation context.
1770
+
1771
+ ##### typeNode
1772
+
1773
+ `TypeReferenceNode`
1774
+
1775
+ The JsonLdObject utility type reference.
1776
+
1777
+ ##### options
1778
+
1779
+ Mapping options.
1780
+
1781
+ ###### keysToRemove
1782
+
1783
+ `string`[]
1784
+
1785
+ Keys to remove from the base schema.
1786
+
1787
+ ###### keyToAdd?
1788
+
1789
+ `"type"` \| `"id"` \| `"@id"` \| `"@type"` \| `"@context"`
1790
+
1791
+ Optional key to add to the base schema.
1792
+
1793
+ ###### isAddedKeyRequired?
1794
+
1795
+ `boolean`
1796
+
1797
+ Whether the added key should be required.
1798
+
1799
+ #### Returns
1800
+
1801
+ `IJsonSchema` \| `undefined`
1802
+
1803
+ The mapped schema.
1804
+
1805
+ ***
1806
+
1807
+ ### mapJsonLdObjectDefaultSchemaByKey() {#mapjsonldobjectdefaultschemabykey}
1808
+
1809
+ > `static` **mapJsonLdObjectDefaultSchemaByKey**(`baseSchema`, `keyToAdd`): `IJsonSchema`
1810
+
1811
+ Resolve a default schema for JsonLdObject utility key additions when the type argument is omitted.
1812
+
1813
+ #### Parameters
1814
+
1815
+ ##### baseSchema
1816
+
1817
+ `IJsonSchema`
1818
+
1819
+ The base object schema.
1820
+
1821
+ ##### keyToAdd
1822
+
1823
+ `"type"` \| `"id"` \| `"@id"` \| `"@type"` \| `"@context"`
1824
+
1825
+ The key being added by the utility.
1826
+
1827
+ #### Returns
1828
+
1829
+ `IJsonSchema`
1830
+
1831
+ The resolved schema.
1832
+
1833
+ ***
1834
+
1835
+ ### mapJsonLdObjectWithIdDefaultIdSchema() {#mapjsonldobjectwithiddefaultidschema}
1836
+
1837
+ > `static` **mapJsonLdObjectWithIdDefaultIdSchema**(`baseSchema`): `IJsonSchema`
1838
+
1839
+ Resolve default id schema for JsonLdObjectWithId when Id type argument is omitted.
1840
+
1841
+ #### Parameters
1842
+
1843
+ ##### baseSchema
1844
+
1845
+ `IJsonSchema`
1846
+
1847
+ The base object schema.
1848
+
1849
+ #### Returns
1850
+
1851
+ `IJsonSchema`
1852
+
1853
+ The resolved id schema.
1854
+
1855
+ ***
1856
+
1857
+ ### mapJsonLdObjectWithTypeDefaultTypeSchema() {#mapjsonldobjectwithtypedefaulttypeschema}
1858
+
1859
+ > `static` **mapJsonLdObjectWithTypeDefaultTypeSchema**(`baseSchema`): `IJsonSchema`
1860
+
1861
+ Resolve default type schema for JsonLdObjectWithType when Type argument is omitted.
1862
+
1863
+ #### Parameters
1864
+
1865
+ ##### baseSchema
1866
+
1867
+ `IJsonSchema`
1868
+
1869
+ The base object schema.
1870
+
1871
+ #### Returns
1872
+
1873
+ `IJsonSchema`
1874
+
1875
+ The resolved type schema.
1876
+
1877
+ ***
1878
+
1879
+ ### mapJsonLdObjectWithContextDefaultContextSchema() {#mapjsonldobjectwithcontextdefaultcontextschema}
1880
+
1881
+ > `static` **mapJsonLdObjectWithContextDefaultContextSchema**(`baseSchema`): `IJsonSchema`
1882
+
1883
+ Resolve default context schema for JsonLdObjectWithContext when Context argument is omitted.
1884
+
1885
+ #### Parameters
1886
+
1887
+ ##### baseSchema
1888
+
1889
+ `IJsonSchema`
1890
+
1891
+ The base object schema.
1892
+
1893
+ #### Returns
1894
+
1895
+ `IJsonSchema`
1896
+
1897
+ The resolved context schema.
1898
+
1899
+ ***
1900
+
1901
+ ### mapJsonLdObjectDefaultEitherSchema() {#mapjsonldobjectdefaulteitherschema}
1902
+
1903
+ > `static` **mapJsonLdObjectDefaultEitherSchema**(`baseSchema`, `firstKey`, `secondKey`, `fallbackSchema`): `IJsonSchema`
1904
+
1905
+ Resolve default schema from either of two source keys, with fallback when both are absent.
1906
+
1907
+ #### Parameters
1908
+
1909
+ ##### baseSchema
1910
+
1911
+ `IJsonSchema`
1912
+
1913
+ The base object schema.
1914
+
1915
+ ##### firstKey
1916
+
1917
+ `string`
1918
+
1919
+ The primary key to resolve.
1920
+
1921
+ ##### secondKey
1922
+
1923
+ `string`
1924
+
1925
+ The secondary key to resolve.
1926
+
1927
+ ##### fallbackSchema
1928
+
1929
+ `IJsonSchema`
1930
+
1931
+ The fallback schema.
1932
+
1933
+ #### Returns
1934
+
1935
+ `IJsonSchema`
1936
+
1937
+ The resolved schema.
1938
+
1939
+ ***
1940
+
1941
+ ### mapObjectOrArrayUtilityType() {#mapobjectorarrayutilitytype}
1942
+
1943
+ > `static` **mapObjectOrArrayUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1944
+
1945
+ Map ObjectOrArray<T> to a schema accepting T or T[].
1946
+
1947
+ #### Parameters
1948
+
1949
+ ##### context
1950
+
1951
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1952
+
1953
+ The generation context.
1954
+
1955
+ ##### typeNode
1956
+
1957
+ `TypeReferenceNode`
1958
+
1959
+ The ObjectOrArray type reference.
1960
+
1961
+ #### Returns
1962
+
1963
+ `IJsonSchema` \| `undefined`
1964
+
1965
+ The mapped schema.
1966
+
1967
+ ***
1968
+
1969
+ ### mapSingleOccurrenceArrayUtilityType() {#mapsingleoccurrencearrayutilitytype}
1970
+
1971
+ > `static` **mapSingleOccurrenceArrayUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
1972
+
1973
+ Map SingleOccurrenceArray<T, U> to a non-empty array containing exactly one U.
1974
+
1975
+ #### Parameters
1976
+
1977
+ ##### context
1978
+
1979
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1980
+
1981
+ The generation context.
1982
+
1983
+ ##### typeNode
1984
+
1985
+ `TypeReferenceNode`
1986
+
1987
+ The SingleOccurrenceArray type reference.
1988
+
1989
+ #### Returns
1990
+
1991
+ `IJsonSchema` \| `undefined`
1992
+
1993
+ The mapped schema.
1994
+
1995
+ ***
1996
+
1997
+ ### annotateUtilityInlineSchema() {#annotateutilityinlineschema}
1998
+
1999
+ > `static` **annotateUtilityInlineSchema**(`schema`, `baseTypeDescription`): `IJsonSchema`
2000
+
2001
+ Add a comment to schemas inlined for utility type transformations.
2002
+
2003
+ #### Parameters
2004
+
2005
+ ##### schema
2006
+
2007
+ `IJsonSchema`
2008
+
2009
+ The schema to annotate.
2010
+
2011
+ ##### baseTypeDescription
2012
+
2013
+ `string`
2014
+
2015
+ The utility base type description.
2016
+
2017
+ #### Returns
2018
+
2019
+ `IJsonSchema`
2020
+
2021
+ The annotated schema.
2022
+
2023
+ ***
2024
+
2025
+ ### resolveUtilityBaseObjectSchema() {#resolveutilitybaseobjectschema}
2026
+
2027
+ > `static` **resolveUtilityBaseObjectSchema**(`context`, `baseTypeNode`): `IJsonSchema` \| `undefined`
2028
+
2029
+ Resolve a utility base type node to an object schema.
2030
+
2031
+ #### Parameters
2032
+
2033
+ ##### context
2034
+
2035
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2036
+
2037
+ The generation context.
2038
+
2039
+ ##### baseTypeNode
2040
+
2041
+ `TypeNode`
2042
+
2043
+ The utility base type node.
2044
+
2045
+ #### Returns
2046
+
2047
+ `IJsonSchema` \| `undefined`
2048
+
2049
+ The resolved object schema.
2050
+
2051
+ #### Throws
2052
+
2053
+ GeneralError when a named type reference cannot be resolved to a schema.
2054
+
2055
+ ***
2056
+
2057
+ ### resolveMappedUtilityBaseObjectSchema() {#resolvemappedutilitybaseobjectschema}
2058
+
2059
+ > `static` **resolveMappedUtilityBaseObjectSchema**(`context`, `mappedSchema`): `IJsonSchema` \| `undefined`
2060
+
2061
+ Resolve a mapped utility schema to an object schema when possible.
2062
+
2063
+ #### Parameters
2064
+
2065
+ ##### context
2066
+
2067
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2068
+
2069
+ The generation context.
2070
+
2071
+ ##### mappedSchema
2072
+
2073
+ `IJsonSchema`
2074
+
2075
+ The mapped schema.
2076
+
2077
+ #### Returns
2078
+
2079
+ `IJsonSchema` \| `undefined`
2080
+
2081
+ The resolved object schema.
2082
+
2083
+ ***
2084
+
2085
+ ### expandAllOfReferences() {#expandallofreferences}
2086
+
2087
+ > `static` **expandAllOfReferences**(`context`, `schema`, `currentSchemaTitle?`): `IJsonSchema`
2088
+
2089
+ Expand allOf references in a schema by inlining referenced schemas.
2090
+ This handles inheritance cases where a type extends another type.
2091
+ When applying utility operations (Omit, Pick) to types with allOf inheritance,
2092
+ the referenced schemas must be expanded so properties are available for omit/pick.
2093
+
2094
+ #### Parameters
2095
+
2096
+ ##### context
2097
+
2098
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2099
+
2100
+ The generation context.
2101
+
2102
+ ##### schema
2103
+
2104
+ `IJsonSchema`
2105
+
2106
+ The schema potentially containing allOf with references.
2107
+
2108
+ ##### currentSchemaTitle?
2109
+
2110
+ `string`
2111
+
2112
+ The title of the current schema being processed, used for $comment annotations.
2113
+
2114
+ #### Returns
2115
+
2116
+ `IJsonSchema`
2117
+
2118
+ The schema with expanded references merged into properties.
2119
+
2120
+ ***
2121
+
2122
+ ### tryLoadExternalSchemaByTitle() {#tryloadexternalschemabytitle}
2123
+
2124
+ > `static` **tryLoadExternalSchemaByTitle**(`context`, `schemaTitle`): `IJsonSchema` \| `undefined`
2125
+
2126
+ Attempt to load an external schema by title from imported module declarations.
2127
+
2128
+ #### Parameters
2129
+
2130
+ ##### context
2131
+
2132
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2133
+
2134
+ The generation context.
2135
+
2136
+ ##### schemaTitle
2137
+
2138
+ `string`
2139
+
2140
+ The schema title.
2141
+
2142
+ #### Returns
2143
+
2144
+ `IJsonSchema` \| `undefined`
2145
+
2146
+ The loaded schema.
2147
+
2148
+ ***
2149
+
2150
+ ### resolveObjectTypeSchemaForUtility() {#resolveobjecttypeschemaforutility}
2151
+
2152
+ > `static` **resolveObjectTypeSchemaForUtility**(`context`, `typeName`): `IJsonSchema` \| `undefined`
2153
+
2154
+ Resolve an object schema for utility type application.
2155
+
2156
+ #### Parameters
2157
+
2158
+ ##### context
2159
+
2160
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2161
+
2162
+ The generation context.
2163
+
2164
+ ##### typeName
2165
+
2166
+ `string`
2167
+
2168
+ The referenced type name.
2169
+
2170
+ #### Returns
2171
+
2172
+ `IJsonSchema` \| `undefined`
2173
+
2174
+ The resolved object schema.
2175
+
2176
+ ***
2177
+
2178
+ ### findImportedTypeReference() {#findimportedtypereference}
2179
+
2180
+ > `static` **findImportedTypeReference**(`context`, `typeName`): \{ `moduleSpecifier`: `string`; `candidateTypeName`: `string`; \} \| `undefined`
2181
+
2182
+ Find an imported type reference from the active source file by local or exported symbol name.
2183
+
2184
+ #### Parameters
2185
+
2186
+ ##### context
2187
+
2188
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2189
+
2190
+ The generation context.
2191
+
2192
+ ##### typeName
2193
+
2194
+ `string`
2195
+
2196
+ The local or exported type name to find.
2197
+
2198
+ #### Returns
2199
+
2200
+ \{ `moduleSpecifier`: `string`; `candidateTypeName`: `string`; \} \| `undefined`
2201
+
2202
+ The module specifier and exported candidate type name when found.
2203
+
2204
+ ***
2205
+
2206
+ ### resolveImportedObjectTypeSchemaForUtility() {#resolveimportedobjecttypeschemaforutility}
2207
+
2208
+ > `static` **resolveImportedObjectTypeSchemaForUtility**(`context`, `moduleSpecifier`, `candidateTypeName`, `title`): `IJsonSchema` \| `undefined`
2209
+
2210
+ Resolve an imported object schema for utility type application.
2211
+
2212
+ #### Parameters
2213
+
2214
+ ##### context
2215
+
2216
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2217
+
2218
+ The generation context.
2219
+
2220
+ ##### moduleSpecifier
2221
+
2222
+ `string`
2223
+
2224
+ The module where the type is imported from.
2225
+
2226
+ ##### candidateTypeName
2227
+
2228
+ `string`
2229
+
2230
+ The exported candidate type name.
2231
+
2232
+ ##### title
2233
+
2234
+ `string`
2235
+
2236
+ The stripped title of the requested type.
2237
+
2238
+ #### Returns
2239
+
2240
+ `IJsonSchema` \| `undefined`
2241
+
2242
+ The resolved object schema.
2243
+
2244
+ ***
2245
+
2246
+ ### mapObjectTypeFromLocalDeclaration() {#mapobjecttypefromlocaldeclaration}
2247
+
2248
+ > `static` **mapObjectTypeFromLocalDeclaration**(`context`, `typeName`): `IJsonSchema` \| `undefined`
2249
+
2250
+ Map a local interface or type alias declaration to an object schema.
2251
+
2252
+ #### Parameters
2253
+
2254
+ ##### context
2255
+
2256
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2257
+
2258
+ The generation context.
2259
+
2260
+ ##### typeName
2261
+
2262
+ `string`
2263
+
2264
+ The referenced type name.
2265
+
2266
+ #### Returns
2267
+
2268
+ `IJsonSchema` \| `undefined`
2269
+
2270
+ The mapped schema.
2271
+
2272
+ ***
2273
+
2274
+ ### extractUtilityTypeKeys() {#extractutilitytypekeys}
2275
+
2276
+ > `static` **extractUtilityTypeKeys**(`context`, `keysTypeNode`): `string`[]
2277
+
2278
+ Extract string literal keys from a utility type key argument (e.g. Pick or Omit).
2279
+
2280
+ #### Parameters
2281
+
2282
+ ##### context
2283
+
2284
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2285
+
2286
+ The generation context.
2287
+
2288
+ ##### keysTypeNode
2289
+
2290
+ `TypeNode` \| `undefined`
2291
+
2292
+ The keys type node.
2293
+
2294
+ #### Returns
2295
+
2296
+ `string`[]
2297
+
2298
+ The extracted keys.
2299
+
2300
+ ***
2301
+
2302
+ ### extractIndexedAccessKeys() {#extractindexedaccesskeys}
2303
+
2304
+ > `static` **extractIndexedAccessKeys**(`context`, `indexTypeNode`): `string`[]
2305
+
2306
+ Extract property keys from an indexed access index type.
2307
+
2308
+ #### Parameters
2309
+
2310
+ ##### context
2311
+
2312
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2313
+
2314
+ The generation context.
2315
+
2316
+ ##### indexTypeNode
2317
+
2318
+ `TypeNode`
2319
+
2320
+ The index type node.
2321
+
2322
+ #### Returns
2323
+
2324
+ `string`[]
2325
+
2326
+ The extracted keys.
2327
+
2328
+ ***
2329
+
2330
+ ### extractMappedTypeKeys() {#extractmappedtypekeys}
2331
+
2332
+ > `static` **extractMappedTypeKeys**(`context`, `constraintTypeNode`): `string`[]
2333
+
2334
+ Extract keys for a mapped type constraint.
2335
+
2336
+ #### Parameters
2337
+
2338
+ ##### context
2339
+
2340
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2341
+
2342
+ The generation context.
2343
+
2344
+ ##### constraintTypeNode
2345
+
2346
+ `TypeNode` \| `undefined`
2347
+
2348
+ The mapped type constraint.
2349
+
2350
+ #### Returns
2351
+
2352
+ `string`[]
2353
+
2354
+ The extracted keys.
2355
+
2356
+ ***
2357
+
2358
+ ### resolveReferencedTypeNodeFromLocalDeclaration() {#resolvereferencedtypenodefromlocaldeclaration}
2359
+
2360
+ > `static` **resolveReferencedTypeNodeFromLocalDeclaration**(`context`, `typeNode`): `TypeNode` \| `undefined`
2361
+
2362
+ Resolve a referenced type node from a local type alias declaration.
2363
+
2364
+ #### Parameters
2365
+
2366
+ ##### context
2367
+
2368
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2369
+
2370
+ The generation context.
2371
+
2372
+ ##### typeNode
2373
+
2374
+ `TypeReferenceNode`
2375
+
2376
+ The type reference node.
2377
+
2378
+ #### Returns
2379
+
2380
+ `TypeNode` \| `undefined`
2381
+
2382
+ The referenced type node, if found locally.
2383
+
2384
+ ***
2385
+
2386
+ ### withTypeParameterBindings() {#withtypeparameterbindings}
2387
+
2388
+ > `static` **withTypeParameterBindings**(`context`, `typeParameters`, `typeArguments?`): [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2389
+
2390
+ Create a nested mapping context with generic parameters bound.
2391
+
2392
+ #### Parameters
2393
+
2394
+ ##### context
2395
+
2396
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2397
+
2398
+ The current generation context.
2399
+
2400
+ ##### typeParameters
2401
+
2402
+ `NodeArray`\<`TypeParameterDeclaration`\> \| `undefined`
2403
+
2404
+ The generic type parameters for the declaration.
2405
+
2406
+ ##### typeArguments?
2407
+
2408
+ `NodeArray`\<`TypeNode`\>
2409
+
2410
+ Explicit type arguments, when provided.
2411
+
2412
+ #### Returns
2413
+
2414
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2415
+
2416
+ The scoped mapping context.
2417
+
2418
+ ***
2419
+
2420
+ ### getTypeParameterBinding() {#gettypeparameterbinding}
2421
+
2422
+ > `static` **getTypeParameterBinding**(`context`, `typeName`): `TypeNode` \| `null` \| `undefined`
2423
+
2424
+ Get a bound generic type parameter for the current mapping scope.
2425
+
2426
+ #### Parameters
2427
+
2428
+ ##### context
2429
+
2430
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2431
+
2432
+ The current generation context.
2433
+
2434
+ ##### typeName
2435
+
2436
+ `string`
2437
+
2438
+ The type name to resolve.
2439
+
2440
+ #### Returns
2441
+
2442
+ `TypeNode` \| `null` \| `undefined`
2443
+
2444
+ The bound type node, null for unresolved generic parameters, or undefined when not generic.
2445
+
2446
+ ***
2447
+
2448
+ ### isHomomorphicMappedType() {#ishomomorphicmappedtype}
2449
+
2450
+ > `static` **isHomomorphicMappedType**(`typeNode`): `boolean`
2451
+
2452
+ Determine whether a mapped type is a homomorphic source-preserving form.
2453
+
2454
+ #### Parameters
2455
+
2456
+ ##### typeNode
2457
+
2458
+ `MappedTypeNode`
2459
+
2460
+ The mapped type node.
2461
+
2462
+ #### Returns
2463
+
2464
+ `boolean`
2465
+
2466
+ True if the mapped type mirrors an existing object shape.
2467
+
2468
+ ***
2469
+
2470
+ ### resolveMappedTypeSourceObjectSchema() {#resolvemappedtypesourceobjectschema}
2471
+
2472
+ > `static` **resolveMappedTypeSourceObjectSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
2473
+
2474
+ Resolve a source object schema for a mapped type when one exists.
2475
+
2476
+ #### Parameters
2477
+
2478
+ ##### context
2479
+
2480
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2481
+
2482
+ The generation context.
2483
+
2484
+ ##### typeNode
2485
+
2486
+ `MappedTypeNode`
2487
+
2488
+ The mapped type node.
2489
+
2490
+ #### Returns
2491
+
2492
+ `IJsonSchema` \| `undefined`
2493
+
2494
+ The resolved source object schema.
2495
+
2496
+ ***
2497
+
2498
+ ### mapMappedTypePropertySchema() {#mapmappedtypepropertyschema}
2499
+
2500
+ > `static` **mapMappedTypePropertySchema**(`context`, `typeNode`, `sourcePropertyKey`, `mappedTypeParameterName`, `sourceObjectSchema?`): `IJsonSchema` \| `undefined`
2501
+
2502
+ Map a single mapped-type property schema.
2503
+
2504
+ #### Parameters
2505
+
2506
+ ##### context
2507
+
2508
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2509
+
2510
+ The generation context.
2511
+
2512
+ ##### typeNode
2513
+
2514
+ `MappedTypeNode`
2515
+
2516
+ The mapped type node.
2517
+
2518
+ ##### sourcePropertyKey
2519
+
2520
+ `string`
2521
+
2522
+ The original property key from the source object, used for lookup when the mapped type is homomorphic.
2523
+
2524
+ ##### mappedTypeParameterName
2525
+
2526
+ `string`
2527
+
2528
+ The mapped type parameter name.
2529
+
2530
+ ##### sourceObjectSchema?
2531
+
2532
+ `IJsonSchema`
2533
+
2534
+ The optional source object schema.
2535
+
2536
+ #### Returns
2537
+
2538
+ `IJsonSchema` \| `undefined`
2539
+
2540
+ The mapped property schema.
2541
+
2542
+ ***
2543
+
2544
+ ### resolveIndexedPropertySchema() {#resolveindexedpropertyschema}
2545
+
2546
+ > `static` **resolveIndexedPropertySchema**(`context`, `objectTypeNode`, `propertyKey`, `sourceObjectSchema?`): `IJsonSchema` \| `undefined`
2547
+
2548
+ Resolve a concrete property schema for an indexed access object type and key.
2549
+
2550
+ #### Parameters
2551
+
2552
+ ##### context
2553
+
2554
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2555
+
2556
+ The generation context.
2557
+
2558
+ ##### objectTypeNode
2559
+
2560
+ `TypeNode`
2561
+
2562
+ The source object type node.
2563
+
2564
+ ##### propertyKey
2565
+
2566
+ `string`
2567
+
2568
+ The property key to resolve.
2569
+
2570
+ ##### sourceObjectSchema?
2571
+
2572
+ `IJsonSchema`
2573
+
2574
+ The optional pre-resolved source object schema.
2575
+
2576
+ #### Returns
2577
+
2578
+ `IJsonSchema` \| `undefined`
2579
+
2580
+ The resolved property schema.
2581
+
2582
+ ***
2583
+
2584
+ ### isMappedTypeParameterReference() {#ismappedtypeparameterreference}
2585
+
2586
+ > `static` **isMappedTypeParameterReference**(`typeNode`, `mappedTypeParameterName`): `boolean`
2587
+
2588
+ Determine whether a type node is a reference to the mapped type parameter.
2589
+
2590
+ #### Parameters
2591
+
2592
+ ##### typeNode
2593
+
2594
+ `TypeNode`
2595
+
2596
+ The type node.
2597
+
2598
+ ##### mappedTypeParameterName
2599
+
2600
+ `string`
2601
+
2602
+ The mapped type parameter name.
2603
+
2604
+ #### Returns
2605
+
2606
+ `boolean`
2607
+
2608
+ True if the node references the mapped parameter.
2609
+
2610
+ ***
2611
+
2612
+ ### applyMappedTypeOptionality() {#applymappedtypeoptionality}
2613
+
2614
+ > `static` **applyMappedTypeOptionality**(`schema`, `optionalToken`): `void`
2615
+
2616
+ Apply mapped-type optionality to a schema cloned from a source object.
2617
+
2618
+ #### Parameters
2619
+
2620
+ ##### schema
2621
+
2622
+ `IJsonSchema`
2623
+
2624
+ The mapped schema.
2625
+
2626
+ ##### optionalToken
2627
+
2628
+ `QuestionToken` \| `PlusToken` \| `MinusToken` \| `undefined`
2629
+
2630
+ The mapped type optional token.
2631
+
2632
+ #### Returns
2633
+
2634
+ `void`
2635
+
2636
+ ***
2637
+
2638
+ ### applyMappedTypeRequiredKeys() {#applymappedtyperequiredkeys}
2639
+
2640
+ > `static` **applyMappedTypeRequiredKeys**(`schema`, `propertyKeys`, `optionalToken`): `void`
2641
+
2642
+ Apply mapped-type required keys for generated property sets.
2643
+
2644
+ #### Parameters
2645
+
2646
+ ##### schema
2647
+
2648
+ `IJsonSchema`
2649
+
2650
+ The mapped schema.
2651
+
2652
+ ##### propertyKeys
2653
+
2654
+ `string`[]
2655
+
2656
+ The generated property keys.
2657
+
2658
+ ##### optionalToken
2659
+
2660
+ `QuestionToken` \| `PlusToken` \| `MinusToken` \| `undefined`
2661
+
2662
+ The mapped type optional token.
2663
+
2664
+ #### Returns
2665
+
2666
+ `void`
2667
+
2668
+ ***
2669
+
2670
+ ### extractKeyofTypeKeys() {#extractkeyoftypekeys}
2671
+
2672
+ > `static` **extractKeyofTypeKeys**(`context`, `keysOperandNode`): `string`[]
2673
+
2674
+ Extract key names from a keyof operand where possible.
2675
+
2676
+ #### Parameters
2677
+
2678
+ ##### context
2679
+
2680
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2681
+
2682
+ The generation context.
2683
+
2684
+ ##### keysOperandNode
2685
+
2686
+ `TypeNode`
2687
+
2688
+ The operand used with keyof.
2689
+
2690
+ #### Returns
2691
+
2692
+ `string`[]
2693
+
2694
+ The extracted keys.
2695
+
2696
+ ***
2697
+
2698
+ ### isGenericKeyofOperand() {#isgenerickeyofoperand}
2699
+
2700
+ > `static` **isGenericKeyofOperand**(`context`, `keysOperandNode`): `boolean`
2701
+
2702
+ Determine whether a keyof operand is a generic type parameter reference.
2703
+
2704
+ #### Parameters
2705
+
2706
+ ##### context
2707
+
2708
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2709
+
2710
+ The generation context.
2711
+
2712
+ ##### keysOperandNode
2713
+
2714
+ `TypeNode`
2715
+
2716
+ The operand used with keyof.
2717
+
2718
+ #### Returns
2719
+
2720
+ `boolean`
2721
+
2722
+ True if the operand is a generic parameter.
2723
+
2724
+ ***
2725
+
2726
+ ### resolveExternalTypeReferenceSchemaId() {#resolveexternaltypereferenceschemaid}
2727
+
2728
+ > `static` **resolveExternalTypeReferenceSchemaId**(`context`, `typeNode`, `typeName`): `string` \| `undefined`
2729
+
2730
+ Resolve a schema id for an external imported type reference.
2731
+
2732
+ #### Parameters
2733
+
2734
+ ##### context
2735
+
2736
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2737
+
2738
+ The generation context.
2739
+
2740
+ ##### typeNode
2741
+
2742
+ `TypeReferenceNode`
2743
+
2744
+ The type reference node.
2745
+
2746
+ ##### typeName
2747
+
2748
+ `string`
2749
+
2750
+ The referenced type name.
2751
+
2752
+ #### Returns
2753
+
2754
+ `string` \| `undefined`
2755
+
2756
+ The resolved schema id.
2757
+
2758
+ ***
2759
+
2760
+ ### resolveReferenceMappingTarget() {#resolvereferencemappingtarget}
2761
+
2762
+ > `static` **resolveReferenceMappingTarget**(`context`, `packageName`, `typeName`): \{ `schemaId`: `string`; `namespace?`: `string`; \} \| `undefined`
2763
+
2764
+ Resolve a mapped schema target for an imported reference.
2765
+
2766
+ #### Parameters
2767
+
2768
+ ##### context
2769
+
2770
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2771
+
2772
+ The generation context.
2773
+
2774
+ ##### packageName
2775
+
2776
+ `string`
2777
+
2778
+ The referenced package or module specifier.
2779
+
2780
+ ##### typeName
2781
+
2782
+ `string`
2783
+
2784
+ The imported type name.
2785
+
2786
+ #### Returns
2787
+
2788
+ \{ `schemaId`: `string`; `namespace?`: `string`; \} \| `undefined`
2789
+
2790
+ The mapped schema id and optional namespace if one matches.
2791
+
2792
+ ***
2793
+
2794
+ ### findImportedModuleSpecifier() {#findimportedmodulespecifier}
2795
+
2796
+ > `static` **findImportedModuleSpecifier**(`sourceFile`, `typeNode`, `typeName`): `string` \| `undefined`
2797
+
2798
+ Find a module specifier for a referenced type in the active source file imports.
2799
+
2800
+ #### Parameters
2801
+
2802
+ ##### sourceFile
2803
+
2804
+ `SourceFile`
2805
+
2806
+ The active source file.
2807
+
2808
+ ##### typeNode
2809
+
2810
+ `TypeReferenceNode`
2811
+
2812
+ The referenced type node.
2813
+
2814
+ ##### typeName
2815
+
2816
+ `string`
2817
+
2818
+ The referenced type name.
2819
+
2820
+ #### Returns
2821
+
2822
+ `string` \| `undefined`
2823
+
2824
+ The module specifier.
2825
+
2826
+ ***
2827
+
2828
+ ### mapJsonSchemaTagKey() {#mapjsonschematagkey}
2829
+
2830
+ > `static` **mapJsonSchemaTagKey**(`key`): `string`
2831
+
2832
+ Map custom tag key names to JSON schema property names.
2833
+
2834
+ #### Parameters
2835
+
2836
+ ##### key
2837
+
2838
+ `string`
2839
+
2840
+ The raw tag key.
2841
+
2842
+ #### Returns
2843
+
2844
+ `string`
2845
+
2846
+ The schema key.
2847
+
2848
+ ***
2849
+
2850
+ ### extractTupleElementType() {#extracttupleelementtype}
2851
+
2852
+ > `static` **extractTupleElementType**(`element`): `TypeNode` \| `undefined`
2853
+
2854
+ Extract the inner type node from a named or rest tuple element.
2855
+ Named tuple members and rest elements both wrap an inner type node; this unwraps them.
2856
+ Plain type nodes are returned as-is.
2857
+
2858
+ #### Parameters
2859
+
2860
+ ##### element
2861
+
2862
+ `TypeNode`
2863
+
2864
+ The tuple element.
2865
+
2866
+ #### Returns
2867
+
2868
+ `TypeNode` \| `undefined`
2869
+
2870
+ The inner type node.