@twin.org/tools-core 0.0.3-next.8 → 0.0.3

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 (138) hide show
  1. package/README.md +2 -2
  2. package/dist/es/index.js +21 -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/models/embeddedSchemaMode.js +17 -0
  11. package/dist/es/models/embeddedSchemaMode.js.map +1 -0
  12. package/dist/es/utils/constants.js +43 -0
  13. package/dist/es/utils/constants.js.map +1 -0
  14. package/dist/es/utils/diagnosticReporter.js +32 -0
  15. package/dist/es/utils/diagnosticReporter.js.map +1 -0
  16. package/dist/es/utils/disallowedTypeGuard.js +151 -0
  17. package/dist/es/utils/disallowedTypeGuard.js.map +1 -0
  18. package/dist/es/utils/enum.js +152 -0
  19. package/dist/es/utils/enum.js.map +1 -0
  20. package/dist/es/utils/fileUtils.js +132 -0
  21. package/dist/es/utils/fileUtils.js.map +1 -0
  22. package/dist/es/utils/importTypeQuerySchemaResolver.js +363 -0
  23. package/dist/es/utils/importTypeQuerySchemaResolver.js.map +1 -0
  24. package/dist/es/utils/indexSignaturePatternResolver.js +94 -0
  25. package/dist/es/utils/indexSignaturePatternResolver.js.map +1 -0
  26. package/dist/es/utils/intersectionSchemaMerger.js +85 -0
  27. package/dist/es/utils/intersectionSchemaMerger.js.map +1 -0
  28. package/dist/es/utils/jsDoc.js +138 -0
  29. package/dist/es/utils/jsDoc.js.map +1 -0
  30. package/dist/es/utils/jsonSchemaBuilder.js +3415 -0
  31. package/dist/es/utils/jsonSchemaBuilder.js.map +1 -0
  32. package/dist/es/utils/mappedTypeSchemaResolver.js +265 -0
  33. package/dist/es/utils/mappedTypeSchemaResolver.js.map +1 -0
  34. package/dist/es/utils/objectTransformer.js +161 -0
  35. package/dist/es/utils/objectTransformer.js.map +1 -0
  36. package/dist/es/utils/regEx.js +128 -0
  37. package/dist/es/utils/regEx.js.map +1 -0
  38. package/dist/es/utils/resolver.js +177 -0
  39. package/dist/es/utils/resolver.js.map +1 -0
  40. package/dist/es/utils/templateLiteralPatternBuilder.js +94 -0
  41. package/dist/es/utils/templateLiteralPatternBuilder.js.map +1 -0
  42. package/dist/es/utils/typeScriptToSchema.js +319 -0
  43. package/dist/es/utils/typeScriptToSchema.js.map +1 -0
  44. package/dist/es/utils/utilityTypeSchemaMapper.js +475 -0
  45. package/dist/es/utils/utilityTypeSchemaMapper.js.map +1 -0
  46. package/dist/types/index.d.ts +21 -11
  47. package/dist/types/models/ITypeScriptToSchemaContext.d.ts +71 -0
  48. package/dist/types/models/ITypeScriptToSchemaDiagnostics.d.ts +31 -0
  49. package/dist/types/models/ITypeScriptToSchemaOptions.d.ts +22 -0
  50. package/dist/types/models/embeddedSchemaMode.d.ts +17 -0
  51. package/dist/types/utils/constants.d.ts +13 -0
  52. package/dist/types/utils/diagnosticReporter.d.ts +17 -0
  53. package/dist/types/utils/disallowedTypeGuard.d.ts +16 -0
  54. package/dist/types/utils/enum.d.ts +42 -0
  55. package/dist/types/utils/fileUtils.d.ts +66 -0
  56. package/dist/types/utils/importTypeQuerySchemaResolver.d.ts +87 -0
  57. package/dist/types/utils/indexSignaturePatternResolver.d.ts +21 -0
  58. package/dist/types/utils/intersectionSchemaMerger.d.ts +16 -0
  59. package/dist/types/utils/jsDoc.d.ts +53 -0
  60. package/dist/types/utils/jsonSchemaBuilder.d.ts +671 -0
  61. package/dist/types/utils/mappedTypeSchemaResolver.d.ts +81 -0
  62. package/dist/types/utils/objectTransformer.d.ts +33 -0
  63. package/dist/types/utils/regEx.d.ts +24 -0
  64. package/dist/types/utils/resolver.d.ts +22 -0
  65. package/dist/types/utils/templateLiteralPatternBuilder.d.ts +12 -0
  66. package/dist/types/utils/typeScriptToSchema.d.ts +92 -0
  67. package/dist/types/utils/utilityTypeSchemaMapper.d.ts +141 -0
  68. package/docs/changelog.md +343 -39
  69. package/docs/examples.md +87 -1
  70. package/docs/reference/classes/Constants.md +29 -0
  71. package/docs/reference/classes/DiagnosticReporter.md +49 -0
  72. package/docs/reference/classes/DisallowedTypeGuard.md +35 -0
  73. package/docs/reference/classes/Enum.md +93 -0
  74. package/docs/reference/classes/FileUtils.md +237 -0
  75. package/docs/reference/classes/ImportTypeQuerySchemaResolver.md +109 -0
  76. package/docs/reference/classes/IndexSignaturePatternResolver.md +69 -0
  77. package/docs/reference/classes/IntersectionSchemaMerger.md +48 -0
  78. package/docs/reference/classes/JsDoc.md +169 -0
  79. package/docs/reference/classes/JsonSchemaBuilder.md +2578 -0
  80. package/docs/reference/classes/MappedTypeSchemaResolver.md +275 -0
  81. package/docs/reference/classes/ObjectTransformer.md +119 -0
  82. package/docs/reference/classes/RegEx.md +99 -0
  83. package/docs/reference/classes/Resolver.md +52 -0
  84. package/docs/reference/classes/TemplateLiteralPatternBuilder.md +35 -0
  85. package/docs/reference/classes/TypeScriptToSchema.md +91 -0
  86. package/docs/reference/classes/UtilityTypeSchemaMapper.md +343 -0
  87. package/docs/reference/index.md +25 -11
  88. package/docs/reference/interfaces/ITypeScriptToSchemaContext.md +125 -0
  89. package/docs/reference/interfaces/ITypeScriptToSchemaDiagnostics.md +55 -0
  90. package/docs/reference/interfaces/ITypeScriptToSchemaOptions.md +44 -0
  91. package/docs/reference/type-aliases/EmbeddedSchemaMode.md +5 -0
  92. package/docs/reference/variables/EmbeddedSchemaMode.md +19 -0
  93. package/locales/en.json +32 -1
  94. package/package.json +8 -7
  95. package/dist/es/models/IJsonSchema.js +0 -2
  96. package/dist/es/models/IJsonSchema.js.map +0 -1
  97. package/dist/es/models/IOpenApi.js +0 -2
  98. package/dist/es/models/IOpenApi.js.map +0 -1
  99. package/dist/es/models/IOpenApiExample.js +0 -4
  100. package/dist/es/models/IOpenApiExample.js.map +0 -1
  101. package/dist/es/models/IOpenApiHeader.js +0 -4
  102. package/dist/es/models/IOpenApiHeader.js.map +0 -1
  103. package/dist/es/models/IOpenApiPathMethod.js +0 -2
  104. package/dist/es/models/IOpenApiPathMethod.js.map +0 -1
  105. package/dist/es/models/IOpenApiResponse.js +0 -2
  106. package/dist/es/models/IOpenApiResponse.js.map +0 -1
  107. package/dist/es/models/IOpenApiSecurityScheme.js +0 -4
  108. package/dist/es/models/IOpenApiSecurityScheme.js.map +0 -1
  109. package/dist/es/models/IPackageJson.js +0 -4
  110. package/dist/es/models/IPackageJson.js.map +0 -1
  111. package/dist/es/models/jsonTypeName.js +0 -2
  112. package/dist/es/models/jsonTypeName.js.map +0 -1
  113. package/dist/es/utils/jsonSchemaHelper.js +0 -258
  114. package/dist/es/utils/jsonSchemaHelper.js.map +0 -1
  115. package/dist/es/utils/openApiHelper.js +0 -12
  116. package/dist/es/utils/openApiHelper.js.map +0 -1
  117. package/dist/types/models/IJsonSchema.d.ts +0 -5
  118. package/dist/types/models/IOpenApi.d.ts +0 -54
  119. package/dist/types/models/IOpenApiExample.d.ts +0 -13
  120. package/dist/types/models/IOpenApiHeader.d.ts +0 -19
  121. package/dist/types/models/IOpenApiPathMethod.d.ts +0 -65
  122. package/dist/types/models/IOpenApiResponse.d.ts +0 -32
  123. package/dist/types/models/IOpenApiSecurityScheme.d.ts +0 -25
  124. package/dist/types/models/IPackageJson.d.ts +0 -15
  125. package/dist/types/models/jsonTypeName.d.ts +0 -5
  126. package/dist/types/utils/jsonSchemaHelper.d.ts +0 -78
  127. package/dist/types/utils/openApiHelper.d.ts +0 -9
  128. package/docs/reference/classes/JsonSchemaHelper.md +0 -233
  129. package/docs/reference/classes/OpenApiHelper.md +0 -21
  130. package/docs/reference/interfaces/IOpenApi.md +0 -103
  131. package/docs/reference/interfaces/IOpenApiExample.md +0 -19
  132. package/docs/reference/interfaces/IOpenApiHeader.md +0 -31
  133. package/docs/reference/interfaces/IOpenApiPathMethod.md +0 -119
  134. package/docs/reference/interfaces/IOpenApiResponse.md +0 -35
  135. package/docs/reference/interfaces/IOpenApiSecurityScheme.md +0 -43
  136. package/docs/reference/interfaces/IPackageJson.md +0 -23
  137. package/docs/reference/type-aliases/IJsonSchema.md +0 -5
  138. package/docs/reference/type-aliases/JsonTypeName.md +0 -5
@@ -0,0 +1,2578 @@
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
+ #### Throws
1488
+
1489
+ GeneralError when an extended type cannot be resolved to a schema.
1490
+
1491
+ ***
1492
+
1493
+ ### resolveRefinementUtilityBaseRef() {#resolverefinementutilitybaseref}
1494
+
1495
+ > `static` **resolveRefinementUtilityBaseRef**(`context`, `declaration`, `extendedType`): `IJsonSchema` \| `undefined`
1496
+
1497
+ Resolve a direct base reference for refinement Omit patterns in interface extends clauses.
1498
+
1499
+ #### Parameters
1500
+
1501
+ ##### context
1502
+
1503
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1504
+
1505
+ The generation context.
1506
+
1507
+ ##### declaration
1508
+
1509
+ `InterfaceDeclaration`
1510
+
1511
+ The interface declaration being mapped.
1512
+
1513
+ ##### extendedType
1514
+
1515
+ `ExpressionWithTypeArguments`
1516
+
1517
+ The heritage type being processed.
1518
+
1519
+ #### Returns
1520
+
1521
+ `IJsonSchema` \| `undefined`
1522
+
1523
+ A direct base reference when a refinement pattern is detected.
1524
+
1525
+ ***
1526
+
1527
+ ### isNullOrUndefinedTypeNode() {#isnullorundefinedtypenode}
1528
+
1529
+ > `static` **isNullOrUndefinedTypeNode**(`typeNode`): `boolean`
1530
+
1531
+ Determine whether a type node represents null or undefined.
1532
+
1533
+ #### Parameters
1534
+
1535
+ ##### typeNode
1536
+
1537
+ `TypeNode`
1538
+
1539
+ The type node.
1540
+
1541
+ #### Returns
1542
+
1543
+ `boolean`
1544
+
1545
+ True if the node is null or undefined.
1546
+
1547
+ ***
1548
+
1549
+ ### extractRecordLiteralKeys() {#extractrecordliteralkeys}
1550
+
1551
+ > `static` **extractRecordLiteralKeys**(`keyTypeNode`): `string`[]
1552
+
1553
+ Extract literal keys from a Record key type argument.
1554
+
1555
+ #### Parameters
1556
+
1557
+ ##### keyTypeNode
1558
+
1559
+ `TypeNode`
1560
+
1561
+ The key type argument node.
1562
+
1563
+ #### Returns
1564
+
1565
+ `string`[]
1566
+
1567
+ The extracted literal keys.
1568
+
1569
+ ***
1570
+
1571
+ ### mapJsonLdObjectDefaultSchemaByKey() {#mapjsonldobjectdefaultschemabykey}
1572
+
1573
+ > `static` **mapJsonLdObjectDefaultSchemaByKey**(`baseSchema`, `keyToAdd`): `IJsonSchema`
1574
+
1575
+ Resolve a default schema for JsonLdObject utility key additions when the type argument is omitted.
1576
+
1577
+ #### Parameters
1578
+
1579
+ ##### baseSchema
1580
+
1581
+ `IJsonSchema`
1582
+
1583
+ The base object schema.
1584
+
1585
+ ##### keyToAdd
1586
+
1587
+ `"type"` \| `"id"` \| `"@id"` \| `"@type"` \| `"@context"`
1588
+
1589
+ The key being added by the utility.
1590
+
1591
+ #### Returns
1592
+
1593
+ `IJsonSchema`
1594
+
1595
+ The resolved schema.
1596
+
1597
+ ***
1598
+
1599
+ ### mapJsonLdObjectWithIdDefaultIdSchema() {#mapjsonldobjectwithiddefaultidschema}
1600
+
1601
+ > `static` **mapJsonLdObjectWithIdDefaultIdSchema**(`baseSchema`): `IJsonSchema`
1602
+
1603
+ Resolve default id schema for JsonLdObjectWithId when Id type argument is omitted.
1604
+
1605
+ #### Parameters
1606
+
1607
+ ##### baseSchema
1608
+
1609
+ `IJsonSchema`
1610
+
1611
+ The base object schema.
1612
+
1613
+ #### Returns
1614
+
1615
+ `IJsonSchema`
1616
+
1617
+ The resolved id schema.
1618
+
1619
+ ***
1620
+
1621
+ ### mapJsonLdObjectWithTypeDefaultTypeSchema() {#mapjsonldobjectwithtypedefaulttypeschema}
1622
+
1623
+ > `static` **mapJsonLdObjectWithTypeDefaultTypeSchema**(`baseSchema`): `IJsonSchema`
1624
+
1625
+ Resolve default type schema for JsonLdObjectWithType when Type argument is omitted.
1626
+
1627
+ #### Parameters
1628
+
1629
+ ##### baseSchema
1630
+
1631
+ `IJsonSchema`
1632
+
1633
+ The base object schema.
1634
+
1635
+ #### Returns
1636
+
1637
+ `IJsonSchema`
1638
+
1639
+ The resolved type schema.
1640
+
1641
+ ***
1642
+
1643
+ ### mapJsonLdObjectWithContextDefaultContextSchema() {#mapjsonldobjectwithcontextdefaultcontextschema}
1644
+
1645
+ > `static` **mapJsonLdObjectWithContextDefaultContextSchema**(`baseSchema`): `IJsonSchema`
1646
+
1647
+ Resolve default context schema for JsonLdObjectWithContext when Context argument is omitted.
1648
+
1649
+ #### Parameters
1650
+
1651
+ ##### baseSchema
1652
+
1653
+ `IJsonSchema`
1654
+
1655
+ The base object schema.
1656
+
1657
+ #### Returns
1658
+
1659
+ `IJsonSchema`
1660
+
1661
+ The resolved context schema.
1662
+
1663
+ ***
1664
+
1665
+ ### mapJsonLdObjectDefaultEitherSchema() {#mapjsonldobjectdefaulteitherschema}
1666
+
1667
+ > `static` **mapJsonLdObjectDefaultEitherSchema**(`baseSchema`, `firstKey`, `secondKey`, `fallbackSchema`): `IJsonSchema`
1668
+
1669
+ Resolve default schema from either of two source keys, with fallback when both are absent.
1670
+
1671
+ #### Parameters
1672
+
1673
+ ##### baseSchema
1674
+
1675
+ `IJsonSchema`
1676
+
1677
+ The base object schema.
1678
+
1679
+ ##### firstKey
1680
+
1681
+ `string`
1682
+
1683
+ The primary key to resolve.
1684
+
1685
+ ##### secondKey
1686
+
1687
+ `string`
1688
+
1689
+ The secondary key to resolve.
1690
+
1691
+ ##### fallbackSchema
1692
+
1693
+ `IJsonSchema`
1694
+
1695
+ The fallback schema.
1696
+
1697
+ #### Returns
1698
+
1699
+ `IJsonSchema`
1700
+
1701
+ The resolved schema.
1702
+
1703
+ ***
1704
+
1705
+ ### annotateUtilityInlineSchema() {#annotateutilityinlineschema}
1706
+
1707
+ > `static` **annotateUtilityInlineSchema**(`schema`, `baseTypeDescription`): `IJsonSchema`
1708
+
1709
+ Add a comment to schemas inlined for utility type transformations.
1710
+
1711
+ #### Parameters
1712
+
1713
+ ##### schema
1714
+
1715
+ `IJsonSchema`
1716
+
1717
+ The schema to annotate.
1718
+
1719
+ ##### baseTypeDescription
1720
+
1721
+ `string`
1722
+
1723
+ The utility base type description.
1724
+
1725
+ #### Returns
1726
+
1727
+ `IJsonSchema`
1728
+
1729
+ The annotated schema.
1730
+
1731
+ ***
1732
+
1733
+ ### resolveUtilityBaseObjectSchema() {#resolveutilitybaseobjectschema}
1734
+
1735
+ > `static` **resolveUtilityBaseObjectSchema**(`context`, `baseTypeNode`): `IJsonSchema` \| `undefined`
1736
+
1737
+ Resolve a utility base type node to an object schema.
1738
+
1739
+ #### Parameters
1740
+
1741
+ ##### context
1742
+
1743
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1744
+
1745
+ The generation context.
1746
+
1747
+ ##### baseTypeNode
1748
+
1749
+ `TypeNode`
1750
+
1751
+ The utility base type node.
1752
+
1753
+ #### Returns
1754
+
1755
+ `IJsonSchema` \| `undefined`
1756
+
1757
+ The resolved object schema.
1758
+
1759
+ #### Throws
1760
+
1761
+ GeneralError when a named type reference cannot be resolved to a schema.
1762
+
1763
+ ***
1764
+
1765
+ ### resolveMappedUtilityBaseObjectSchema() {#resolvemappedutilitybaseobjectschema}
1766
+
1767
+ > `static` **resolveMappedUtilityBaseObjectSchema**(`context`, `mappedSchema`): `IJsonSchema` \| `undefined`
1768
+
1769
+ Resolve a mapped utility schema to an object schema when possible.
1770
+
1771
+ #### Parameters
1772
+
1773
+ ##### context
1774
+
1775
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1776
+
1777
+ The generation context.
1778
+
1779
+ ##### mappedSchema
1780
+
1781
+ `IJsonSchema`
1782
+
1783
+ The mapped schema.
1784
+
1785
+ #### Returns
1786
+
1787
+ `IJsonSchema` \| `undefined`
1788
+
1789
+ The resolved object schema.
1790
+
1791
+ ***
1792
+
1793
+ ### expandAllOfReferences() {#expandallofreferences}
1794
+
1795
+ > `static` **expandAllOfReferences**(`context`, `schema`, `currentSchemaTitle?`): `IJsonSchema`
1796
+
1797
+ Expand allOf references in a schema by inlining referenced schemas.
1798
+ This handles inheritance cases where a type extends another type.
1799
+ When applying utility operations (Omit, Pick) to types with allOf inheritance,
1800
+ the referenced schemas must be expanded so properties are available for omit/pick.
1801
+
1802
+ #### Parameters
1803
+
1804
+ ##### context
1805
+
1806
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1807
+
1808
+ The generation context.
1809
+
1810
+ ##### schema
1811
+
1812
+ `IJsonSchema`
1813
+
1814
+ The schema potentially containing allOf with references.
1815
+
1816
+ ##### currentSchemaTitle?
1817
+
1818
+ `string`
1819
+
1820
+ The title of the current schema being processed, used for $comment annotations.
1821
+
1822
+ #### Returns
1823
+
1824
+ `IJsonSchema`
1825
+
1826
+ The schema with expanded references merged into properties.
1827
+
1828
+ ***
1829
+
1830
+ ### tryLoadExternalSchemaByTitle() {#tryloadexternalschemabytitle}
1831
+
1832
+ > `static` **tryLoadExternalSchemaByTitle**(`context`, `schemaTitle`): `IJsonSchema` \| `undefined`
1833
+
1834
+ Attempt to load an external schema by title from imported module declarations.
1835
+
1836
+ #### Parameters
1837
+
1838
+ ##### context
1839
+
1840
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1841
+
1842
+ The generation context.
1843
+
1844
+ ##### schemaTitle
1845
+
1846
+ `string`
1847
+
1848
+ The schema title.
1849
+
1850
+ #### Returns
1851
+
1852
+ `IJsonSchema` \| `undefined`
1853
+
1854
+ The loaded schema.
1855
+
1856
+ ***
1857
+
1858
+ ### resolveObjectTypeSchemaForUtility() {#resolveobjecttypeschemaforutility}
1859
+
1860
+ > `static` **resolveObjectTypeSchemaForUtility**(`context`, `typeName`): `IJsonSchema` \| `undefined`
1861
+
1862
+ Resolve an object schema for utility type application.
1863
+
1864
+ #### Parameters
1865
+
1866
+ ##### context
1867
+
1868
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1869
+
1870
+ The generation context.
1871
+
1872
+ ##### typeName
1873
+
1874
+ `string`
1875
+
1876
+ The referenced type name.
1877
+
1878
+ #### Returns
1879
+
1880
+ `IJsonSchema` \| `undefined`
1881
+
1882
+ The resolved object schema.
1883
+
1884
+ ***
1885
+
1886
+ ### findImportedTypeReference() {#findimportedtypereference}
1887
+
1888
+ > `static` **findImportedTypeReference**(`context`, `typeName`): \{ `moduleSpecifier`: `string`; `candidateTypeName`: `string`; \} \| `undefined`
1889
+
1890
+ Find an imported type reference from the active source file by local or exported symbol name.
1891
+
1892
+ #### Parameters
1893
+
1894
+ ##### context
1895
+
1896
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1897
+
1898
+ The generation context.
1899
+
1900
+ ##### typeName
1901
+
1902
+ `string`
1903
+
1904
+ The local or exported type name to find.
1905
+
1906
+ #### Returns
1907
+
1908
+ \{ `moduleSpecifier`: `string`; `candidateTypeName`: `string`; \} \| `undefined`
1909
+
1910
+ The module specifier and exported candidate type name when found.
1911
+
1912
+ ***
1913
+
1914
+ ### resolveImportedObjectTypeSchemaForUtility() {#resolveimportedobjecttypeschemaforutility}
1915
+
1916
+ > `static` **resolveImportedObjectTypeSchemaForUtility**(`context`, `moduleSpecifier`, `candidateTypeName`, `title`): `IJsonSchema` \| `undefined`
1917
+
1918
+ Resolve an imported object schema for utility type application.
1919
+
1920
+ #### Parameters
1921
+
1922
+ ##### context
1923
+
1924
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1925
+
1926
+ The generation context.
1927
+
1928
+ ##### moduleSpecifier
1929
+
1930
+ `string`
1931
+
1932
+ The module where the type is imported from.
1933
+
1934
+ ##### candidateTypeName
1935
+
1936
+ `string`
1937
+
1938
+ The exported candidate type name.
1939
+
1940
+ ##### title
1941
+
1942
+ `string`
1943
+
1944
+ The stripped title of the requested type.
1945
+
1946
+ #### Returns
1947
+
1948
+ `IJsonSchema` \| `undefined`
1949
+
1950
+ The resolved object schema.
1951
+
1952
+ ***
1953
+
1954
+ ### mapObjectTypeFromLocalDeclaration() {#mapobjecttypefromlocaldeclaration}
1955
+
1956
+ > `static` **mapObjectTypeFromLocalDeclaration**(`context`, `typeName`): `IJsonSchema` \| `undefined`
1957
+
1958
+ Map a local interface or type alias declaration to an object schema.
1959
+
1960
+ #### Parameters
1961
+
1962
+ ##### context
1963
+
1964
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1965
+
1966
+ The generation context.
1967
+
1968
+ ##### typeName
1969
+
1970
+ `string`
1971
+
1972
+ The referenced type name.
1973
+
1974
+ #### Returns
1975
+
1976
+ `IJsonSchema` \| `undefined`
1977
+
1978
+ The mapped schema.
1979
+
1980
+ ***
1981
+
1982
+ ### extractUtilityTypeKeys() {#extractutilitytypekeys}
1983
+
1984
+ > `static` **extractUtilityTypeKeys**(`context`, `keysTypeNode`): `string`[]
1985
+
1986
+ Extract string literal keys from a utility type key argument (e.g. Pick or Omit).
1987
+
1988
+ #### Parameters
1989
+
1990
+ ##### context
1991
+
1992
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
1993
+
1994
+ The generation context.
1995
+
1996
+ ##### keysTypeNode
1997
+
1998
+ `TypeNode` \| `undefined`
1999
+
2000
+ The keys type node.
2001
+
2002
+ #### Returns
2003
+
2004
+ `string`[]
2005
+
2006
+ The extracted keys.
2007
+
2008
+ ***
2009
+
2010
+ ### extractIndexedAccessKeys() {#extractindexedaccesskeys}
2011
+
2012
+ > `static` **extractIndexedAccessKeys**(`context`, `indexTypeNode`): `string`[]
2013
+
2014
+ Extract property keys from an indexed access index type.
2015
+
2016
+ #### Parameters
2017
+
2018
+ ##### context
2019
+
2020
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2021
+
2022
+ The generation context.
2023
+
2024
+ ##### indexTypeNode
2025
+
2026
+ `TypeNode`
2027
+
2028
+ The index type node.
2029
+
2030
+ #### Returns
2031
+
2032
+ `string`[]
2033
+
2034
+ The extracted keys.
2035
+
2036
+ ***
2037
+
2038
+ ### extractMappedTypeKeys() {#extractmappedtypekeys}
2039
+
2040
+ > `static` **extractMappedTypeKeys**(`context`, `constraintTypeNode`): `string`[]
2041
+
2042
+ Extract keys for a mapped type constraint.
2043
+
2044
+ #### Parameters
2045
+
2046
+ ##### context
2047
+
2048
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2049
+
2050
+ The generation context.
2051
+
2052
+ ##### constraintTypeNode
2053
+
2054
+ `TypeNode` \| `undefined`
2055
+
2056
+ The mapped type constraint.
2057
+
2058
+ #### Returns
2059
+
2060
+ `string`[]
2061
+
2062
+ The extracted keys.
2063
+
2064
+ ***
2065
+
2066
+ ### resolveReferencedTypeNodeFromLocalDeclaration() {#resolvereferencedtypenodefromlocaldeclaration}
2067
+
2068
+ > `static` **resolveReferencedTypeNodeFromLocalDeclaration**(`context`, `typeNode`): `TypeNode` \| `undefined`
2069
+
2070
+ Resolve a referenced type node from a local type alias declaration.
2071
+
2072
+ #### Parameters
2073
+
2074
+ ##### context
2075
+
2076
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2077
+
2078
+ The generation context.
2079
+
2080
+ ##### typeNode
2081
+
2082
+ `TypeReferenceNode`
2083
+
2084
+ The type reference node.
2085
+
2086
+ #### Returns
2087
+
2088
+ `TypeNode` \| `undefined`
2089
+
2090
+ The referenced type node, if found locally.
2091
+
2092
+ ***
2093
+
2094
+ ### withTypeParameterBindings() {#withtypeparameterbindings}
2095
+
2096
+ > `static` **withTypeParameterBindings**(`context`, `typeParameters`, `typeArguments?`): [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2097
+
2098
+ Create a nested mapping context with generic parameters bound.
2099
+
2100
+ #### Parameters
2101
+
2102
+ ##### context
2103
+
2104
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2105
+
2106
+ The current generation context.
2107
+
2108
+ ##### typeParameters
2109
+
2110
+ `NodeArray`\<`TypeParameterDeclaration`\> \| `undefined`
2111
+
2112
+ The generic type parameters for the declaration.
2113
+
2114
+ ##### typeArguments?
2115
+
2116
+ `NodeArray`\<`TypeNode`\>
2117
+
2118
+ Explicit type arguments, when provided.
2119
+
2120
+ #### Returns
2121
+
2122
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2123
+
2124
+ The scoped mapping context.
2125
+
2126
+ ***
2127
+
2128
+ ### getTypeParameterBinding() {#gettypeparameterbinding}
2129
+
2130
+ > `static` **getTypeParameterBinding**(`context`, `typeName`): `TypeNode` \| `null` \| `undefined`
2131
+
2132
+ Get a bound generic type parameter for the current mapping scope.
2133
+
2134
+ #### Parameters
2135
+
2136
+ ##### context
2137
+
2138
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2139
+
2140
+ The current generation context.
2141
+
2142
+ ##### typeName
2143
+
2144
+ `string`
2145
+
2146
+ The type name to resolve.
2147
+
2148
+ #### Returns
2149
+
2150
+ `TypeNode` \| `null` \| `undefined`
2151
+
2152
+ The bound type node, null for unresolved generic parameters, or undefined when not generic.
2153
+
2154
+ ***
2155
+
2156
+ ### isHomomorphicMappedType() {#ishomomorphicmappedtype}
2157
+
2158
+ > `static` **isHomomorphicMappedType**(`typeNode`): `boolean`
2159
+
2160
+ Determine whether a mapped type is a homomorphic source-preserving form.
2161
+
2162
+ #### Parameters
2163
+
2164
+ ##### typeNode
2165
+
2166
+ `MappedTypeNode`
2167
+
2168
+ The mapped type node.
2169
+
2170
+ #### Returns
2171
+
2172
+ `boolean`
2173
+
2174
+ True if the mapped type mirrors an existing object shape.
2175
+
2176
+ ***
2177
+
2178
+ ### resolveMappedTypeSourceObjectSchema() {#resolvemappedtypesourceobjectschema}
2179
+
2180
+ > `static` **resolveMappedTypeSourceObjectSchema**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
2181
+
2182
+ Resolve a source object schema for a mapped type when one exists.
2183
+
2184
+ #### Parameters
2185
+
2186
+ ##### context
2187
+
2188
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2189
+
2190
+ The generation context.
2191
+
2192
+ ##### typeNode
2193
+
2194
+ `MappedTypeNode`
2195
+
2196
+ The mapped type node.
2197
+
2198
+ #### Returns
2199
+
2200
+ `IJsonSchema` \| `undefined`
2201
+
2202
+ The resolved source object schema.
2203
+
2204
+ ***
2205
+
2206
+ ### mapMappedTypePropertySchema() {#mapmappedtypepropertyschema}
2207
+
2208
+ > `static` **mapMappedTypePropertySchema**(`context`, `typeNode`, `sourcePropertyKey`, `mappedTypeParameterName`, `sourceObjectSchema?`): `IJsonSchema` \| `undefined`
2209
+
2210
+ Map a single mapped-type property schema.
2211
+
2212
+ #### Parameters
2213
+
2214
+ ##### context
2215
+
2216
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2217
+
2218
+ The generation context.
2219
+
2220
+ ##### typeNode
2221
+
2222
+ `MappedTypeNode`
2223
+
2224
+ The mapped type node.
2225
+
2226
+ ##### sourcePropertyKey
2227
+
2228
+ `string`
2229
+
2230
+ The original property key from the source object, used for lookup when the mapped type is homomorphic.
2231
+
2232
+ ##### mappedTypeParameterName
2233
+
2234
+ `string`
2235
+
2236
+ The mapped type parameter name.
2237
+
2238
+ ##### sourceObjectSchema?
2239
+
2240
+ `IJsonSchema`
2241
+
2242
+ The optional source object schema.
2243
+
2244
+ #### Returns
2245
+
2246
+ `IJsonSchema` \| `undefined`
2247
+
2248
+ The mapped property schema.
2249
+
2250
+ ***
2251
+
2252
+ ### resolveIndexedPropertySchema() {#resolveindexedpropertyschema}
2253
+
2254
+ > `static` **resolveIndexedPropertySchema**(`context`, `objectTypeNode`, `propertyKey`, `sourceObjectSchema?`): `IJsonSchema` \| `undefined`
2255
+
2256
+ Resolve a concrete property schema for an indexed access object type and key.
2257
+
2258
+ #### Parameters
2259
+
2260
+ ##### context
2261
+
2262
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2263
+
2264
+ The generation context.
2265
+
2266
+ ##### objectTypeNode
2267
+
2268
+ `TypeNode`
2269
+
2270
+ The source object type node.
2271
+
2272
+ ##### propertyKey
2273
+
2274
+ `string`
2275
+
2276
+ The property key to resolve.
2277
+
2278
+ ##### sourceObjectSchema?
2279
+
2280
+ `IJsonSchema`
2281
+
2282
+ The optional pre-resolved source object schema.
2283
+
2284
+ #### Returns
2285
+
2286
+ `IJsonSchema` \| `undefined`
2287
+
2288
+ The resolved property schema.
2289
+
2290
+ ***
2291
+
2292
+ ### isMappedTypeParameterReference() {#ismappedtypeparameterreference}
2293
+
2294
+ > `static` **isMappedTypeParameterReference**(`typeNode`, `mappedTypeParameterName`): `boolean`
2295
+
2296
+ Determine whether a type node is a reference to the mapped type parameter.
2297
+
2298
+ #### Parameters
2299
+
2300
+ ##### typeNode
2301
+
2302
+ `TypeNode`
2303
+
2304
+ The type node.
2305
+
2306
+ ##### mappedTypeParameterName
2307
+
2308
+ `string`
2309
+
2310
+ The mapped type parameter name.
2311
+
2312
+ #### Returns
2313
+
2314
+ `boolean`
2315
+
2316
+ True if the node references the mapped parameter.
2317
+
2318
+ ***
2319
+
2320
+ ### applyMappedTypeOptionality() {#applymappedtypeoptionality}
2321
+
2322
+ > `static` **applyMappedTypeOptionality**(`schema`, `optionalToken`): `void`
2323
+
2324
+ Apply mapped-type optionality to a schema cloned from a source object.
2325
+
2326
+ #### Parameters
2327
+
2328
+ ##### schema
2329
+
2330
+ `IJsonSchema`
2331
+
2332
+ The mapped schema.
2333
+
2334
+ ##### optionalToken
2335
+
2336
+ `QuestionToken` \| `PlusToken` \| `MinusToken` \| `undefined`
2337
+
2338
+ The mapped type optional token.
2339
+
2340
+ #### Returns
2341
+
2342
+ `void`
2343
+
2344
+ ***
2345
+
2346
+ ### applyMappedTypeRequiredKeys() {#applymappedtyperequiredkeys}
2347
+
2348
+ > `static` **applyMappedTypeRequiredKeys**(`schema`, `propertyKeys`, `optionalToken`): `void`
2349
+
2350
+ Apply mapped-type required keys for generated property sets.
2351
+
2352
+ #### Parameters
2353
+
2354
+ ##### schema
2355
+
2356
+ `IJsonSchema`
2357
+
2358
+ The mapped schema.
2359
+
2360
+ ##### propertyKeys
2361
+
2362
+ `string`[]
2363
+
2364
+ The generated property keys.
2365
+
2366
+ ##### optionalToken
2367
+
2368
+ `QuestionToken` \| `PlusToken` \| `MinusToken` \| `undefined`
2369
+
2370
+ The mapped type optional token.
2371
+
2372
+ #### Returns
2373
+
2374
+ `void`
2375
+
2376
+ ***
2377
+
2378
+ ### extractKeyofTypeKeys() {#extractkeyoftypekeys}
2379
+
2380
+ > `static` **extractKeyofTypeKeys**(`context`, `keysOperandNode`): `string`[]
2381
+
2382
+ Extract key names from a keyof operand where possible.
2383
+
2384
+ #### Parameters
2385
+
2386
+ ##### context
2387
+
2388
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2389
+
2390
+ The generation context.
2391
+
2392
+ ##### keysOperandNode
2393
+
2394
+ `TypeNode`
2395
+
2396
+ The operand used with keyof.
2397
+
2398
+ #### Returns
2399
+
2400
+ `string`[]
2401
+
2402
+ The extracted keys.
2403
+
2404
+ ***
2405
+
2406
+ ### isGenericKeyofOperand() {#isgenerickeyofoperand}
2407
+
2408
+ > `static` **isGenericKeyofOperand**(`context`, `keysOperandNode`): `boolean`
2409
+
2410
+ Determine whether a keyof operand is a generic type parameter reference.
2411
+
2412
+ #### Parameters
2413
+
2414
+ ##### context
2415
+
2416
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2417
+
2418
+ The generation context.
2419
+
2420
+ ##### keysOperandNode
2421
+
2422
+ `TypeNode`
2423
+
2424
+ The operand used with keyof.
2425
+
2426
+ #### Returns
2427
+
2428
+ `boolean`
2429
+
2430
+ True if the operand is a generic parameter.
2431
+
2432
+ ***
2433
+
2434
+ ### resolveExternalTypeReferenceSchemaId() {#resolveexternaltypereferenceschemaid}
2435
+
2436
+ > `static` **resolveExternalTypeReferenceSchemaId**(`context`, `typeNode`, `typeName`): `string` \| `undefined`
2437
+
2438
+ Resolve a schema id for an external imported type reference.
2439
+
2440
+ #### Parameters
2441
+
2442
+ ##### context
2443
+
2444
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2445
+
2446
+ The generation context.
2447
+
2448
+ ##### typeNode
2449
+
2450
+ `TypeReferenceNode`
2451
+
2452
+ The type reference node.
2453
+
2454
+ ##### typeName
2455
+
2456
+ `string`
2457
+
2458
+ The referenced type name.
2459
+
2460
+ #### Returns
2461
+
2462
+ `string` \| `undefined`
2463
+
2464
+ The resolved schema id.
2465
+
2466
+ ***
2467
+
2468
+ ### resolveReferenceMappingTarget() {#resolvereferencemappingtarget}
2469
+
2470
+ > `static` **resolveReferenceMappingTarget**(`context`, `packageName`, `typeName`): \{ `schemaId`: `string`; `namespace?`: `string`; \} \| `undefined`
2471
+
2472
+ Resolve a mapped schema target for an imported reference.
2473
+
2474
+ #### Parameters
2475
+
2476
+ ##### context
2477
+
2478
+ [`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
2479
+
2480
+ The generation context.
2481
+
2482
+ ##### packageName
2483
+
2484
+ `string`
2485
+
2486
+ The referenced package or module specifier.
2487
+
2488
+ ##### typeName
2489
+
2490
+ `string`
2491
+
2492
+ The imported type name.
2493
+
2494
+ #### Returns
2495
+
2496
+ \{ `schemaId`: `string`; `namespace?`: `string`; \} \| `undefined`
2497
+
2498
+ The mapped schema id and optional namespace if one matches.
2499
+
2500
+ ***
2501
+
2502
+ ### findImportedModuleSpecifier() {#findimportedmodulespecifier}
2503
+
2504
+ > `static` **findImportedModuleSpecifier**(`sourceFile`, `typeNode`, `typeName`): `string` \| `undefined`
2505
+
2506
+ Find a module specifier for a referenced type in the active source file imports.
2507
+
2508
+ #### Parameters
2509
+
2510
+ ##### sourceFile
2511
+
2512
+ `SourceFile`
2513
+
2514
+ The active source file.
2515
+
2516
+ ##### typeNode
2517
+
2518
+ `TypeReferenceNode`
2519
+
2520
+ The referenced type node.
2521
+
2522
+ ##### typeName
2523
+
2524
+ `string`
2525
+
2526
+ The referenced type name.
2527
+
2528
+ #### Returns
2529
+
2530
+ `string` \| `undefined`
2531
+
2532
+ The module specifier.
2533
+
2534
+ ***
2535
+
2536
+ ### mapJsonSchemaTagKey() {#mapjsonschematagkey}
2537
+
2538
+ > `static` **mapJsonSchemaTagKey**(`key`): `string`
2539
+
2540
+ Map custom tag key names to JSON schema property names.
2541
+
2542
+ #### Parameters
2543
+
2544
+ ##### key
2545
+
2546
+ `string`
2547
+
2548
+ The raw tag key.
2549
+
2550
+ #### Returns
2551
+
2552
+ `string`
2553
+
2554
+ The schema key.
2555
+
2556
+ ***
2557
+
2558
+ ### extractTupleElementType() {#extracttupleelementtype}
2559
+
2560
+ > `static` **extractTupleElementType**(`element`): `TypeNode` \| `undefined`
2561
+
2562
+ Extract the inner type node from a named or rest tuple element.
2563
+ Named tuple members and rest elements both wrap an inner type node; this unwraps them.
2564
+ Plain type nodes are returned as-is.
2565
+
2566
+ #### Parameters
2567
+
2568
+ ##### element
2569
+
2570
+ `TypeNode`
2571
+
2572
+ The tuple element.
2573
+
2574
+ #### Returns
2575
+
2576
+ `TypeNode` \| `undefined`
2577
+
2578
+ The inner type node.