@openpkg-ts/spec 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,13 +8,113 @@ type SpecTag = {
8
8
  version?: string;
9
9
  reason?: string;
10
10
  };
11
+ type SpecTypeAliasKind = "alias" | "conditional" | "mapped" | "template-literal" | "infer";
12
+ type SpecConditionalType = {
13
+ checkType: string;
14
+ extendsType: string;
15
+ trueType: string;
16
+ falseType: string;
17
+ };
18
+ type SpecMappedType = {
19
+ typeParameter: string;
20
+ nameType?: string;
21
+ valueType?: string;
22
+ readonly?: "+" | "-" | true;
23
+ optional?: "+" | "-" | true;
24
+ };
25
+ type SpecDecorator = {
26
+ name: string;
27
+ arguments?: unknown[];
28
+ argumentsText?: string[];
29
+ };
30
+ type SpecThrows = {
31
+ type?: string;
32
+ description?: string;
33
+ };
11
34
  type SpecSource = {
12
35
  file?: string;
13
36
  line?: number;
14
37
  url?: string;
15
38
  };
16
- type SpecSchema = unknown;
17
- type SpecExample = Record<string, unknown>;
39
+ type SpecSchemaPrimitive = {
40
+ type: "string";
41
+ format?: string;
42
+ enum?: string[];
43
+ } | {
44
+ type: "number";
45
+ enum?: number[];
46
+ } | {
47
+ type: "boolean";
48
+ enum?: boolean[];
49
+ } | {
50
+ type: "integer";
51
+ format?: string;
52
+ } | {
53
+ type: "null";
54
+ } | {
55
+ type: "undefined";
56
+ } | {
57
+ type: "any";
58
+ } | {
59
+ type: "unknown";
60
+ } | {
61
+ type: "never";
62
+ } | {
63
+ type: "void";
64
+ };
65
+ type SpecSchemaComposite = {
66
+ type: "array";
67
+ items?: SpecSchema;
68
+ } | {
69
+ type: "tuple";
70
+ items: SpecSchema[];
71
+ minItems?: number;
72
+ maxItems?: number;
73
+ } | {
74
+ type: "object";
75
+ properties?: Record<string, SpecSchema>;
76
+ required?: string[];
77
+ additionalProperties?: boolean | SpecSchema;
78
+ description?: string;
79
+ } | {
80
+ type: "function";
81
+ signatures?: SpecSignature[];
82
+ };
83
+ type SpecSchemaCombinator = {
84
+ anyOf: SpecSchema[];
85
+ discriminator?: {
86
+ propertyName: string;
87
+ };
88
+ } | {
89
+ allOf: SpecSchema[];
90
+ } | {
91
+ oneOf: SpecSchema[];
92
+ };
93
+ type SpecSchemaRef = {
94
+ $ref: string;
95
+ };
96
+ type SpecSchemaFallback = {
97
+ type: string;
98
+ tsType?: string;
99
+ };
100
+ type SpecSchemaGeneric = Record<string, unknown>;
101
+ type SpecSchema = string | SpecSchemaPrimitive | SpecSchemaComposite | SpecSchemaCombinator | SpecSchemaRef | SpecSchemaFallback | SpecSchemaGeneric;
102
+ type SpecExampleLanguage = "ts" | "js" | "tsx" | "jsx" | "shell" | "json";
103
+ type SpecExample = {
104
+ code: string;
105
+ title?: string;
106
+ description?: string;
107
+ language?: SpecExampleLanguage;
108
+ runnable?: boolean;
109
+ expectedOutput?: string;
110
+ tags?: string[];
111
+ };
112
+ type SpecRelationType = "uses" | "returns" | "implements" | "extends" | "see-also" | "companion";
113
+ type SpecRelation = {
114
+ type: SpecRelationType;
115
+ target: string;
116
+ description?: string;
117
+ };
18
118
  type SpecExtension = Record<string, unknown>;
19
119
  type SpecDocSignal = "description" | "params" | "returns" | "examples";
20
120
  type SpecDocDrift = {
@@ -41,6 +141,7 @@ type SpecSignatureParameter = {
41
141
  schema: SpecSchema;
42
142
  default?: unknown;
43
143
  rest?: boolean;
144
+ decorators?: SpecDecorator[];
44
145
  };
45
146
  type SpecSignatureReturn = {
46
147
  schema: SpecSchema;
@@ -54,6 +155,7 @@ type SpecSignature = {
54
155
  typeParameters?: SpecTypeParameter[];
55
156
  overloadIndex?: number;
56
157
  isImplementation?: boolean;
158
+ throws?: SpecThrows[];
57
159
  };
58
160
  type SpecMember = {
59
161
  id?: string;
@@ -65,6 +167,7 @@ type SpecMember = {
65
167
  flags?: Record<string, unknown>;
66
168
  schema?: SpecSchema;
67
169
  signatures?: SpecSignature[];
170
+ decorators?: SpecDecorator[];
68
171
  };
69
172
  type SpecExportKind = "function" | "class" | "variable" | "interface" | "type" | "enum" | "module" | "namespace" | "reference" | "external";
70
173
  type SpecTypeKind = "class" | "interface" | "type" | "enum" | "external";
@@ -83,7 +186,7 @@ type SpecExport = {
83
186
  type?: string | SpecSchema;
84
187
  schema?: SpecSchema;
85
188
  description?: string;
86
- examples?: string[];
189
+ examples?: (string | SpecExample)[];
87
190
  docs?: SpecDocsMetadata;
88
191
  source?: SpecSource;
89
192
  deprecated?: boolean;
@@ -91,6 +194,13 @@ type SpecExport = {
91
194
  tags?: SpecTag[];
92
195
  extends?: string;
93
196
  implements?: string[];
197
+ typeAliasKind?: SpecTypeAliasKind;
198
+ conditionalType?: SpecConditionalType;
199
+ mappedType?: SpecMappedType;
200
+ decorators?: SpecDecorator[];
201
+ isAugmentation?: boolean;
202
+ augmentedModule?: string;
203
+ related?: SpecRelation[];
94
204
  };
95
205
  type SpecType = {
96
206
  id: string;
@@ -110,6 +220,10 @@ type SpecType = {
110
220
  rawComments?: string;
111
221
  extends?: string;
112
222
  implements?: string[];
223
+ typeAliasKind?: SpecTypeAliasKind;
224
+ conditionalType?: SpecConditionalType;
225
+ mappedType?: SpecMappedType;
226
+ related?: SpecRelation[];
113
227
  };
114
228
  type OpenPkgMeta = {
115
229
  name: string;
@@ -211,4 +325,4 @@ declare function assertSpec(spec: unknown, version?: SchemaVersion): asserts spe
211
325
  * @returns Array of validation errors (empty if valid)
212
326
  */
213
327
  declare function getValidationErrors(spec: unknown, version?: SchemaVersion): SpecError[];
214
- export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecType, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchema, SpecMember, SpecExtension, SpecExportKind, SpecExport, SpecExample, SpecDocsMetadata, SpecDocSignal, SpecDocDrift, SpecDiff, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, CategorizedBreaking, BreakingSeverity };
328
+ export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecRelationType, SpecRelation, SpecMember, SpecMappedType, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecDocsMetadata, SpecDocSignal, SpecDocDrift, SpecDiff, SpecDecorator, SpecConditionalType, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, CategorizedBreaking, BreakingSeverity };
package/dist/index.js CHANGED
@@ -1244,7 +1244,7 @@ var openpkg_schema_default3 = {
1244
1244
  type: "array",
1245
1245
  description: "Usage examples from documentation",
1246
1246
  items: {
1247
- type: "string"
1247
+ $ref: "#/$defs/example"
1248
1248
  }
1249
1249
  },
1250
1250
  signatures: {
@@ -1285,6 +1285,38 @@ var openpkg_schema_default3 = {
1285
1285
  docs: {
1286
1286
  $ref: "#/$defs/docsMetadata",
1287
1287
  description: "Documentation coverage metadata for this export"
1288
+ },
1289
+ typeAliasKind: {
1290
+ $ref: "#/$defs/typeAliasKind",
1291
+ description: "Kind of type alias (for type exports)"
1292
+ },
1293
+ conditionalType: {
1294
+ $ref: "#/$defs/conditionalType",
1295
+ description: "Structural details for conditional types"
1296
+ },
1297
+ mappedType: {
1298
+ $ref: "#/$defs/mappedType",
1299
+ description: "Structural details for mapped types"
1300
+ },
1301
+ decorators: {
1302
+ type: "array",
1303
+ description: "Decorators applied to this export (class/function)",
1304
+ items: { $ref: "#/$defs/decorator" }
1305
+ },
1306
+ isAugmentation: {
1307
+ type: "boolean",
1308
+ description: "True if this is a module augmentation (declare module)"
1309
+ },
1310
+ augmentedModule: {
1311
+ type: "string",
1312
+ description: "The module being augmented (e.g., 'express')"
1313
+ },
1314
+ related: {
1315
+ type: "array",
1316
+ description: "Related exports/types (auto-detected + @see tags)",
1317
+ items: {
1318
+ $ref: "#/$defs/relation"
1319
+ }
1288
1320
  }
1289
1321
  }
1290
1322
  },
@@ -1359,6 +1391,25 @@ var openpkg_schema_default3 = {
1359
1391
  },
1360
1392
  source: {
1361
1393
  $ref: "#/$defs/sourceLocation"
1394
+ },
1395
+ typeAliasKind: {
1396
+ $ref: "#/$defs/typeAliasKind",
1397
+ description: "Kind of type alias"
1398
+ },
1399
+ conditionalType: {
1400
+ $ref: "#/$defs/conditionalType",
1401
+ description: "Structural details for conditional types"
1402
+ },
1403
+ mappedType: {
1404
+ $ref: "#/$defs/mappedType",
1405
+ description: "Structural details for mapped types"
1406
+ },
1407
+ related: {
1408
+ type: "array",
1409
+ description: "Related exports/types (auto-detected + @see tags)",
1410
+ items: {
1411
+ $ref: "#/$defs/relation"
1412
+ }
1362
1413
  }
1363
1414
  }
1364
1415
  },
@@ -1433,6 +1484,11 @@ var openpkg_schema_default3 = {
1433
1484
  isImplementation: {
1434
1485
  type: "boolean",
1435
1486
  description: "True if this is the implementation signature (not user-callable)"
1487
+ },
1488
+ throws: {
1489
+ type: "array",
1490
+ description: "Exceptions that can be thrown by this signature",
1491
+ items: { $ref: "#/$defs/throwsInfo" }
1436
1492
  }
1437
1493
  }
1438
1494
  },
@@ -1479,6 +1535,11 @@ var openpkg_schema_default3 = {
1479
1535
  rest: {
1480
1536
  type: "boolean",
1481
1537
  description: "Whether this is a rest parameter (...args)"
1538
+ },
1539
+ decorators: {
1540
+ type: "array",
1541
+ description: "Decorators applied to this parameter",
1542
+ items: { $ref: "#/$defs/decorator" }
1482
1543
  }
1483
1544
  }
1484
1545
  },
@@ -1495,28 +1556,39 @@ var openpkg_schema_default3 = {
1495
1556
  }
1496
1557
  },
1497
1558
  schema: {
1498
- anyOf: [
1499
- {
1500
- type: "boolean"
1501
- },
1559
+ description: "Flexible JSON Schema for type representation",
1560
+ oneOf: [
1561
+ { type: "string" },
1562
+ { type: "boolean" },
1502
1563
  {
1503
1564
  type: "object",
1504
1565
  properties: {
1505
- $ref: {
1506
- type: "string",
1507
- description: "Reference to another type",
1508
- pattern: "^#/types/[A-Za-z0-9_.-]+$"
1509
- }
1510
- },
1511
- required: ["$ref"],
1512
- additionalProperties: false
1513
- },
1514
- {
1515
- type: "object",
1516
- not: {
1517
- required: ["$ref"]
1518
- },
1519
- additionalProperties: true
1566
+ type: { type: "string" },
1567
+ format: { type: "string" },
1568
+ enum: { type: "array" },
1569
+ items: { $ref: "#/$defs/schema" },
1570
+ properties: {
1571
+ type: "object",
1572
+ additionalProperties: { $ref: "#/$defs/schema" }
1573
+ },
1574
+ required: { type: "array", items: { type: "string" } },
1575
+ additionalProperties: {
1576
+ oneOf: [{ type: "boolean" }, { $ref: "#/$defs/schema" }]
1577
+ },
1578
+ anyOf: { type: "array", items: { $ref: "#/$defs/schema" } },
1579
+ allOf: { type: "array", items: { $ref: "#/$defs/schema" } },
1580
+ oneOf: { type: "array", items: { $ref: "#/$defs/schema" } },
1581
+ $ref: { type: "string" },
1582
+ discriminator: {
1583
+ type: "object",
1584
+ properties: { propertyName: { type: "string" } }
1585
+ },
1586
+ tsType: { type: "string" },
1587
+ description: { type: "string" },
1588
+ minItems: { type: "integer" },
1589
+ maxItems: { type: "integer" },
1590
+ signatures: { type: "array" }
1591
+ }
1520
1592
  }
1521
1593
  ]
1522
1594
  },
@@ -1534,6 +1606,169 @@ var openpkg_schema_default3 = {
1534
1606
  minimum: 1
1535
1607
  }
1536
1608
  }
1609
+ },
1610
+ typeAliasKind: {
1611
+ type: "string",
1612
+ description: "Kind of type alias",
1613
+ enum: ["alias", "conditional", "mapped", "template-literal", "infer"]
1614
+ },
1615
+ conditionalType: {
1616
+ type: "object",
1617
+ description: "Structural representation of a conditional type (T extends X ? Y : Z)",
1618
+ required: ["checkType", "extendsType", "trueType", "falseType"],
1619
+ properties: {
1620
+ checkType: {
1621
+ type: "string",
1622
+ description: "The type being checked (T)"
1623
+ },
1624
+ extendsType: {
1625
+ type: "string",
1626
+ description: "The constraint type (X)"
1627
+ },
1628
+ trueType: {
1629
+ type: "string",
1630
+ description: "The type when condition is true (Y)"
1631
+ },
1632
+ falseType: {
1633
+ type: "string",
1634
+ description: "The type when condition is false (Z)"
1635
+ }
1636
+ },
1637
+ additionalProperties: false
1638
+ },
1639
+ mappedType: {
1640
+ type: "object",
1641
+ description: "Structural representation of a mapped type ({ [K in keyof T]: ... })",
1642
+ required: ["typeParameter"],
1643
+ properties: {
1644
+ typeParameter: {
1645
+ type: "string",
1646
+ description: "The type parameter clause (e.g., 'K in keyof T')"
1647
+ },
1648
+ nameType: {
1649
+ type: "string",
1650
+ description: "The 'as' clause for key remapping (TS 4.1+)"
1651
+ },
1652
+ valueType: {
1653
+ type: "string",
1654
+ description: "The mapped value type"
1655
+ },
1656
+ readonly: {
1657
+ description: "Readonly modifier (+, -, or true for present)",
1658
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
1659
+ },
1660
+ optional: {
1661
+ description: "Optional modifier (+, -, or true for present)",
1662
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
1663
+ }
1664
+ },
1665
+ additionalProperties: false
1666
+ },
1667
+ decorator: {
1668
+ type: "object",
1669
+ description: "Decorator applied to a class, member, or parameter",
1670
+ required: ["name"],
1671
+ properties: {
1672
+ name: {
1673
+ type: "string",
1674
+ description: "Decorator name (e.g., 'Injectable', 'Component')"
1675
+ },
1676
+ arguments: {
1677
+ type: "array",
1678
+ description: "Evaluated decorator arguments (if possible)"
1679
+ },
1680
+ argumentsText: {
1681
+ type: "array",
1682
+ description: "Raw text of decorator arguments",
1683
+ items: { type: "string" }
1684
+ }
1685
+ },
1686
+ additionalProperties: false
1687
+ },
1688
+ throwsInfo: {
1689
+ type: "object",
1690
+ description: "Information about an exception that can be thrown",
1691
+ properties: {
1692
+ type: {
1693
+ type: "string",
1694
+ description: "Exception type (e.g., 'ValidationError', 'Error')"
1695
+ },
1696
+ description: {
1697
+ type: "string",
1698
+ description: "When/why the exception is thrown"
1699
+ }
1700
+ },
1701
+ additionalProperties: false
1702
+ },
1703
+ exampleLanguage: {
1704
+ type: "string",
1705
+ description: "Programming language for an example",
1706
+ enum: ["ts", "js", "tsx", "jsx", "shell", "json"]
1707
+ },
1708
+ example: {
1709
+ description: "Usage example - can be a simple string or structured object",
1710
+ oneOf: [
1711
+ { type: "string" },
1712
+ {
1713
+ type: "object",
1714
+ required: ["code"],
1715
+ properties: {
1716
+ code: {
1717
+ type: "string",
1718
+ description: "The example code"
1719
+ },
1720
+ title: {
1721
+ type: "string",
1722
+ description: "Short title for the example"
1723
+ },
1724
+ description: {
1725
+ type: "string",
1726
+ description: "Longer description of what the example demonstrates"
1727
+ },
1728
+ language: {
1729
+ $ref: "#/$defs/exampleLanguage"
1730
+ },
1731
+ runnable: {
1732
+ type: "boolean",
1733
+ description: "Whether this example can be run/tested automatically"
1734
+ },
1735
+ expectedOutput: {
1736
+ type: "string",
1737
+ description: "Expected output when the example is run"
1738
+ },
1739
+ tags: {
1740
+ type: "array",
1741
+ description: "Categorization tags (e.g., 'basic', 'advanced', 'error-handling')",
1742
+ items: { type: "string" }
1743
+ }
1744
+ },
1745
+ additionalProperties: false
1746
+ }
1747
+ ]
1748
+ },
1749
+ relationType: {
1750
+ type: "string",
1751
+ description: "Type of relationship between exports",
1752
+ enum: ["uses", "returns", "implements", "extends", "see-also", "companion"]
1753
+ },
1754
+ relation: {
1755
+ type: "object",
1756
+ description: "Relationship to another export or type",
1757
+ required: ["type", "target"],
1758
+ properties: {
1759
+ type: {
1760
+ $ref: "#/$defs/relationType"
1761
+ },
1762
+ target: {
1763
+ type: "string",
1764
+ description: "Target export/type ID or reference"
1765
+ },
1766
+ description: {
1767
+ type: "string",
1768
+ description: "Optional description of the relationship"
1769
+ }
1770
+ },
1771
+ additionalProperties: false
1537
1772
  }
1538
1773
  }
1539
1774
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/spec",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared schema, validation, and diff utilities for OpenPkg specs",
5
5
  "keywords": [
6
6
  "openpkg",
@@ -192,7 +192,7 @@
192
192
  "type": "array",
193
193
  "description": "Usage examples from documentation",
194
194
  "items": {
195
- "type": "string"
195
+ "$ref": "#/$defs/example"
196
196
  }
197
197
  },
198
198
  "signatures": {
@@ -233,6 +233,38 @@
233
233
  "docs": {
234
234
  "$ref": "#/$defs/docsMetadata",
235
235
  "description": "Documentation coverage metadata for this export"
236
+ },
237
+ "typeAliasKind": {
238
+ "$ref": "#/$defs/typeAliasKind",
239
+ "description": "Kind of type alias (for type exports)"
240
+ },
241
+ "conditionalType": {
242
+ "$ref": "#/$defs/conditionalType",
243
+ "description": "Structural details for conditional types"
244
+ },
245
+ "mappedType": {
246
+ "$ref": "#/$defs/mappedType",
247
+ "description": "Structural details for mapped types"
248
+ },
249
+ "decorators": {
250
+ "type": "array",
251
+ "description": "Decorators applied to this export (class/function)",
252
+ "items": { "$ref": "#/$defs/decorator" }
253
+ },
254
+ "isAugmentation": {
255
+ "type": "boolean",
256
+ "description": "True if this is a module augmentation (declare module)"
257
+ },
258
+ "augmentedModule": {
259
+ "type": "string",
260
+ "description": "The module being augmented (e.g., 'express')"
261
+ },
262
+ "related": {
263
+ "type": "array",
264
+ "description": "Related exports/types (auto-detected + @see tags)",
265
+ "items": {
266
+ "$ref": "#/$defs/relation"
267
+ }
236
268
  }
237
269
  }
238
270
  },
@@ -307,6 +339,25 @@
307
339
  },
308
340
  "source": {
309
341
  "$ref": "#/$defs/sourceLocation"
342
+ },
343
+ "typeAliasKind": {
344
+ "$ref": "#/$defs/typeAliasKind",
345
+ "description": "Kind of type alias"
346
+ },
347
+ "conditionalType": {
348
+ "$ref": "#/$defs/conditionalType",
349
+ "description": "Structural details for conditional types"
350
+ },
351
+ "mappedType": {
352
+ "$ref": "#/$defs/mappedType",
353
+ "description": "Structural details for mapped types"
354
+ },
355
+ "related": {
356
+ "type": "array",
357
+ "description": "Related exports/types (auto-detected + @see tags)",
358
+ "items": {
359
+ "$ref": "#/$defs/relation"
360
+ }
310
361
  }
311
362
  }
312
363
  },
@@ -381,6 +432,11 @@
381
432
  "isImplementation": {
382
433
  "type": "boolean",
383
434
  "description": "True if this is the implementation signature (not user-callable)"
435
+ },
436
+ "throws": {
437
+ "type": "array",
438
+ "description": "Exceptions that can be thrown by this signature",
439
+ "items": { "$ref": "#/$defs/throwsInfo" }
384
440
  }
385
441
  }
386
442
  },
@@ -427,6 +483,11 @@
427
483
  "rest": {
428
484
  "type": "boolean",
429
485
  "description": "Whether this is a rest parameter (...args)"
486
+ },
487
+ "decorators": {
488
+ "type": "array",
489
+ "description": "Decorators applied to this parameter",
490
+ "items": { "$ref": "#/$defs/decorator" }
430
491
  }
431
492
  }
432
493
  },
@@ -443,28 +504,39 @@
443
504
  }
444
505
  },
445
506
  "schema": {
446
- "anyOf": [
447
- {
448
- "type": "boolean"
449
- },
507
+ "description": "Flexible JSON Schema for type representation",
508
+ "oneOf": [
509
+ { "type": "string" },
510
+ { "type": "boolean" },
450
511
  {
451
512
  "type": "object",
452
513
  "properties": {
453
- "$ref": {
454
- "type": "string",
455
- "description": "Reference to another type",
456
- "pattern": "^#/types/[A-Za-z0-9_.-]+$"
457
- }
458
- },
459
- "required": ["$ref"],
460
- "additionalProperties": false
461
- },
462
- {
463
- "type": "object",
464
- "not": {
465
- "required": ["$ref"]
466
- },
467
- "additionalProperties": true
514
+ "type": { "type": "string" },
515
+ "format": { "type": "string" },
516
+ "enum": { "type": "array" },
517
+ "items": { "$ref": "#/$defs/schema" },
518
+ "properties": {
519
+ "type": "object",
520
+ "additionalProperties": { "$ref": "#/$defs/schema" }
521
+ },
522
+ "required": { "type": "array", "items": { "type": "string" } },
523
+ "additionalProperties": {
524
+ "oneOf": [{ "type": "boolean" }, { "$ref": "#/$defs/schema" }]
525
+ },
526
+ "anyOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
527
+ "allOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
528
+ "oneOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
529
+ "$ref": { "type": "string" },
530
+ "discriminator": {
531
+ "type": "object",
532
+ "properties": { "propertyName": { "type": "string" } }
533
+ },
534
+ "tsType": { "type": "string" },
535
+ "description": { "type": "string" },
536
+ "minItems": { "type": "integer" },
537
+ "maxItems": { "type": "integer" },
538
+ "signatures": { "type": "array" }
539
+ }
468
540
  }
469
541
  ]
470
542
  },
@@ -482,6 +554,169 @@
482
554
  "minimum": 1
483
555
  }
484
556
  }
557
+ },
558
+ "typeAliasKind": {
559
+ "type": "string",
560
+ "description": "Kind of type alias",
561
+ "enum": ["alias", "conditional", "mapped", "template-literal", "infer"]
562
+ },
563
+ "conditionalType": {
564
+ "type": "object",
565
+ "description": "Structural representation of a conditional type (T extends X ? Y : Z)",
566
+ "required": ["checkType", "extendsType", "trueType", "falseType"],
567
+ "properties": {
568
+ "checkType": {
569
+ "type": "string",
570
+ "description": "The type being checked (T)"
571
+ },
572
+ "extendsType": {
573
+ "type": "string",
574
+ "description": "The constraint type (X)"
575
+ },
576
+ "trueType": {
577
+ "type": "string",
578
+ "description": "The type when condition is true (Y)"
579
+ },
580
+ "falseType": {
581
+ "type": "string",
582
+ "description": "The type when condition is false (Z)"
583
+ }
584
+ },
585
+ "additionalProperties": false
586
+ },
587
+ "mappedType": {
588
+ "type": "object",
589
+ "description": "Structural representation of a mapped type ({ [K in keyof T]: ... })",
590
+ "required": ["typeParameter"],
591
+ "properties": {
592
+ "typeParameter": {
593
+ "type": "string",
594
+ "description": "The type parameter clause (e.g., 'K in keyof T')"
595
+ },
596
+ "nameType": {
597
+ "type": "string",
598
+ "description": "The 'as' clause for key remapping (TS 4.1+)"
599
+ },
600
+ "valueType": {
601
+ "type": "string",
602
+ "description": "The mapped value type"
603
+ },
604
+ "readonly": {
605
+ "description": "Readonly modifier (+, -, or true for present)",
606
+ "oneOf": [{ "type": "boolean" }, { "enum": ["+", "-"] }]
607
+ },
608
+ "optional": {
609
+ "description": "Optional modifier (+, -, or true for present)",
610
+ "oneOf": [{ "type": "boolean" }, { "enum": ["+", "-"] }]
611
+ }
612
+ },
613
+ "additionalProperties": false
614
+ },
615
+ "decorator": {
616
+ "type": "object",
617
+ "description": "Decorator applied to a class, member, or parameter",
618
+ "required": ["name"],
619
+ "properties": {
620
+ "name": {
621
+ "type": "string",
622
+ "description": "Decorator name (e.g., 'Injectable', 'Component')"
623
+ },
624
+ "arguments": {
625
+ "type": "array",
626
+ "description": "Evaluated decorator arguments (if possible)"
627
+ },
628
+ "argumentsText": {
629
+ "type": "array",
630
+ "description": "Raw text of decorator arguments",
631
+ "items": { "type": "string" }
632
+ }
633
+ },
634
+ "additionalProperties": false
635
+ },
636
+ "throwsInfo": {
637
+ "type": "object",
638
+ "description": "Information about an exception that can be thrown",
639
+ "properties": {
640
+ "type": {
641
+ "type": "string",
642
+ "description": "Exception type (e.g., 'ValidationError', 'Error')"
643
+ },
644
+ "description": {
645
+ "type": "string",
646
+ "description": "When/why the exception is thrown"
647
+ }
648
+ },
649
+ "additionalProperties": false
650
+ },
651
+ "exampleLanguage": {
652
+ "type": "string",
653
+ "description": "Programming language for an example",
654
+ "enum": ["ts", "js", "tsx", "jsx", "shell", "json"]
655
+ },
656
+ "example": {
657
+ "description": "Usage example - can be a simple string or structured object",
658
+ "oneOf": [
659
+ { "type": "string" },
660
+ {
661
+ "type": "object",
662
+ "required": ["code"],
663
+ "properties": {
664
+ "code": {
665
+ "type": "string",
666
+ "description": "The example code"
667
+ },
668
+ "title": {
669
+ "type": "string",
670
+ "description": "Short title for the example"
671
+ },
672
+ "description": {
673
+ "type": "string",
674
+ "description": "Longer description of what the example demonstrates"
675
+ },
676
+ "language": {
677
+ "$ref": "#/$defs/exampleLanguage"
678
+ },
679
+ "runnable": {
680
+ "type": "boolean",
681
+ "description": "Whether this example can be run/tested automatically"
682
+ },
683
+ "expectedOutput": {
684
+ "type": "string",
685
+ "description": "Expected output when the example is run"
686
+ },
687
+ "tags": {
688
+ "type": "array",
689
+ "description": "Categorization tags (e.g., 'basic', 'advanced', 'error-handling')",
690
+ "items": { "type": "string" }
691
+ }
692
+ },
693
+ "additionalProperties": false
694
+ }
695
+ ]
696
+ },
697
+ "relationType": {
698
+ "type": "string",
699
+ "description": "Type of relationship between exports",
700
+ "enum": ["uses", "returns", "implements", "extends", "see-also", "companion"]
701
+ },
702
+ "relation": {
703
+ "type": "object",
704
+ "description": "Relationship to another export or type",
705
+ "required": ["type", "target"],
706
+ "properties": {
707
+ "type": {
708
+ "$ref": "#/$defs/relationType"
709
+ },
710
+ "target": {
711
+ "type": "string",
712
+ "description": "Target export/type ID or reference"
713
+ },
714
+ "description": {
715
+ "type": "string",
716
+ "description": "Optional description of the relationship"
717
+ }
718
+ },
719
+ "additionalProperties": false
485
720
  }
486
721
  }
487
722
  }