@openpkg-ts/spec 0.11.0 → 0.12.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
@@ -1,12 +1,6 @@
1
1
  type SpecTag = {
2
2
  name: string;
3
3
  text: string;
4
- paramName?: string;
5
- typeAnnotation?: string;
6
- reference?: string;
7
- language?: string;
8
- version?: string;
9
- reason?: string;
10
4
  };
11
5
  type SpecTypeAliasKind = "alias" | "conditional" | "mapped" | "template-literal" | "infer";
12
6
  type SpecConditionalType = {
@@ -35,6 +29,10 @@ type SpecSource = {
35
29
  file?: string;
36
30
  line?: number;
37
31
  url?: string;
32
+ /** Package name for external types (e.g., "@stacks/common") */
33
+ package?: string;
34
+ /** Package version for external types (e.g., "7.0.0") */
35
+ version?: string;
38
36
  };
39
37
  type SpecSchemaPrimitive = {
40
38
  type: "string";
@@ -92,6 +90,7 @@ type SpecSchemaCombinator = {
92
90
  };
93
91
  type SpecSchemaRef = {
94
92
  $ref: string;
93
+ typeArguments?: SpecSchema[];
95
94
  };
96
95
  type SpecSchemaFallback = {
97
96
  type: string;
@@ -104,54 +103,22 @@ type SpecExample = {
104
103
  title?: string;
105
104
  description?: string;
106
105
  language?: SpecExampleLanguage;
107
- runnable?: boolean;
108
- expectedOutput?: string;
109
- tags?: string[];
110
- };
111
- type SpecRelationType = "uses" | "returns" | "implements" | "extends" | "see-also" | "companion";
112
- type SpecRelation = {
113
- type: SpecRelationType;
114
- target: string;
115
- description?: string;
116
106
  };
117
107
  type SpecExtension = Record<string, unknown>;
118
- /**
119
- * All possible drift type identifiers.
120
- */
121
- type DriftType = "param-mismatch" | "param-type-mismatch" | "return-type-mismatch" | "generic-constraint-mismatch" | "optionality-mismatch" | "deprecated-mismatch" | "visibility-mismatch" | "async-mismatch" | "property-type-drift" | "example-drift" | "example-syntax-error" | "example-runtime-error" | "example-assertion-failed" | "broken-link";
122
- type SpecDocDrift = {
123
- type: DriftType;
124
- target?: string;
125
- issue: string;
126
- suggestion?: string;
108
+ /** Presentation metadata for an export/type (moved from inline fields) */
109
+ type SpecPresentationMeta = {
110
+ slug?: string;
111
+ displayName?: string;
112
+ category?: string;
113
+ importPath?: string;
114
+ alias?: string;
127
115
  };
128
- /**
129
- * Drift categories group related drift types for progressive disclosure.
130
- *
131
- * - `structural`: Signature/type mismatches (mostly auto-fixable via JSDoc)
132
- * - `semantic`: Metadata/visibility/reference issues
133
- * - `example`: Code example problems
134
- */
135
- type DriftCategory = "structural" | "semantic" | "example";
136
- /**
137
- * Maps each drift type to its category.
138
- */
139
- declare const DRIFT_CATEGORIES: Record<DriftType, DriftCategory>;
140
- /**
141
- * Human-readable category labels.
142
- */
143
- declare const DRIFT_CATEGORY_LABELS: Record<DriftCategory, string>;
144
- /**
145
- * Category descriptions for help text.
146
- */
147
- declare const DRIFT_CATEGORY_DESCRIPTIONS: Record<DriftCategory, string>;
148
- type SpecVisibility = "public" | "protected" | "private";
149
- type SpecDocsMetadata = {
150
- coverageScore?: number;
151
- /** Rule IDs that failed quality checks */
152
- missing?: string[];
153
- drift?: SpecDocDrift[];
116
+ /** Extensions structure with typed presentation field */
117
+ type SpecExtensions = {
118
+ presentation?: Record<string, SpecPresentationMeta>;
119
+ [key: string]: unknown;
154
120
  };
121
+ type SpecVisibility = "public" | "protected" | "private";
155
122
  type SpecTypeParameter = {
156
123
  name: string;
157
124
  constraint?: string;
@@ -196,11 +163,6 @@ type SpecTypeKind = "class" | "interface" | "type" | "enum" | "external";
196
163
  type SpecExport = {
197
164
  id: string;
198
165
  name: string;
199
- slug?: string;
200
- displayName?: string;
201
- alias?: string;
202
- category?: string;
203
- importPath?: string;
204
166
  kind: SpecExportKind;
205
167
  signatures?: SpecSignature[];
206
168
  typeParameters?: SpecTypeParameter[];
@@ -219,18 +181,10 @@ type SpecExport = {
219
181
  conditionalType?: SpecConditionalType;
220
182
  mappedType?: SpecMappedType;
221
183
  decorators?: SpecDecorator[];
222
- isAugmentation?: boolean;
223
- augmentedModule?: string;
224
- related?: SpecRelation[];
225
184
  };
226
185
  type SpecType = {
227
186
  id: string;
228
187
  name: string;
229
- slug?: string;
230
- displayName?: string;
231
- alias?: string;
232
- category?: string;
233
- importPath?: string;
234
188
  kind: SpecTypeKind;
235
189
  description?: string;
236
190
  schema?: SpecSchema;
@@ -244,7 +198,8 @@ type SpecType = {
244
198
  typeAliasKind?: SpecTypeAliasKind;
245
199
  conditionalType?: SpecConditionalType;
246
200
  mappedType?: SpecMappedType;
247
- related?: SpecRelation[];
201
+ /** Whether this type is from an external package (node_modules) */
202
+ external?: boolean;
248
203
  };
249
204
  type OpenPkgMeta = {
250
205
  name: string;
@@ -328,7 +283,12 @@ type SpecGenerationInfo = {
328
283
  fromCache?: boolean;
329
284
  };
330
285
  /** Supported OpenPkg spec versions */
331
- type OpenPkgVersion = "0.2.0" | "0.3.0";
286
+ type OpenPkgVersion = "0.2.0" | "0.3.0" | "0.4.0";
287
+ /** Minimal generation metadata for v0.4.0 */
288
+ type SpecGenerationMeta = {
289
+ generator?: string;
290
+ timestamp?: string;
291
+ };
332
292
  type OpenPkg = {
333
293
  $schema?: string;
334
294
  openpkg: OpenPkgVersion;
@@ -336,25 +296,14 @@ type OpenPkg = {
336
296
  exports: SpecExport[];
337
297
  types?: SpecType[];
338
298
  examples?: SpecExample[];
339
- extensions?: SpecExtension;
340
- /** Required metadata about how this spec was generated */
341
- generation: SpecGenerationInfo;
299
+ extensions?: SpecExtensions;
300
+ /** Optional generation metadata (minimal in v0.4.0) */
301
+ generation?: SpecGenerationMeta | SpecGenerationInfo;
342
302
  };
343
303
  declare const SCHEMA_VERSION: OpenPkgVersion;
344
- declare const SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json";
304
+ declare const SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.4.0/openpkg.schema.json";
345
305
  declare const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
346
306
  declare function dereference(spec: OpenPkg): OpenPkg;
347
- /**
348
- * Export with optional docs metadata for diff comparison.
349
- * Pure OpenPkg specs won't have docs; enriched specs will.
350
- */
351
- type ExportWithDocs = SpecExport & {
352
- docs?: SpecDocsMetadata;
353
- };
354
- type SpecWithDocs = OpenPkg & {
355
- docs?: SpecDocsMetadata;
356
- exports: ExportWithDocs[];
357
- };
358
307
  type BreakingSeverity = "high" | "medium" | "low";
359
308
  interface CategorizedBreaking {
360
309
  id: string;
@@ -374,31 +323,15 @@ type SpecDiff = {
374
323
  breaking: string[];
375
324
  nonBreaking: string[];
376
325
  docsOnly: string[];
377
- coverageDelta: number;
378
- oldCoverage: number;
379
- newCoverage: number;
380
- newUndocumented: string[];
381
- improvedExports: string[];
382
- regressedExports: string[];
383
- driftIntroduced: number;
384
- driftResolved: number;
385
326
  };
386
327
  /**
387
328
  * Compare two OpenPkg specs and compute differences.
388
- * If specs are enriched (have docs metadata), coverage changes are tracked.
389
- * For pure structural specs, coverage fields will be 0.
390
329
  */
391
- declare function diffSpec(oldSpec: SpecWithDocs, newSpec: SpecWithDocs): SpecDiff;
330
+ declare function diffSpec(oldSpec: OpenPkg, newSpec: OpenPkg): SpecDiff;
392
331
  /**
393
332
  * Categorize breaking changes by severity
394
- *
395
- * @param breaking - Array of breaking change IDs
396
- * @param oldSpec - Previous spec version
397
- * @param newSpec - Current spec version
398
- * @param memberChanges - Optional member-level changes for classes
399
- * @returns Categorized breaking changes sorted by severity (high first)
400
333
  */
401
- declare function categorizeBreakingChanges(breaking: string[], oldSpec: SpecWithDocs, newSpec: SpecWithDocs, memberChanges?: MemberChangeInfo[]): CategorizedBreaking[];
334
+ declare function categorizeBreakingChanges(breaking: string[], oldSpec: OpenPkg, newSpec: OpenPkg, memberChanges?: MemberChangeInfo[]): CategorizedBreaking[];
402
335
  /**
403
336
  * Semver version bump type.
404
337
  */
@@ -458,7 +391,7 @@ declare function recommendSemverBump(diff: SpecDiff): SemverRecommendation;
458
391
  declare function calculateNextVersion(currentVersion: string, bump: SemverBump): string;
459
392
  declare function normalize(spec: OpenPkg): OpenPkg;
460
393
  /** Supported schema versions */
461
- type SchemaVersion = "0.1.0" | "0.2.0" | "0.3.0" | "latest";
394
+ type SchemaVersion = "0.1.0" | "0.2.0" | "0.3.0" | "0.4.0" | "latest";
462
395
  type SpecError = {
463
396
  instancePath: string;
464
397
  message: string;
@@ -493,4 +426,4 @@ declare function assertSpec(spec: unknown, version?: SchemaVersion): asserts spe
493
426
  * @returns Array of validation errors (empty if valid)
494
427
  */
495
428
  declare function getValidationErrors(spec: unknown, version?: SchemaVersion): SpecError[];
496
- export { validateSpec, recommendSemverBump, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, calculateNextVersion, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecRelationType, SpecRelation, SpecMember, SpecMappedType, SpecGenerationInfo, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecDocsMetadata, SpecDocDrift, SpecDiff, SpecDecorator, SpecConditionalType, SemverRecommendation, SemverBump, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, GenerationIssueSeverity, GenerationIssue, EntryPointDetectionMethod, DriftType, DriftCategory, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, CategorizedBreaking, BreakingSeverity };
429
+ export { validateSpec, recommendSemverBump, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, calculateNextVersion, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecPresentationMeta, SpecMember, SpecMappedType, SpecGenerationMeta, SpecGenerationInfo, SpecExtensions, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecDiff, SpecDecorator, SpecConditionalType, SemverRecommendation, SemverBump, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, GenerationIssueSeverity, GenerationIssue, EntryPointDetectionMethod, CategorizedBreaking, BreakingSeverity };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
- var SCHEMA_VERSION = "0.3.0";
3
- var SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json";
2
+ var SCHEMA_VERSION = "0.4.0";
3
+ var SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.4.0/openpkg.schema.json";
4
4
  var JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
5
5
  // src/deref.ts
6
6
  function dereference(spec) {
@@ -72,47 +72,10 @@ function diffSpec(oldSpec, newSpec) {
72
72
  const result = {
73
73
  breaking: [],
74
74
  nonBreaking: [],
75
- docsOnly: [],
76
- coverageDelta: 0,
77
- oldCoverage: 0,
78
- newCoverage: 0,
79
- newUndocumented: [],
80
- improvedExports: [],
81
- regressedExports: [],
82
- driftIntroduced: 0,
83
- driftResolved: 0
75
+ docsOnly: []
84
76
  };
85
77
  diffCollections(result, oldSpec.exports, newSpec.exports);
86
78
  diffCollections(result, oldSpec.types ?? [], newSpec.types ?? []);
87
- result.oldCoverage = oldSpec.docs?.coverageScore ?? 0;
88
- result.newCoverage = newSpec.docs?.coverageScore ?? 0;
89
- result.coverageDelta = Math.round((result.newCoverage - result.oldCoverage) * 10) / 10;
90
- const oldExportMap = toExportMap(oldSpec.exports);
91
- const newExportMap = toExportMap(newSpec.exports);
92
- for (const [id, newExport] of newExportMap.entries()) {
93
- const oldExport = oldExportMap.get(id);
94
- const newScore = newExport.docs?.coverageScore ?? 0;
95
- const newDriftCount = newExport.docs?.drift?.length ?? 0;
96
- if (!oldExport) {
97
- if (newScore < 100 || (newExport.docs?.missing?.length ?? 0) > 0) {
98
- result.newUndocumented.push(id);
99
- }
100
- result.driftIntroduced += newDriftCount;
101
- continue;
102
- }
103
- const oldScore = oldExport.docs?.coverageScore ?? 0;
104
- const oldDriftCount = oldExport.docs?.drift?.length ?? 0;
105
- if (newScore > oldScore) {
106
- result.improvedExports.push(id);
107
- } else if (newScore < oldScore) {
108
- result.regressedExports.push(id);
109
- }
110
- if (newDriftCount > oldDriftCount) {
111
- result.driftIntroduced += newDriftCount - oldDriftCount;
112
- } else if (oldDriftCount > newDriftCount) {
113
- result.driftResolved += oldDriftCount - newDriftCount;
114
- }
115
- }
116
79
  return result;
117
80
  }
118
81
  function toExportMap(exports) {
@@ -159,21 +122,7 @@ function toMap(items) {
159
122
  }
160
123
  return map;
161
124
  }
162
- var DOC_KEYS = new Set([
163
- "description",
164
- "examples",
165
- "tags",
166
- "rawComments",
167
- "source",
168
- "docs",
169
- "displayName",
170
- "slug",
171
- "importPath",
172
- "category",
173
- "coverageScore",
174
- "missing",
175
- "drift"
176
- ]);
125
+ var DOC_KEYS = new Set(["description", "examples", "tags", "rawComments", "source"]);
177
126
  function isDocOnlyChange(a, b) {
178
127
  const structuralA = normalizeForComparison(removeDocFields(a));
179
128
  const structuralB = normalizeForComparison(removeDocFields(b));
@@ -353,7 +302,7 @@ var DEFAULT_ECOSYSTEM = "js/ts";
353
302
  var arrayFieldsByExport = ["signatures", "members", "examples", "tags"];
354
303
  var arrayFieldsByType = ["members", "tags"];
355
304
  function normalize(spec) {
356
- const normalized = JSON.parse(JSON.stringify(spec));
305
+ const normalized = structuredClone(spec);
357
306
  normalized.meta = {
358
307
  ecosystem: normalized.meta?.ecosystem ?? DEFAULT_ECOSYSTEM,
359
308
  ...normalized.meta
@@ -364,53 +313,78 @@ function normalize(spec) {
364
313
  const types = Array.isArray(normalized.types) ? [...normalized.types] : [];
365
314
  types.sort((a, b) => (a.name || "").localeCompare(b.name || ""));
366
315
  normalized.types = types.map((item) => normalizeType(item));
316
+ if (normalized.generation) {
317
+ normalized.generation = normalizeGeneration(normalized.generation);
318
+ }
367
319
  return normalized;
368
320
  }
321
+ function normalizeGeneration(gen) {
322
+ if (!gen)
323
+ return;
324
+ const extendedGen = gen;
325
+ if (extendedGen.generator && typeof extendedGen.generator === "object") {
326
+ return {
327
+ generator: `${extendedGen.generator.name}@${extendedGen.generator.version}`,
328
+ timestamp: extendedGen.timestamp
329
+ };
330
+ }
331
+ return gen;
332
+ }
369
333
  function normalizeExport(item) {
370
- const clone = JSON.parse(JSON.stringify(item));
334
+ const clone = structuredClone(item);
371
335
  for (const field of arrayFieldsByExport) {
372
336
  if (!Array.isArray(clone[field])) {
373
337
  clone[field] = [];
374
338
  }
375
339
  }
340
+ if (clone.type !== undefined && typeof clone.type !== "string") {
341
+ if (!clone.schema) {
342
+ clone.schema = clone.type;
343
+ }
344
+ delete clone.type;
345
+ }
346
+ if (clone.tags && clone.tags.length > 0) {
347
+ clone.tags = clone.tags.map(normalizeTag);
348
+ }
349
+ if (clone.members && clone.members.length > 0) {
350
+ clone.members = clone.members.map(normalizeMember);
351
+ }
376
352
  return clone;
377
353
  }
378
354
  function normalizeType(item) {
379
- const clone = JSON.parse(JSON.stringify(item));
355
+ const clone = structuredClone(item);
380
356
  for (const field of arrayFieldsByType) {
381
357
  if (!Array.isArray(clone[field])) {
382
358
  clone[field] = [];
383
359
  }
384
360
  }
361
+ if (clone.type !== undefined && typeof clone.type !== "string") {
362
+ if (!clone.schema) {
363
+ clone.schema = clone.type;
364
+ }
365
+ delete clone.type;
366
+ }
367
+ if (clone.tags && clone.tags.length > 0) {
368
+ clone.tags = clone.tags.map(normalizeTag);
369
+ }
370
+ if (clone.members && clone.members.length > 0) {
371
+ clone.members = clone.members.map(normalizeMember);
372
+ }
373
+ return clone;
374
+ }
375
+ function normalizeTag(tag) {
376
+ return {
377
+ name: tag.name,
378
+ text: tag.text
379
+ };
380
+ }
381
+ function normalizeMember(member) {
382
+ const clone = structuredClone(member);
383
+ if (clone.tags && clone.tags.length > 0) {
384
+ clone.tags = clone.tags.map(normalizeTag);
385
+ }
385
386
  return clone;
386
387
  }
387
- // src/types.ts
388
- var DRIFT_CATEGORIES = {
389
- "param-mismatch": "structural",
390
- "param-type-mismatch": "structural",
391
- "return-type-mismatch": "structural",
392
- "optionality-mismatch": "structural",
393
- "generic-constraint-mismatch": "structural",
394
- "property-type-drift": "structural",
395
- "async-mismatch": "structural",
396
- "deprecated-mismatch": "semantic",
397
- "visibility-mismatch": "semantic",
398
- "broken-link": "semantic",
399
- "example-drift": "example",
400
- "example-syntax-error": "example",
401
- "example-runtime-error": "example",
402
- "example-assertion-failed": "example"
403
- };
404
- var DRIFT_CATEGORY_LABELS = {
405
- structural: "Signature mismatches",
406
- semantic: "Metadata issues",
407
- example: "Example problems"
408
- };
409
- var DRIFT_CATEGORY_DESCRIPTIONS = {
410
- structural: "JSDoc types or parameters don't match the actual code signature",
411
- semantic: "Deprecation, visibility, or reference issues",
412
- example: "@example code has errors or doesn't work correctly"
413
- };
414
388
  // src/validate.ts
415
389
  import Ajv from "ajv/dist/2020.js";
416
390
  import addFormats from "ajv-formats";
@@ -1879,10 +1853,7 @@ var openpkg_schema_default3 = {
1879
1853
  },
1880
1854
  required: { type: "array", items: { type: "string" } },
1881
1855
  additionalProperties: {
1882
- oneOf: [
1883
- { type: "boolean" },
1884
- { type: "object", additionalProperties: true }
1885
- ]
1856
+ oneOf: [{ type: "boolean" }, { type: "object", additionalProperties: true }]
1886
1857
  },
1887
1858
  anyOf: { type: "array", items: { $ref: "#/$defs/schema" } },
1888
1859
  allOf: { type: "array", items: { $ref: "#/$defs/schema" } },
@@ -2142,13 +2113,393 @@ var openpkg_schema_default3 = {
2142
2113
  }
2143
2114
  }
2144
2115
  };
2116
+ // schemas/v0.4.0/openpkg.schema.json
2117
+ var openpkg_schema_default4 = {
2118
+ $schema: "https://json-schema.org/draft/2020-12/schema",
2119
+ $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.4.0/openpkg.schema.json",
2120
+ title: "OpenPkg Specification v0.4.0",
2121
+ description: "Minimal tool-agnostic TypeScript export representation",
2122
+ type: "object",
2123
+ required: ["openpkg", "meta", "exports"],
2124
+ properties: {
2125
+ $schema: {
2126
+ type: "string",
2127
+ description: "Reference to the OpenPkg schema version"
2128
+ },
2129
+ openpkg: {
2130
+ type: "string",
2131
+ const: "0.4.0"
2132
+ },
2133
+ meta: {
2134
+ type: "object",
2135
+ required: ["name"],
2136
+ properties: {
2137
+ name: { type: "string" },
2138
+ version: { type: "string" },
2139
+ description: { type: "string" },
2140
+ license: { type: "string" },
2141
+ repository: { type: "string" },
2142
+ ecosystem: { type: "string" }
2143
+ }
2144
+ },
2145
+ exports: {
2146
+ type: "array",
2147
+ items: { $ref: "#/$defs/export" }
2148
+ },
2149
+ types: {
2150
+ type: "array",
2151
+ items: { $ref: "#/$defs/typeDef" }
2152
+ },
2153
+ examples: {
2154
+ type: "array",
2155
+ items: { $ref: "#/$defs/example" }
2156
+ },
2157
+ extensions: {
2158
+ type: "object",
2159
+ properties: {
2160
+ presentation: {
2161
+ type: "object",
2162
+ additionalProperties: { $ref: "#/$defs/presentationMeta" }
2163
+ }
2164
+ },
2165
+ additionalProperties: true
2166
+ },
2167
+ generation: {
2168
+ $ref: "#/$defs/generationMeta",
2169
+ description: "Optional generation metadata"
2170
+ }
2171
+ },
2172
+ $defs: {
2173
+ generationMeta: {
2174
+ type: "object",
2175
+ properties: {
2176
+ generator: { type: "string" },
2177
+ timestamp: { type: "string", format: "date-time" }
2178
+ }
2179
+ },
2180
+ presentationMeta: {
2181
+ type: "object",
2182
+ properties: {
2183
+ slug: { type: "string" },
2184
+ displayName: { type: "string" },
2185
+ category: { type: "string" },
2186
+ importPath: { type: "string" },
2187
+ alias: { type: "string" }
2188
+ },
2189
+ additionalProperties: false
2190
+ },
2191
+ export: {
2192
+ type: "object",
2193
+ required: ["id", "name", "kind"],
2194
+ properties: {
2195
+ id: { type: "string" },
2196
+ name: { type: "string" },
2197
+ kind: {
2198
+ type: "string",
2199
+ enum: [
2200
+ "function",
2201
+ "class",
2202
+ "variable",
2203
+ "interface",
2204
+ "type",
2205
+ "enum",
2206
+ "module",
2207
+ "namespace",
2208
+ "reference",
2209
+ "external"
2210
+ ]
2211
+ },
2212
+ description: { type: "string" },
2213
+ examples: {
2214
+ type: "array",
2215
+ items: { $ref: "#/$defs/example" }
2216
+ },
2217
+ signatures: {
2218
+ type: "array",
2219
+ items: { $ref: "#/$defs/signature" }
2220
+ },
2221
+ type: { type: "string" },
2222
+ schema: { $ref: "#/$defs/schema" },
2223
+ members: {
2224
+ type: "array",
2225
+ items: { $ref: "#/$defs/member" }
2226
+ },
2227
+ extends: { type: "string" },
2228
+ implements: {
2229
+ type: "array",
2230
+ items: { type: "string" }
2231
+ },
2232
+ tags: {
2233
+ type: "array",
2234
+ items: { $ref: "#/$defs/tag" }
2235
+ },
2236
+ source: { $ref: "#/$defs/sourceLocation" },
2237
+ deprecated: { type: "boolean" },
2238
+ flags: { type: "object", additionalProperties: true },
2239
+ typeParameters: {
2240
+ type: "array",
2241
+ items: { $ref: "#/$defs/typeParameter" }
2242
+ },
2243
+ typeAliasKind: { $ref: "#/$defs/typeAliasKind" },
2244
+ conditionalType: { $ref: "#/$defs/conditionalType" },
2245
+ mappedType: { $ref: "#/$defs/mappedType" },
2246
+ decorators: {
2247
+ type: "array",
2248
+ items: { $ref: "#/$defs/decorator" }
2249
+ }
2250
+ }
2251
+ },
2252
+ typeDef: {
2253
+ type: "object",
2254
+ required: ["id", "name", "kind"],
2255
+ properties: {
2256
+ id: { type: "string" },
2257
+ name: { type: "string" },
2258
+ kind: {
2259
+ type: "string",
2260
+ enum: ["interface", "type", "enum", "class", "external"]
2261
+ },
2262
+ description: { type: "string" },
2263
+ schema: { $ref: "#/$defs/schema" },
2264
+ type: { type: "string" },
2265
+ members: {
2266
+ type: "array",
2267
+ items: { $ref: "#/$defs/member" }
2268
+ },
2269
+ extends: { type: "string" },
2270
+ implements: {
2271
+ type: "array",
2272
+ items: { type: "string" }
2273
+ },
2274
+ tags: {
2275
+ type: "array",
2276
+ items: { $ref: "#/$defs/tag" }
2277
+ },
2278
+ source: { $ref: "#/$defs/sourceLocation" },
2279
+ rawComments: { type: "string" },
2280
+ typeAliasKind: { $ref: "#/$defs/typeAliasKind" },
2281
+ conditionalType: { $ref: "#/$defs/conditionalType" },
2282
+ mappedType: { $ref: "#/$defs/mappedType" }
2283
+ }
2284
+ },
2285
+ tag: {
2286
+ type: "object",
2287
+ required: ["name", "text"],
2288
+ properties: {
2289
+ name: { type: "string" },
2290
+ text: { type: "string" }
2291
+ },
2292
+ additionalProperties: false
2293
+ },
2294
+ signature: {
2295
+ type: "object",
2296
+ properties: {
2297
+ parameters: {
2298
+ type: "array",
2299
+ items: { $ref: "#/$defs/parameter" }
2300
+ },
2301
+ returns: { $ref: "#/$defs/returns" },
2302
+ description: { type: "string" },
2303
+ typeParameters: {
2304
+ type: "array",
2305
+ items: { $ref: "#/$defs/typeParameter" }
2306
+ },
2307
+ overloadIndex: { type: "integer", minimum: 0 },
2308
+ isImplementation: { type: "boolean" },
2309
+ throws: {
2310
+ type: "array",
2311
+ items: { $ref: "#/$defs/throwsInfo" }
2312
+ }
2313
+ }
2314
+ },
2315
+ typeParameter: {
2316
+ type: "object",
2317
+ required: ["name"],
2318
+ properties: {
2319
+ name: { type: "string" },
2320
+ constraint: { type: "string" },
2321
+ default: { type: "string" }
2322
+ }
2323
+ },
2324
+ parameter: {
2325
+ type: "object",
2326
+ required: ["name"],
2327
+ properties: {
2328
+ name: { type: "string" },
2329
+ required: { type: "boolean" },
2330
+ schema: { $ref: "#/$defs/schema" },
2331
+ description: { type: "string" },
2332
+ default: {},
2333
+ rest: { type: "boolean" },
2334
+ decorators: {
2335
+ type: "array",
2336
+ items: { $ref: "#/$defs/decorator" }
2337
+ }
2338
+ }
2339
+ },
2340
+ returns: {
2341
+ type: "object",
2342
+ properties: {
2343
+ schema: { $ref: "#/$defs/schema" },
2344
+ description: { type: "string" }
2345
+ }
2346
+ },
2347
+ schema: {
2348
+ oneOf: [
2349
+ { type: "string" },
2350
+ { type: "boolean" },
2351
+ {
2352
+ type: "object",
2353
+ properties: {
2354
+ $schema: { type: "string" },
2355
+ type: { type: "string" },
2356
+ format: { type: "string" },
2357
+ enum: { type: "array" },
2358
+ const: {},
2359
+ items: { $ref: "#/$defs/schema" },
2360
+ prefixedItems: {
2361
+ type: "array",
2362
+ items: { $ref: "#/$defs/schema" }
2363
+ },
2364
+ properties: {
2365
+ type: "object",
2366
+ additionalProperties: { $ref: "#/$defs/schema" }
2367
+ },
2368
+ required: { type: "array", items: { type: "string" } },
2369
+ additionalProperties: {
2370
+ oneOf: [{ type: "boolean" }, { type: "object" }]
2371
+ },
2372
+ anyOf: { type: "array", items: { $ref: "#/$defs/schema" } },
2373
+ allOf: { type: "array", items: { $ref: "#/$defs/schema" } },
2374
+ oneOf: { type: "array", items: { $ref: "#/$defs/schema" } },
2375
+ $ref: { type: "string" },
2376
+ discriminator: {
2377
+ type: "object",
2378
+ properties: { propertyName: { type: "string" } }
2379
+ },
2380
+ description: { type: "string" },
2381
+ default: {},
2382
+ minimum: { type: "number" },
2383
+ maximum: { type: "number" },
2384
+ exclusiveMinimum: { type: "number" },
2385
+ exclusiveMaximum: { type: "number" },
2386
+ minLength: { type: "integer" },
2387
+ maxLength: { type: "integer" },
2388
+ pattern: { type: "string" },
2389
+ minItems: { type: "integer" },
2390
+ maxItems: { type: "integer" },
2391
+ uniqueItems: { type: "boolean" },
2392
+ signatures: { type: "array", items: { $ref: "#/$defs/signature" } }
2393
+ }
2394
+ }
2395
+ ]
2396
+ },
2397
+ sourceLocation: {
2398
+ type: "object",
2399
+ properties: {
2400
+ file: { type: "string" },
2401
+ line: { type: "integer", minimum: 1 },
2402
+ url: { type: "string" }
2403
+ }
2404
+ },
2405
+ typeAliasKind: {
2406
+ type: "string",
2407
+ enum: ["alias", "conditional", "mapped", "template-literal", "infer"]
2408
+ },
2409
+ conditionalType: {
2410
+ type: "object",
2411
+ required: ["checkType", "extendsType", "trueType", "falseType"],
2412
+ properties: {
2413
+ checkType: { type: "string" },
2414
+ extendsType: { type: "string" },
2415
+ trueType: { type: "string" },
2416
+ falseType: { type: "string" }
2417
+ },
2418
+ additionalProperties: false
2419
+ },
2420
+ mappedType: {
2421
+ type: "object",
2422
+ required: ["typeParameter"],
2423
+ properties: {
2424
+ typeParameter: { type: "string" },
2425
+ nameType: { type: "string" },
2426
+ valueType: { type: "string" },
2427
+ readonly: {
2428
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
2429
+ },
2430
+ optional: {
2431
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
2432
+ }
2433
+ },
2434
+ additionalProperties: false
2435
+ },
2436
+ decorator: {
2437
+ type: "object",
2438
+ required: ["name"],
2439
+ properties: {
2440
+ name: { type: "string" },
2441
+ arguments: { type: "array" },
2442
+ argumentsText: { type: "array", items: { type: "string" } }
2443
+ },
2444
+ additionalProperties: false
2445
+ },
2446
+ throwsInfo: {
2447
+ type: "object",
2448
+ properties: {
2449
+ type: { type: "string" },
2450
+ description: { type: "string" }
2451
+ },
2452
+ additionalProperties: false
2453
+ },
2454
+ exampleLanguage: {
2455
+ type: "string",
2456
+ enum: ["ts", "js", "tsx", "jsx", "shell", "json"]
2457
+ },
2458
+ example: {
2459
+ oneOf: [
2460
+ { type: "string" },
2461
+ {
2462
+ type: "object",
2463
+ required: ["code"],
2464
+ properties: {
2465
+ code: { type: "string" },
2466
+ title: { type: "string" },
2467
+ description: { type: "string" },
2468
+ language: { $ref: "#/$defs/exampleLanguage" }
2469
+ },
2470
+ additionalProperties: false
2471
+ }
2472
+ ]
2473
+ },
2474
+ visibility: {
2475
+ type: "string",
2476
+ enum: ["public", "protected", "private"]
2477
+ },
2478
+ member: {
2479
+ type: "object",
2480
+ properties: {
2481
+ id: { type: "string" },
2482
+ name: { type: "string" },
2483
+ kind: { type: "string" },
2484
+ description: { type: "string" },
2485
+ visibility: { $ref: "#/$defs/visibility" },
2486
+ tags: { type: "array", items: { $ref: "#/$defs/tag" } },
2487
+ flags: { type: "object", additionalProperties: true },
2488
+ schema: { $ref: "#/$defs/schema" },
2489
+ signatures: { type: "array", items: { $ref: "#/$defs/signature" } },
2490
+ decorators: { type: "array", items: { $ref: "#/$defs/decorator" } }
2491
+ }
2492
+ }
2493
+ }
2494
+ };
2145
2495
 
2146
2496
  // src/validate.ts
2147
- var LATEST_VERSION = "0.3.0";
2497
+ var LATEST_VERSION = "0.4.0";
2148
2498
  var schemas = {
2149
2499
  "0.1.0": openpkg_schema_default,
2150
2500
  "0.2.0": openpkg_schema_default2,
2151
- "0.3.0": openpkg_schema_default3
2501
+ "0.3.0": openpkg_schema_default3,
2502
+ "0.4.0": openpkg_schema_default4
2152
2503
  };
2153
2504
  var ajv = new Ajv({
2154
2505
  strict: false,
@@ -2213,8 +2564,5 @@ export {
2213
2564
  assertSpec,
2214
2565
  SCHEMA_VERSION,
2215
2566
  SCHEMA_URL,
2216
- JSON_SCHEMA_DRAFT,
2217
- DRIFT_CATEGORY_LABELS,
2218
- DRIFT_CATEGORY_DESCRIPTIONS,
2219
- DRIFT_CATEGORIES
2567
+ JSON_SCHEMA_DRAFT
2220
2568
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/spec",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Shared schema, validation, and diff utilities for OpenPkg specs",
5
5
  "keywords": [
6
6
  "openpkg",
@@ -734,10 +734,7 @@
734
734
  },
735
735
  "required": { "type": "array", "items": { "type": "string" } },
736
736
  "additionalProperties": {
737
- "oneOf": [
738
- { "type": "boolean" },
739
- { "type": "object", "additionalProperties": true }
740
- ]
737
+ "oneOf": [{ "type": "boolean" }, { "type": "object", "additionalProperties": true }]
741
738
  },
742
739
  "anyOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
743
740
  "allOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
@@ -0,0 +1,378 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/@openpkg-ts/spec/schemas/v0.4.0/openpkg.schema.json",
4
+ "title": "OpenPkg Specification v0.4.0",
5
+ "description": "Minimal tool-agnostic TypeScript export representation",
6
+ "type": "object",
7
+ "required": ["openpkg", "meta", "exports"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "Reference to the OpenPkg schema version"
12
+ },
13
+ "openpkg": {
14
+ "type": "string",
15
+ "const": "0.4.0"
16
+ },
17
+ "meta": {
18
+ "type": "object",
19
+ "required": ["name"],
20
+ "properties": {
21
+ "name": { "type": "string" },
22
+ "version": { "type": "string" },
23
+ "description": { "type": "string" },
24
+ "license": { "type": "string" },
25
+ "repository": { "type": "string" },
26
+ "ecosystem": { "type": "string" }
27
+ }
28
+ },
29
+ "exports": {
30
+ "type": "array",
31
+ "items": { "$ref": "#/$defs/export" }
32
+ },
33
+ "types": {
34
+ "type": "array",
35
+ "items": { "$ref": "#/$defs/typeDef" }
36
+ },
37
+ "examples": {
38
+ "type": "array",
39
+ "items": { "$ref": "#/$defs/example" }
40
+ },
41
+ "extensions": {
42
+ "type": "object",
43
+ "properties": {
44
+ "presentation": {
45
+ "type": "object",
46
+ "additionalProperties": { "$ref": "#/$defs/presentationMeta" }
47
+ }
48
+ },
49
+ "additionalProperties": true
50
+ },
51
+ "generation": {
52
+ "$ref": "#/$defs/generationMeta",
53
+ "description": "Optional generation metadata"
54
+ }
55
+ },
56
+ "$defs": {
57
+ "generationMeta": {
58
+ "type": "object",
59
+ "properties": {
60
+ "generator": { "type": "string" },
61
+ "timestamp": { "type": "string", "format": "date-time" }
62
+ }
63
+ },
64
+ "presentationMeta": {
65
+ "type": "object",
66
+ "properties": {
67
+ "slug": { "type": "string" },
68
+ "displayName": { "type": "string" },
69
+ "category": { "type": "string" },
70
+ "importPath": { "type": "string" },
71
+ "alias": { "type": "string" }
72
+ },
73
+ "additionalProperties": false
74
+ },
75
+ "export": {
76
+ "type": "object",
77
+ "required": ["id", "name", "kind"],
78
+ "properties": {
79
+ "id": { "type": "string" },
80
+ "name": { "type": "string" },
81
+ "kind": {
82
+ "type": "string",
83
+ "enum": [
84
+ "function",
85
+ "class",
86
+ "variable",
87
+ "interface",
88
+ "type",
89
+ "enum",
90
+ "module",
91
+ "namespace",
92
+ "reference",
93
+ "external"
94
+ ]
95
+ },
96
+ "description": { "type": "string" },
97
+ "examples": {
98
+ "type": "array",
99
+ "items": { "$ref": "#/$defs/example" }
100
+ },
101
+ "signatures": {
102
+ "type": "array",
103
+ "items": { "$ref": "#/$defs/signature" }
104
+ },
105
+ "type": { "type": "string" },
106
+ "schema": { "$ref": "#/$defs/schema" },
107
+ "members": {
108
+ "type": "array",
109
+ "items": { "$ref": "#/$defs/member" }
110
+ },
111
+ "extends": { "type": "string" },
112
+ "implements": {
113
+ "type": "array",
114
+ "items": { "type": "string" }
115
+ },
116
+ "tags": {
117
+ "type": "array",
118
+ "items": { "$ref": "#/$defs/tag" }
119
+ },
120
+ "source": { "$ref": "#/$defs/sourceLocation" },
121
+ "deprecated": { "type": "boolean" },
122
+ "flags": { "type": "object", "additionalProperties": true },
123
+ "typeParameters": {
124
+ "type": "array",
125
+ "items": { "$ref": "#/$defs/typeParameter" }
126
+ },
127
+ "typeAliasKind": { "$ref": "#/$defs/typeAliasKind" },
128
+ "conditionalType": { "$ref": "#/$defs/conditionalType" },
129
+ "mappedType": { "$ref": "#/$defs/mappedType" },
130
+ "decorators": {
131
+ "type": "array",
132
+ "items": { "$ref": "#/$defs/decorator" }
133
+ }
134
+ }
135
+ },
136
+ "typeDef": {
137
+ "type": "object",
138
+ "required": ["id", "name", "kind"],
139
+ "properties": {
140
+ "id": { "type": "string" },
141
+ "name": { "type": "string" },
142
+ "kind": {
143
+ "type": "string",
144
+ "enum": ["interface", "type", "enum", "class", "external"]
145
+ },
146
+ "description": { "type": "string" },
147
+ "schema": { "$ref": "#/$defs/schema" },
148
+ "type": { "type": "string" },
149
+ "members": {
150
+ "type": "array",
151
+ "items": { "$ref": "#/$defs/member" }
152
+ },
153
+ "extends": { "type": "string" },
154
+ "implements": {
155
+ "type": "array",
156
+ "items": { "type": "string" }
157
+ },
158
+ "tags": {
159
+ "type": "array",
160
+ "items": { "$ref": "#/$defs/tag" }
161
+ },
162
+ "source": { "$ref": "#/$defs/sourceLocation" },
163
+ "rawComments": { "type": "string" },
164
+ "typeAliasKind": { "$ref": "#/$defs/typeAliasKind" },
165
+ "conditionalType": { "$ref": "#/$defs/conditionalType" },
166
+ "mappedType": { "$ref": "#/$defs/mappedType" }
167
+ }
168
+ },
169
+ "tag": {
170
+ "type": "object",
171
+ "required": ["name", "text"],
172
+ "properties": {
173
+ "name": { "type": "string" },
174
+ "text": { "type": "string" }
175
+ },
176
+ "additionalProperties": false
177
+ },
178
+ "signature": {
179
+ "type": "object",
180
+ "properties": {
181
+ "parameters": {
182
+ "type": "array",
183
+ "items": { "$ref": "#/$defs/parameter" }
184
+ },
185
+ "returns": { "$ref": "#/$defs/returns" },
186
+ "description": { "type": "string" },
187
+ "typeParameters": {
188
+ "type": "array",
189
+ "items": { "$ref": "#/$defs/typeParameter" }
190
+ },
191
+ "overloadIndex": { "type": "integer", "minimum": 0 },
192
+ "isImplementation": { "type": "boolean" },
193
+ "throws": {
194
+ "type": "array",
195
+ "items": { "$ref": "#/$defs/throwsInfo" }
196
+ }
197
+ }
198
+ },
199
+ "typeParameter": {
200
+ "type": "object",
201
+ "required": ["name"],
202
+ "properties": {
203
+ "name": { "type": "string" },
204
+ "constraint": { "type": "string" },
205
+ "default": { "type": "string" }
206
+ }
207
+ },
208
+ "parameter": {
209
+ "type": "object",
210
+ "required": ["name"],
211
+ "properties": {
212
+ "name": { "type": "string" },
213
+ "required": { "type": "boolean" },
214
+ "schema": { "$ref": "#/$defs/schema" },
215
+ "description": { "type": "string" },
216
+ "default": {},
217
+ "rest": { "type": "boolean" },
218
+ "decorators": {
219
+ "type": "array",
220
+ "items": { "$ref": "#/$defs/decorator" }
221
+ }
222
+ }
223
+ },
224
+ "returns": {
225
+ "type": "object",
226
+ "properties": {
227
+ "schema": { "$ref": "#/$defs/schema" },
228
+ "description": { "type": "string" }
229
+ }
230
+ },
231
+ "schema": {
232
+ "oneOf": [
233
+ { "type": "string" },
234
+ { "type": "boolean" },
235
+ {
236
+ "type": "object",
237
+ "properties": {
238
+ "$schema": { "type": "string" },
239
+ "type": { "type": "string" },
240
+ "format": { "type": "string" },
241
+ "enum": { "type": "array" },
242
+ "const": {},
243
+ "items": { "$ref": "#/$defs/schema" },
244
+ "prefixedItems": {
245
+ "type": "array",
246
+ "items": { "$ref": "#/$defs/schema" }
247
+ },
248
+ "properties": {
249
+ "type": "object",
250
+ "additionalProperties": { "$ref": "#/$defs/schema" }
251
+ },
252
+ "required": { "type": "array", "items": { "type": "string" } },
253
+ "additionalProperties": {
254
+ "oneOf": [{ "type": "boolean" }, { "type": "object" }]
255
+ },
256
+ "anyOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
257
+ "allOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
258
+ "oneOf": { "type": "array", "items": { "$ref": "#/$defs/schema" } },
259
+ "$ref": { "type": "string" },
260
+ "discriminator": {
261
+ "type": "object",
262
+ "properties": { "propertyName": { "type": "string" } }
263
+ },
264
+ "description": { "type": "string" },
265
+ "default": {},
266
+ "minimum": { "type": "number" },
267
+ "maximum": { "type": "number" },
268
+ "exclusiveMinimum": { "type": "number" },
269
+ "exclusiveMaximum": { "type": "number" },
270
+ "minLength": { "type": "integer" },
271
+ "maxLength": { "type": "integer" },
272
+ "pattern": { "type": "string" },
273
+ "minItems": { "type": "integer" },
274
+ "maxItems": { "type": "integer" },
275
+ "uniqueItems": { "type": "boolean" },
276
+ "signatures": { "type": "array", "items": { "$ref": "#/$defs/signature" } }
277
+ }
278
+ }
279
+ ]
280
+ },
281
+ "sourceLocation": {
282
+ "type": "object",
283
+ "properties": {
284
+ "file": { "type": "string" },
285
+ "line": { "type": "integer", "minimum": 1 },
286
+ "url": { "type": "string" }
287
+ }
288
+ },
289
+ "typeAliasKind": {
290
+ "type": "string",
291
+ "enum": ["alias", "conditional", "mapped", "template-literal", "infer"]
292
+ },
293
+ "conditionalType": {
294
+ "type": "object",
295
+ "required": ["checkType", "extendsType", "trueType", "falseType"],
296
+ "properties": {
297
+ "checkType": { "type": "string" },
298
+ "extendsType": { "type": "string" },
299
+ "trueType": { "type": "string" },
300
+ "falseType": { "type": "string" }
301
+ },
302
+ "additionalProperties": false
303
+ },
304
+ "mappedType": {
305
+ "type": "object",
306
+ "required": ["typeParameter"],
307
+ "properties": {
308
+ "typeParameter": { "type": "string" },
309
+ "nameType": { "type": "string" },
310
+ "valueType": { "type": "string" },
311
+ "readonly": {
312
+ "oneOf": [{ "type": "boolean" }, { "enum": ["+", "-"] }]
313
+ },
314
+ "optional": {
315
+ "oneOf": [{ "type": "boolean" }, { "enum": ["+", "-"] }]
316
+ }
317
+ },
318
+ "additionalProperties": false
319
+ },
320
+ "decorator": {
321
+ "type": "object",
322
+ "required": ["name"],
323
+ "properties": {
324
+ "name": { "type": "string" },
325
+ "arguments": { "type": "array" },
326
+ "argumentsText": { "type": "array", "items": { "type": "string" } }
327
+ },
328
+ "additionalProperties": false
329
+ },
330
+ "throwsInfo": {
331
+ "type": "object",
332
+ "properties": {
333
+ "type": { "type": "string" },
334
+ "description": { "type": "string" }
335
+ },
336
+ "additionalProperties": false
337
+ },
338
+ "exampleLanguage": {
339
+ "type": "string",
340
+ "enum": ["ts", "js", "tsx", "jsx", "shell", "json"]
341
+ },
342
+ "example": {
343
+ "oneOf": [
344
+ { "type": "string" },
345
+ {
346
+ "type": "object",
347
+ "required": ["code"],
348
+ "properties": {
349
+ "code": { "type": "string" },
350
+ "title": { "type": "string" },
351
+ "description": { "type": "string" },
352
+ "language": { "$ref": "#/$defs/exampleLanguage" }
353
+ },
354
+ "additionalProperties": false
355
+ }
356
+ ]
357
+ },
358
+ "visibility": {
359
+ "type": "string",
360
+ "enum": ["public", "protected", "private"]
361
+ },
362
+ "member": {
363
+ "type": "object",
364
+ "properties": {
365
+ "id": { "type": "string" },
366
+ "name": { "type": "string" },
367
+ "kind": { "type": "string" },
368
+ "description": { "type": "string" },
369
+ "visibility": { "$ref": "#/$defs/visibility" },
370
+ "tags": { "type": "array", "items": { "$ref": "#/$defs/tag" } },
371
+ "flags": { "type": "object", "additionalProperties": true },
372
+ "schema": { "$ref": "#/$defs/schema" },
373
+ "signatures": { "type": "array", "items": { "$ref": "#/$defs/signature" } },
374
+ "decorators": { "type": "array", "items": { "$ref": "#/$defs/decorator" } }
375
+ }
376
+ }
377
+ }
378
+ }