@twin.org/tools-core 0.0.3-next.15 → 0.0.3-next.17

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