@openpkg-ts/spec 0.1.0 → 0.2.2

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/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@openpkg-ts/spec",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "Shared schema, validation, and diff utilities for OpenPkg specs",
5
5
  "keywords": [
6
6
  "openpkg",
7
+ "doccov",
7
8
  "json-schema",
8
9
  "validation",
9
10
  "typescript",
10
11
  "spec"
11
12
  ],
12
- "homepage": "https://github.com/openpkg/openpkg#readme",
13
+ "homepage": "https://github.com/doccov/doccov#readme",
13
14
  "repository": {
14
15
  "type": "git",
15
- "url": "git+https://github.com/openpkg/openpkg.git",
16
+ "url": "git+https://github.com/doccov/doccov.git",
16
17
  "directory": "packages/spec"
17
18
  },
18
19
  "license": "MIT",
@@ -4,11 +4,7 @@
4
4
  "title": "OpenPkg Specification",
5
5
  "description": "Schema for OpenPkg specification files",
6
6
  "type": "object",
7
- "required": [
8
- "openpkg",
9
- "meta",
10
- "exports"
11
- ],
7
+ "required": ["openpkg", "meta", "exports"],
12
8
  "properties": {
13
9
  "$schema": {
14
10
  "type": "string",
@@ -24,9 +20,7 @@
24
20
  "meta": {
25
21
  "type": "object",
26
22
  "description": "Package metadata",
27
- "required": [
28
- "name"
29
- ],
23
+ "required": ["name"],
30
24
  "properties": {
31
25
  "name": {
32
26
  "type": "string",
@@ -50,14 +44,7 @@
50
44
  },
51
45
  "ecosystem": {
52
46
  "type": "string",
53
- "description": "Package ecosystem",
54
- "enum": [
55
- "js/ts",
56
- "python",
57
- "rust",
58
- "go",
59
- "java"
60
- ]
47
+ "description": "Package ecosystem"
61
48
  }
62
49
  }
63
50
  },
@@ -79,11 +66,7 @@
79
66
  "$defs": {
80
67
  "export": {
81
68
  "type": "object",
82
- "required": [
83
- "id",
84
- "name",
85
- "kind"
86
- ],
69
+ "required": ["id", "name", "kind"],
87
70
  "properties": {
88
71
  "id": {
89
72
  "type": "string",
@@ -93,17 +76,26 @@
93
76
  "type": "string",
94
77
  "description": "Export name"
95
78
  },
79
+ "slug": {
80
+ "type": "string",
81
+ "description": "Stable slug for linking"
82
+ },
83
+ "displayName": {
84
+ "type": "string",
85
+ "description": "UI-friendly label"
86
+ },
87
+ "category": {
88
+ "type": "string",
89
+ "description": "Grouping hint for navigation"
90
+ },
91
+ "importPath": {
92
+ "type": "string",
93
+ "description": "Recommended import path"
94
+ },
96
95
  "kind": {
97
96
  "type": "string",
98
97
  "description": "Kind of export",
99
- "enum": [
100
- "function",
101
- "class",
102
- "variable",
103
- "interface",
104
- "type",
105
- "enum"
106
- ]
98
+ "enum": ["function", "class", "variable", "interface", "type", "enum"]
107
99
  },
108
100
  "description": {
109
101
  "type": "string",
@@ -123,11 +115,26 @@
123
115
  "$ref": "#/$defs/signature"
124
116
  }
125
117
  },
126
- "properties": {
118
+ "type": {
119
+ "description": "Type reference or inline schema for variables",
120
+ "oneOf": [{ "type": "string" }, { "$ref": "#/$defs/schema" }]
121
+ },
122
+ "members": {
127
123
  "type": "array",
128
- "description": "Class/interface properties",
124
+ "description": "Class/interface/enum members",
125
+ "items": { "type": "object" }
126
+ },
127
+ "tags": {
128
+ "type": "array",
129
+ "description": "JSDoc/TSDoc tags",
129
130
  "items": {
130
- "$ref": "#/$defs/property"
131
+ "type": "object",
132
+ "required": ["name", "text"],
133
+ "properties": {
134
+ "name": { "type": "string" },
135
+ "text": { "type": "string" }
136
+ },
137
+ "additionalProperties": false
131
138
  }
132
139
  },
133
140
  "source": {
@@ -137,11 +144,7 @@
137
144
  },
138
145
  "typeDef": {
139
146
  "type": "object",
140
- "required": [
141
- "id",
142
- "name",
143
- "kind"
144
- ],
147
+ "required": ["id", "name", "kind"],
145
148
  "properties": {
146
149
  "id": {
147
150
  "type": "string",
@@ -151,15 +154,26 @@
151
154
  "type": "string",
152
155
  "description": "Type name"
153
156
  },
157
+ "slug": {
158
+ "type": "string",
159
+ "description": "Stable slug for linking"
160
+ },
161
+ "displayName": {
162
+ "type": "string",
163
+ "description": "UI-friendly label"
164
+ },
165
+ "category": {
166
+ "type": "string",
167
+ "description": "Grouping hint for navigation"
168
+ },
169
+ "importPath": {
170
+ "type": "string",
171
+ "description": "Recommended import path"
172
+ },
154
173
  "kind": {
155
174
  "type": "string",
156
175
  "description": "Kind of type definition",
157
- "enum": [
158
- "interface",
159
- "type",
160
- "enum",
161
- "class"
162
- ]
176
+ "enum": ["interface", "type", "enum", "class"]
163
177
  },
164
178
  "description": {
165
179
  "type": "string",
@@ -172,11 +186,22 @@
172
186
  "type": "string",
173
187
  "description": "Type expression for type aliases"
174
188
  },
175
- "properties": {
189
+ "members": {
176
190
  "type": "array",
177
- "description": "Properties for interfaces/classes",
191
+ "description": "Members for classes/interfaces/enums",
192
+ "items": { "type": "object" }
193
+ },
194
+ "tags": {
195
+ "type": "array",
196
+ "description": "JSDoc/TSDoc tags",
178
197
  "items": {
179
- "$ref": "#/$defs/property"
198
+ "type": "object",
199
+ "required": ["name", "text"],
200
+ "properties": {
201
+ "name": { "type": "string" },
202
+ "text": { "type": "string" }
203
+ },
204
+ "additionalProperties": false
180
205
  }
181
206
  },
182
207
  "source": {
@@ -204,10 +229,7 @@
204
229
  },
205
230
  "parameter": {
206
231
  "type": "object",
207
- "required": [
208
- "name",
209
- "required"
210
- ],
232
+ "required": ["name", "required"],
211
233
  "properties": {
212
234
  "name": {
213
235
  "type": "string",
@@ -217,10 +239,6 @@
217
239
  "type": "boolean",
218
240
  "description": "Whether the parameter is required"
219
241
  },
220
- "description": {
221
- "type": "string",
222
- "description": "Parameter description"
223
- },
224
242
  "schema": {
225
243
  "$ref": "#/$defs/schema"
226
244
  }
@@ -238,30 +256,6 @@
238
256
  }
239
257
  }
240
258
  },
241
- "property": {
242
- "type": "object",
243
- "required": [
244
- "name",
245
- "required"
246
- ],
247
- "properties": {
248
- "name": {
249
- "type": "string",
250
- "description": "Property name"
251
- },
252
- "required": {
253
- "type": "boolean",
254
- "description": "Whether the property is required"
255
- },
256
- "description": {
257
- "type": "string",
258
- "description": "Property description"
259
- },
260
- "schema": {
261
- "$ref": "#/$defs/schema"
262
- }
263
- }
264
- },
265
259
  "schema": {
266
260
  "anyOf": [
267
261
  {
@@ -276,17 +270,13 @@
276
270
  "pattern": "^#/types/[A-Za-z0-9_.-]+$"
277
271
  }
278
272
  },
279
- "required": [
280
- "$ref"
281
- ],
273
+ "required": ["$ref"],
282
274
  "additionalProperties": false
283
275
  },
284
276
  {
285
277
  "type": "object",
286
278
  "not": {
287
- "required": [
288
- "$ref"
289
- ]
279
+ "required": ["$ref"]
290
280
  },
291
281
  "additionalProperties": true
292
282
  }
@@ -294,10 +284,7 @@
294
284
  },
295
285
  "sourceLocation": {
296
286
  "type": "object",
297
- "required": [
298
- "file",
299
- "line"
300
- ],
287
+ "required": ["file", "line"],
301
288
  "properties": {
302
289
  "file": {
303
290
  "type": "string",
@@ -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.2.0/openpkg.schema.json",
4
+ "title": "OpenPkg Specification",
5
+ "description": "Schema for OpenPkg specification files",
6
+ "type": "object",
7
+ "required": ["openpkg", "meta", "exports"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "Reference to the OpenPkg schema version",
12
+ "pattern": "^(https://raw\\.githubusercontent\\.com/ryanwaits/openpkg/main/schemas/v[0-9]+\\.[0-9]+\\.[0-9]+/openpkg\\.schema\\.json|https://unpkg\\.com/@openpkg-ts/spec/schemas/v[0-9]+\\.[0-9]+\\.[0-9]+/openpkg\\.schema\\.json)$"
13
+ },
14
+ "openpkg": {
15
+ "type": "string",
16
+ "description": "OpenPkg specification version",
17
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
18
+ "const": "0.2.0"
19
+ },
20
+ "meta": {
21
+ "type": "object",
22
+ "description": "Package metadata",
23
+ "required": ["name"],
24
+ "properties": {
25
+ "name": {
26
+ "type": "string",
27
+ "description": "Package name"
28
+ },
29
+ "version": {
30
+ "type": "string",
31
+ "description": "Package version"
32
+ },
33
+ "description": {
34
+ "type": "string",
35
+ "description": "Package description"
36
+ },
37
+ "license": {
38
+ "type": "string",
39
+ "description": "Package license"
40
+ },
41
+ "repository": {
42
+ "type": "string",
43
+ "description": "Repository URL"
44
+ },
45
+ "ecosystem": {
46
+ "type": "string",
47
+ "description": "Package ecosystem"
48
+ }
49
+ }
50
+ },
51
+ "exports": {
52
+ "type": "array",
53
+ "description": "List of exported items",
54
+ "items": {
55
+ "$ref": "#/$defs/export"
56
+ }
57
+ },
58
+ "types": {
59
+ "type": "array",
60
+ "description": "List of type definitions",
61
+ "items": {
62
+ "$ref": "#/$defs/typeDef"
63
+ }
64
+ },
65
+ "docs": {
66
+ "$ref": "#/$defs/docsMetadata",
67
+ "description": "Aggregate documentation coverage metadata"
68
+ }
69
+ },
70
+ "$defs": {
71
+ "docSignal": {
72
+ "type": "string",
73
+ "enum": ["description", "params", "returns", "examples"]
74
+ },
75
+ "docDrift": {
76
+ "type": "object",
77
+ "required": ["type", "issue"],
78
+ "properties": {
79
+ "type": {
80
+ "type": "string",
81
+ "enum": [
82
+ "param-mismatch",
83
+ "param-type-mismatch",
84
+ "return-type-mismatch",
85
+ "generic-constraint-mismatch",
86
+ "optionality-mismatch",
87
+ "deprecated-mismatch",
88
+ "visibility-mismatch",
89
+ "example-drift",
90
+ "broken-link"
91
+ ]
92
+ },
93
+ "target": {
94
+ "type": "string",
95
+ "description": "Relevant identifier (e.g., parameter name)"
96
+ },
97
+ "issue": {
98
+ "type": "string",
99
+ "description": "Human-friendly drift explanation"
100
+ },
101
+ "suggestion": {
102
+ "type": "string",
103
+ "description": "Optional remediation hint"
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ },
108
+ "docsMetadata": {
109
+ "type": "object",
110
+ "description": "Documentation coverage metadata",
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "coverageScore": {
114
+ "type": "number",
115
+ "minimum": 0,
116
+ "maximum": 100,
117
+ "description": "Documentation coverage value from 0-100."
118
+ },
119
+ "missing": {
120
+ "type": "array",
121
+ "description": "Doc components missing for this entity",
122
+ "items": {
123
+ "$ref": "#/$defs/docSignal"
124
+ },
125
+ "uniqueItems": true
126
+ },
127
+ "drift": {
128
+ "type": "array",
129
+ "description": "Detected documentation drift signals",
130
+ "items": {
131
+ "$ref": "#/$defs/docDrift"
132
+ }
133
+ }
134
+ }
135
+ },
136
+ "export": {
137
+ "type": "object",
138
+ "required": ["id", "name", "kind"],
139
+ "properties": {
140
+ "id": {
141
+ "type": "string",
142
+ "description": "Unique identifier for the export"
143
+ },
144
+ "name": {
145
+ "type": "string",
146
+ "description": "Export name"
147
+ },
148
+ "slug": {
149
+ "type": "string",
150
+ "description": "Stable slug for linking"
151
+ },
152
+ "displayName": {
153
+ "type": "string",
154
+ "description": "UI-friendly label"
155
+ },
156
+ "category": {
157
+ "type": "string",
158
+ "description": "Grouping hint for navigation"
159
+ },
160
+ "importPath": {
161
+ "type": "string",
162
+ "description": "Recommended import path"
163
+ },
164
+ "kind": {
165
+ "type": "string",
166
+ "description": "Kind of export",
167
+ "enum": ["function", "class", "variable", "interface", "type", "enum"]
168
+ },
169
+ "description": {
170
+ "type": "string",
171
+ "description": "JSDoc/TSDoc description"
172
+ },
173
+ "examples": {
174
+ "type": "array",
175
+ "description": "Usage examples from documentation",
176
+ "items": {
177
+ "type": "string"
178
+ }
179
+ },
180
+ "signatures": {
181
+ "type": "array",
182
+ "description": "Function/method signatures",
183
+ "items": {
184
+ "$ref": "#/$defs/signature"
185
+ }
186
+ },
187
+ "type": {
188
+ "description": "Type reference or inline schema for variables",
189
+ "oneOf": [{ "type": "string" }, { "$ref": "#/$defs/schema" }]
190
+ },
191
+ "members": {
192
+ "type": "array",
193
+ "description": "Class/interface/enum members",
194
+ "items": { "type": "object" }
195
+ },
196
+ "tags": {
197
+ "type": "array",
198
+ "description": "JSDoc/TSDoc tags",
199
+ "items": {
200
+ "type": "object",
201
+ "required": ["name", "text"],
202
+ "properties": {
203
+ "name": { "type": "string" },
204
+ "text": { "type": "string" }
205
+ },
206
+ "additionalProperties": false
207
+ }
208
+ },
209
+ "source": {
210
+ "$ref": "#/$defs/sourceLocation"
211
+ },
212
+ "docs": {
213
+ "$ref": "#/$defs/docsMetadata",
214
+ "description": "Documentation coverage metadata for this export"
215
+ }
216
+ }
217
+ },
218
+ "typeDef": {
219
+ "type": "object",
220
+ "required": ["id", "name", "kind"],
221
+ "properties": {
222
+ "id": {
223
+ "type": "string",
224
+ "description": "Unique identifier for the type"
225
+ },
226
+ "name": {
227
+ "type": "string",
228
+ "description": "Type name"
229
+ },
230
+ "slug": {
231
+ "type": "string",
232
+ "description": "Stable slug for linking"
233
+ },
234
+ "displayName": {
235
+ "type": "string",
236
+ "description": "UI-friendly label"
237
+ },
238
+ "category": {
239
+ "type": "string",
240
+ "description": "Grouping hint for navigation"
241
+ },
242
+ "importPath": {
243
+ "type": "string",
244
+ "description": "Recommended import path"
245
+ },
246
+ "kind": {
247
+ "type": "string",
248
+ "description": "Kind of type definition",
249
+ "enum": ["interface", "type", "enum", "class"]
250
+ },
251
+ "description": {
252
+ "type": "string",
253
+ "description": "JSDoc/TSDoc description"
254
+ },
255
+ "schema": {
256
+ "$ref": "#/$defs/schema"
257
+ },
258
+ "type": {
259
+ "type": "string",
260
+ "description": "Type expression for type aliases"
261
+ },
262
+ "members": {
263
+ "type": "array",
264
+ "description": "Members for classes/interfaces/enums",
265
+ "items": { "type": "object" }
266
+ },
267
+ "tags": {
268
+ "type": "array",
269
+ "description": "JSDoc/TSDoc tags",
270
+ "items": {
271
+ "type": "object",
272
+ "required": ["name", "text"],
273
+ "properties": {
274
+ "name": { "type": "string" },
275
+ "text": { "type": "string" }
276
+ },
277
+ "additionalProperties": false
278
+ }
279
+ },
280
+ "source": {
281
+ "$ref": "#/$defs/sourceLocation"
282
+ }
283
+ }
284
+ },
285
+ "signature": {
286
+ "type": "object",
287
+ "properties": {
288
+ "parameters": {
289
+ "type": "array",
290
+ "items": {
291
+ "$ref": "#/$defs/parameter"
292
+ }
293
+ },
294
+ "returns": {
295
+ "$ref": "#/$defs/returns"
296
+ },
297
+ "description": {
298
+ "type": "string",
299
+ "description": "Signature-level description"
300
+ }
301
+ }
302
+ },
303
+ "parameter": {
304
+ "type": "object",
305
+ "required": ["name", "required"],
306
+ "properties": {
307
+ "name": {
308
+ "type": "string",
309
+ "description": "Parameter name"
310
+ },
311
+ "required": {
312
+ "type": "boolean",
313
+ "description": "Whether the parameter is required"
314
+ },
315
+ "schema": {
316
+ "$ref": "#/$defs/schema"
317
+ },
318
+ "description": {
319
+ "type": "string",
320
+ "description": "Parameter description"
321
+ }
322
+ }
323
+ },
324
+ "returns": {
325
+ "type": "object",
326
+ "properties": {
327
+ "schema": {
328
+ "$ref": "#/$defs/schema"
329
+ },
330
+ "description": {
331
+ "type": "string",
332
+ "description": "Return value description"
333
+ }
334
+ }
335
+ },
336
+ "schema": {
337
+ "anyOf": [
338
+ {
339
+ "type": "boolean"
340
+ },
341
+ {
342
+ "type": "object",
343
+ "properties": {
344
+ "$ref": {
345
+ "type": "string",
346
+ "description": "Reference to another type",
347
+ "pattern": "^#/types/[A-Za-z0-9_.-]+$"
348
+ }
349
+ },
350
+ "required": ["$ref"],
351
+ "additionalProperties": false
352
+ },
353
+ {
354
+ "type": "object",
355
+ "not": {
356
+ "required": ["$ref"]
357
+ },
358
+ "additionalProperties": true
359
+ }
360
+ ]
361
+ },
362
+ "sourceLocation": {
363
+ "type": "object",
364
+ "required": ["file", "line"],
365
+ "properties": {
366
+ "file": {
367
+ "type": "string",
368
+ "description": "Source file path"
369
+ },
370
+ "line": {
371
+ "type": "integer",
372
+ "description": "Line number in source file",
373
+ "minimum": 1
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }