@hia-doc/htmdoc-spec 0.1.0 → 1.0.0-rc.1

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.
@@ -1,48 +1,27 @@
1
+ import { validateHtmDocExtraction } from "./compatibility.mjs";
2
+
1
3
  /**
2
- * Owner-local contract identity for HTMDoc output conformance summaries.
3
- *
4
- * 中文:HTMDoc 输出 conformance summary 的 owner-local contract identity。
5
- * English: Owner-local contract identity for HTMDoc output conformance summaries.
4
+ * @lang zh-CN HTML文档输出一致性摘要使用的所属模块契约身份。
5
+ * @lang en Owner-local contract identity for HTML documentation output conformance summaries.
6
6
  */
7
7
  export const HTMDOC_OUTPUT_CONFORMANCE_CONTRACT = "htmdoc-output-conformance";
8
8
 
9
9
  /**
10
- * Frozen draft version for the owner-local HTMDoc output conformance result.
11
- *
12
- * 中文:HTMDoc owner-local 输出 conformance result 的冻结 draft version。
13
- * English: Frozen draft version for the owner-local HTMDoc output conformance result.
10
+ * @lang zh-CN HTML文档输出一致性结果使用的所属模块冻结草案版本。
11
+ * @lang en Frozen draft version for the owner-local HTML documentation output conformance result.
14
12
  */
15
13
  export const HTMDOC_OUTPUT_CONFORMANCE_VERSION = "0.1.0-draft";
14
+ /** @lang zh-CN 复用包内纯数据定义的同一冻结对象。 @lang en Reuses the same frozen objects from owner-local plain-data definitions. */
15
+ import {HTMDOC_OUTPUT_CONFORMANCE_CODES} from './output-conformance-arrays.mjs';
16
+ export {HTMDOC_OUTPUT_CONFORMANCE_CODES};
16
17
 
17
18
  /**
18
- * Public-safe violation codes emitted by the HTMDoc output conformance evaluator.
19
- *
20
- * 中文:HTMDoc 输出 conformance evaluator 发出的 public-safe violation codes。
21
- * English: Public-safe violation codes emitted by the HTMDoc output conformance evaluator.
22
- * @lang zh-CN code 只描述 artifact boundary;绝不回显 source text、absolute path、private sidecar locator 或 caller supplied value。
23
- */
24
- export const HTMDOC_OUTPUT_CONFORMANCE_CODES = Object.freeze([
25
- "HTMDOC_OUTPUT_CONFORMANCE_INPUT_INVALID",
26
- "HTMDOC_OUTPUT_CONFORMANCE_EXTRACTION_INVALID",
27
- "HTMDOC_OUTPUT_CONFORMANCE_DOCUMENT_INVALID",
28
- "HTMDOC_OUTPUT_CONFORMANCE_RELATION_INVALID",
29
- "HTMDOC_OUTPUT_CONFORMANCE_PROVENANCE_INVALID",
30
- "HTMDOC_OUTPUT_CONFORMANCE_SOURCE_POLICY_INVALID",
31
- "HTMDOC_OUTPUT_CONFORMANCE_EMBED_UNAUTHORIZED",
32
- "HTMDOC_OUTPUT_CONFORMANCE_SIDECAR_BOUNDARY_INVALID",
33
- "HTMDOC_OUTPUT_CONFORMANCE_PRODUCER_RESULT_INVALID"
34
- ]);
35
-
36
- /**
37
- * Evaluate whether already-materialized HTMDoc artifacts preserve the owner-local P1 output boundary.
38
- *
39
- * 中文:评估已经 materialized 的 HTMDoc artifact 是否保持 owner-local P1 output boundary。
40
- * English: Evaluate whether already-materialized HTMDoc artifacts preserve the owner-local P1 output boundary.
41
- *
19
+ * @lang zh-CN 评估已物化的HTML文档工件是否保持所属模块的既有输出边界。函数仅比较调用方提供的JSON记录,输入排除文件路径、工作区根、源码正文、网络及侧车路径,计算过程无写入。
20
+ * @lang en Evaluates whether already-materialized HTML documentation artifacts preserve the existing owner-local output boundary. It compares only caller-provided JSON records, accepts no file paths, workspace root, source text, network or sidecar paths, and performs no writes.
42
21
  * @param {unknown} artifacts <lang><zh-CN>extraction、HIA document、ordinary doc-source-map 与 producer result 的固定 bundle。</zh-CN><en>Fixed bundle containing extraction, HIA document, ordinary doc-source-map, and producer result.</en></lang>
43
- * @param {{allowEmbeddedSource?: boolean}} [options] <lang><zh-CN>只允许 caller 显式确认 `embed`;缺省保持 `none`/`reference` 不嵌入。</zh-CN><en>Only permits `embed` after explicit caller confirmation; the default keeps `none`/`reference` unembedded.</en></lang>
22
+ * @param {Object} [options] <lang><zh-CN>调用方显式内容策略。</zh-CN><en>Explicit caller content policy.</en></lang>
23
+ * @param {boolean} [options.allowEmbeddedSource=false] <lang><zh-CN>只允许 caller 显式确认 `embed`;缺省保持 `none`/`reference` 不嵌入。</zh-CN><en>Only permits `embed` after explicit caller confirmation; the default keeps `none`/`reference` unembedded.</en></lang>
44
24
  * @returns {{contract:string,contractVersion:string,conformant:boolean,violations:Array<{code:string,message:string}>}} <lang><zh-CN>不含 artifact 内容的确定性 summary。</zh-CN><en>Deterministic summary containing no artifact content.</en></lang>
45
- * @lang zh-CN 函数只比较 caller 已提供的 JSON records;不接收文件路径、workspace root、source text、network 或 sidecar path,也不会产生写入。
46
25
  */
47
26
  export function evaluateHtmDocOutputConformance(artifacts, options = {}) {
48
27
  // <lang><zh-CN>violation 仅累积固定 code/message,避免诊断把不可信 artifact 字段回显到 public output。</zh-CN><en>Violations accumulate only fixed code/message pairs so diagnostics never echo untrusted artifact fields into public output.</en></lang>
@@ -107,7 +86,7 @@ function createSummary(violations) {
107
86
  */
108
87
  function validateExtraction(extraction, violations) {
109
88
  // <lang><zh-CN>contract/version/symbols/source 是所有 downstream projection 的最小连续性锚点。</zh-CN><en>Contract/version/symbols/source are the minimum continuity anchors for every downstream projection.</en></lang>
110
- if (!extraction || extraction.contract !== "hia-htmdoc-extraction" || extraction.contractVersion !== "0.1.0-draft" || !Array.isArray(extraction.symbols) || !isRecord(extraction.source)) {
89
+ if (!extraction || validateHtmDocExtraction(extraction).length || extraction.contract !== "hia-htmdoc-extraction" || !["0.1.0-draft", "1.0.0"].includes(extraction.contractVersion) || !Array.isArray(extraction.symbols) || !isRecord(extraction.source)) {
111
90
  addViolation(violations, "HTMDOC_OUTPUT_CONFORMANCE_EXTRACTION_INVALID", "HTMDoc extraction must expose the supported contract, version, source, and symbols.");
112
91
  return false;
113
92
  }
@@ -156,10 +135,16 @@ function validateDocument(document, extraction, violations) {
156
135
  */
157
136
  function validateDocSourceMap(docSourceMap, extraction, allowEmbeddedSource, violations) {
158
137
  // <lang><zh-CN>普通 map 必须保留 explicit sources/artifacts/chains/entries;它仍不是完整 capability model。</zh-CN><en>An ordinary map must retain explicit sources/artifacts/chains/entries; it is still not a full capability model.</en></lang>
159
- if (!docSourceMap || docSourceMap.contract !== "doc-source-map" || docSourceMap.contractVersion !== "0.1.0-draft" || !Array.isArray(docSourceMap.sources) || !Array.isArray(docSourceMap.artifacts) || !Array.isArray(docSourceMap.chains) || !Array.isArray(docSourceMap.entries) || !extraction) {
138
+ if (!docSourceMap || docSourceMap.contract !== "doc-source-map" || !["0.1.0-draft", "1.1.0"].includes(docSourceMap.contractVersion) || !Array.isArray(docSourceMap.sources) || !Array.isArray(docSourceMap.artifacts) || !Array.isArray(docSourceMap.chains) || !Array.isArray(docSourceMap.entries) || !extraction) {
160
139
  addViolation(violations, "HTMDOC_OUTPUT_CONFORMANCE_PROVENANCE_INVALID", "HTMDoc doc-source-map must retain the supported ordinary-map identity and relation arrays.");
161
140
  return false;
162
141
  }
142
+ // <lang><zh-CN>新版逐引用范围必须声明完整约定;旧版原样读取,不把后来的语义套进历史工件。</zh-CN><en>Current ranged references must declare complete conventions; legacy input remains readable under its historical semantics.</en></lang>
143
+ if (docSourceMap.contractVersion === "1.1.0" && !docSourceMap.entries.every((entry) =>
144
+ Array.isArray(entry?.sourceRefs) && entry.sourceRefs.every(isValidCurrentSourceRef))) {
145
+ addViolation(violations, "HTMDOC_OUTPUT_CONFORMANCE_PROVENANCE_INVALID", "HTMDoc current doc-source-map must declare each ranged source reference convention.");
146
+ return false;
147
+ }
163
148
  // <lang><zh-CN>HTMDoc P1 尚未生产 metadata sidecar;任何未审核 sidecar field 都必须拒绝,防止私有 locator 或 body 偷渡。</zh-CN><en>HTMDoc P1 does not produce metadata sidecars; reject any unreviewed sidecar field to prevent private locators or bodies from bypassing review.</en></lang>
164
149
  const sidecarKeys = Object.keys(docSourceMap).filter((key) => key.toLocaleLowerCase("en-US").includes("sidecar"));
165
150
  if (sidecarKeys.length > 0 || Object.hasOwn(docSourceMap, "capabilities") || Object.hasOwn(docSourceMap, "capability") || Object.hasOwn(docSourceMap, "outputCapabilities")) {
@@ -188,6 +173,28 @@ function validateDocSourceMap(docSourceMap, extraction, allowEmbeddedSource, vio
188
173
  return true;
189
174
  }
190
175
 
176
+ /**
177
+ * @param {unknown} value <lang><zh-CN>新版映射内的一条来源引用。</zh-CN><en>One source reference from a current map.</en></lang>
178
+ * @returns {boolean} <lang><zh-CN>范围与约定的双向存在性、闭集值及列精度一致时为真。</zh-CN><en>True when range and convention presence, closed values, and column precision agree.</en></lang>
179
+ * @lang zh-CN 这是 HTMDoc owner-local 的最小输出门禁,完整通用契约仍由共享 schema/reader 验收。
180
+ * @lang en This is HTMDoc's minimal owner-local output gate; the shared schema and reader remain the full general contract gate.
181
+ */
182
+ function isValidCurrentSourceRef(value) {
183
+ if (!isRecord(value)) return false;
184
+ const hasRange = Object.hasOwn(value, "range");
185
+ const hasConvention = Object.hasOwn(value, "rangeConvention");
186
+ if (hasRange !== hasConvention) return false;
187
+ if (!hasRange) return true;
188
+ const convention = value.rangeConvention;
189
+ if (!isRecord(convention) || Object.keys(convention).length !== 2
190
+ || !["inclusive", "exclusive", "unknown"].includes(convention.endBoundary)
191
+ || !["utf16-code-unit", "unicode-code-point", "byte", "unknown"].includes(convention.columnUnit)) return false;
192
+ if (convention.columnUnit === "unknown") return true;
193
+ const range = value.range;
194
+ return Number.isSafeInteger(range?.start?.column) && range.start.column > 0
195
+ && Number.isSafeInteger(range?.end?.column) && range.end.column > 0;
196
+ }
197
+
191
198
  /**
192
199
  * Validate symbol, entry, artifact, and chain continuity without relying on array ordering outside the map contract.
193
200
  *
@@ -246,8 +253,9 @@ function validateArtifactRelations(extraction, document, docSourceMap, violation
246
253
  function validateProducerResult(producerResult, docSourceMap, violations) {
247
254
  // <lang><zh-CN>result metadata 是 target consumer 看到的 delivery boundary;它不能以 failed/partial 状态假装 conformance 成功。</zh-CN><en>Result metadata is the delivery boundary seen by target consumers; a failed or partial state cannot masquerade as conformance success.</en></lang>
248
255
  const artifacts = Array.isArray(producerResult?.artifacts) ? producerResult.artifacts.filter(isRecord) : [];
256
+ // <lang><zh-CN>实现身份独立于结果契约;精确接受已确认 1.0.0 与历史 draft,不按 semver 猜未来兼容。</zh-CN><en>Implementation identity is independent from the result contract; accept exactly confirmed 1.0.0 and the historical draft without guessing future semver compatibility.</en></lang>
249
257
  const producer = isRecord(producerResult?.producer) ? producerResult.producer : undefined;
250
- if (!producerResult || producerResult.contract !== "documentation-producer-result" || producerResult.contractVersion !== "0.1.0-draft" || producer?.id !== "htmdoc" || producerResult.status !== "success" || artifacts.length === 0 || !docSourceMap) {
258
+ if (!producerResult || producerResult.contract !== "documentation-producer-result" || !["0.1.0-draft", "1.0.0"].includes(producerResult.contractVersion) || producer?.id !== "htmdoc" || producerResult.status !== "success" || artifacts.length === 0 || !docSourceMap) {
251
259
  addViolation(violations, "HTMDOC_OUTPUT_CONFORMANCE_PRODUCER_RESULT_INVALID", "HTMDoc producer result must expose the successful supported contract and delivery metadata.");
252
260
  return;
253
261
  }
@@ -256,7 +264,9 @@ function validateProducerResult(producerResult, docSourceMap, violations) {
256
264
  const hasRequiredKinds = ["htmdoc-extraction", "hia-document", "doc-source-map"].every((kind) => artifacts.some((artifact) => artifact.kind === kind));
257
265
  const mapArtifact = artifacts.find((artifact) => artifact.kind === "doc-source-map");
258
266
  const mapPathMatches = mapArtifact && docSourceMap.artifacts.filter(isRecord).every((artifact) => isSafeRelativePath(artifact.path));
259
- if (!pathsAreSafe || !hasRequiredKinds || !mapPathMatches) {
267
+ // <lang><zh-CN>分发清单版本必须与实际映射相同,避免消费方按错误 schema 解释逐引用约定。</zh-CN><en>The delivery manifest version must match the actual map so consumers cannot interpret per-reference conventions under the wrong schema.</en></lang>
268
+ const mapVersionMatches = mapArtifact?.contractVersion === docSourceMap.contractVersion;
269
+ if (!pathsAreSafe || !hasRequiredKinds || !mapPathMatches || !mapVersionMatches) {
260
270
  addViolation(violations, "HTMDOC_OUTPUT_CONFORMANCE_PRODUCER_RESULT_INVALID", "HTMDoc producer result must deliver the extraction, HIA document, and ordinary doc-source-map through safe relative artifacts.");
261
271
  }
262
272
  }
@@ -286,7 +296,7 @@ function addViolation(violations, code, message) {
286
296
  * English: Determine whether a candidate is an object record suitable for fixed-field inspection.
287
297
  *
288
298
  * @param {unknown} value <lang><zh-CN>未受信任值。</zh-CN><en>Untrusted value.</en></lang>
289
- * @returns {value is Record<string, unknown>} <lang><zh-CN>record type guard。</zh-CN><en>Record type guard.</en></lang>
299
+ * @returns {boolean} <lang><zh-CN>是否为非null、非数组的record,不改变候选值。</zh-CN><en>Whether the value is a non-null, non-array record, without changing it.</en></lang>
290
300
  */
291
301
  function isRecord(value) {
292
302
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -299,7 +309,7 @@ function isRecord(value) {
299
309
  * English: Determine whether a candidate is a non-empty string identity.
300
310
  *
301
311
  * @param {unknown} value <lang><zh-CN>未受信任 identity candidate。</zh-CN><en>Untrusted identity candidate.</en></lang>
302
- * @returns {value is string} <lang><zh-CN>是否可用作 stable identity。</zh-CN><en>Whether it can serve as a stable identity.</en></lang>
312
+ * @returns {boolean} <lang><zh-CN>是否为可用作stable identity的字符串。</zh-CN><en>Whether the value is a string usable as a stable identity.</en></lang>
303
313
  */
304
314
  function isNonEmptyString(value) {
305
315
  return typeof value === "string" && value.trim().length > 0;
@@ -0,0 +1,182 @@
1
+ export const HTMDOC_EXTRACTION_CONTRACT = "hia-htmdoc-extraction";
2
+ export const HTMDOC_EXTRACTION_CONTRACT_VERSION = "0.1.0-draft";
3
+ export const HTMDOC_EXTRACTION_SCHEMA_ID = "https://hia-doc.local/schema/hia-htmdoc-extraction-0.1.0-draft.json";
4
+ export const HTMDOC_PROFILE_VERSION = "0.1.0-draft";
5
+
6
+ /**
7
+ * Owner-local output conformance evaluator for already-generated HTMDoc artifacts.
8
+ *
9
+ * 中文:针对已生成 HTMDoc artifact 的 owner-local output conformance evaluator。
10
+ * English: Owner-local output conformance evaluator for already-generated HTMDoc artifacts.
11
+ * @lang zh-CN 该 evaluator 不读取 source、不写入 artifact,也不成为跨仓 runtime capability schema。
12
+ */
13
+ export {
14
+ evaluateHtmDocOutputConformance,
15
+ HTMDOC_OUTPUT_CONFORMANCE_CODES,
16
+ HTMDOC_OUTPUT_CONFORMANCE_CONTRACT,
17
+ HTMDOC_OUTPUT_CONFORMANCE_VERSION
18
+ } from "./output-conformance.mjs";
19
+
20
+ export const HTMDOC_SYMBOL_KINDS = Object.freeze({
21
+ component: "html-component",
22
+ element: "html-element",
23
+ template: "html-template",
24
+ attribute: "html-attribute",
25
+ slot: "html-slot",
26
+ event: "html-event",
27
+ styleHook: "html-style-hook",
28
+ a11yNote: "html-a11y-note",
29
+ example: "html-example"
30
+ });
31
+
32
+ export const HTMDOC_TAGS = Object.freeze([
33
+ "component",
34
+ "element",
35
+ "template",
36
+ "attr",
37
+ "slot",
38
+ "event",
39
+ "stylehook",
40
+ "a11y",
41
+ "description",
42
+ "example",
43
+ "lang"
44
+ ]);
45
+
46
+ export const HTMDOC_EXTRACTION_JSON_SCHEMA = Object.freeze({
47
+ $schema: "https://json-schema.org/draft/2020-12/schema",
48
+ $id: HTMDOC_EXTRACTION_SCHEMA_ID,
49
+ type: "object",
50
+ required: ["contract", "contractVersion", "producer", "profile", "source", "symbols", "annotations", "diagnostics", "sourceMap"],
51
+ additionalProperties: true,
52
+ properties: {
53
+ contract: { const: HTMDOC_EXTRACTION_CONTRACT },
54
+ contractVersion: { const: HTMDOC_EXTRACTION_CONTRACT_VERSION },
55
+ producer: { $ref: "#/$defs/producer" },
56
+ profile: { $ref: "#/$defs/profile" },
57
+ source: { $ref: "#/$defs/source" },
58
+ symbols: {
59
+ type: "array",
60
+ items: { $ref: "#/$defs/symbol" }
61
+ },
62
+ annotations: {
63
+ type: "array",
64
+ items: { type: "object" }
65
+ },
66
+ diagnostics: {
67
+ type: "array",
68
+ items: { $ref: "#/$defs/diagnostic" }
69
+ },
70
+ sourceMap: { type: "object" },
71
+ metadata: { type: "object" }
72
+ },
73
+ $defs: {
74
+ nonEmptyString: { type: "string", minLength: 1 },
75
+ producer: {
76
+ type: "object",
77
+ required: ["name", "version"],
78
+ additionalProperties: true,
79
+ properties: {
80
+ name: { $ref: "#/$defs/nonEmptyString" },
81
+ version: { $ref: "#/$defs/nonEmptyString" }
82
+ }
83
+ },
84
+ profile: {
85
+ type: "object",
86
+ required: ["name", "version"],
87
+ additionalProperties: true,
88
+ properties: {
89
+ name: { $ref: "#/$defs/nonEmptyString" },
90
+ version: { $ref: "#/$defs/nonEmptyString" }
91
+ }
92
+ },
93
+ source: {
94
+ type: "object",
95
+ required: ["kind", "path"],
96
+ additionalProperties: true,
97
+ properties: {
98
+ kind: { $ref: "#/$defs/nonEmptyString" },
99
+ path: { $ref: "#/$defs/nonEmptyString" },
100
+ sourcesContent: { type: "string" }
101
+ }
102
+ },
103
+ sourcePosition: {
104
+ type: "object",
105
+ required: ["line"],
106
+ additionalProperties: true,
107
+ properties: {
108
+ line: { type: "integer", minimum: 1 },
109
+ column: { type: "integer", minimum: 1 }
110
+ }
111
+ },
112
+ sourceRange: {
113
+ anyOf: [
114
+ { type: "null" },
115
+ {
116
+ type: "object",
117
+ required: ["start"],
118
+ additionalProperties: true,
119
+ properties: {
120
+ start: { $ref: "#/$defs/sourcePosition" },
121
+ end: { $ref: "#/$defs/sourcePosition" }
122
+ }
123
+ }
124
+ ]
125
+ },
126
+ symbol: {
127
+ type: "object",
128
+ required: ["id", "kind", "name", "source"],
129
+ additionalProperties: true,
130
+ properties: {
131
+ id: { $ref: "#/$defs/nonEmptyString" },
132
+ kind: { enum: Object.values(HTMDOC_SYMBOL_KINDS) },
133
+ name: { $ref: "#/$defs/nonEmptyString" },
134
+ parentId: { $ref: "#/$defs/nonEmptyString" },
135
+ summary: { type: "string" },
136
+ source: {
137
+ type: "object",
138
+ required: ["path"],
139
+ additionalProperties: true,
140
+ properties: {
141
+ path: { $ref: "#/$defs/nonEmptyString" },
142
+ range: { $ref: "#/$defs/sourceRange" }
143
+ }
144
+ },
145
+ annotation: { type: "object" },
146
+ metadata: { type: "object" }
147
+ }
148
+ },
149
+ diagnostic: {
150
+ type: "object",
151
+ required: ["code", "message", "severity"],
152
+ additionalProperties: true,
153
+ properties: {
154
+ code: { $ref: "#/$defs/nonEmptyString" },
155
+ message: { $ref: "#/$defs/nonEmptyString" },
156
+ severity: { enum: ["info", "warning", "error"] },
157
+ path: { $ref: "#/$defs/nonEmptyString" },
158
+ data: { type: "object" }
159
+ }
160
+ }
161
+ }
162
+ });
163
+
164
+ const TAG_TO_KIND = Object.freeze({
165
+ component: HTMDOC_SYMBOL_KINDS.component,
166
+ element: HTMDOC_SYMBOL_KINDS.element,
167
+ template: HTMDOC_SYMBOL_KINDS.template,
168
+ attr: HTMDOC_SYMBOL_KINDS.attribute,
169
+ slot: HTMDOC_SYMBOL_KINDS.slot,
170
+ event: HTMDOC_SYMBOL_KINDS.event,
171
+ stylehook: HTMDOC_SYMBOL_KINDS.styleHook,
172
+ a11y: HTMDOC_SYMBOL_KINDS.a11yNote,
173
+ example: HTMDOC_SYMBOL_KINDS.example
174
+ });
175
+
176
+ export function getHtmlDocSymbolKind(tag) {
177
+ return TAG_TO_KIND[tag] ?? null;
178
+ }
179
+
180
+ export function isHtmlDocTag(tag) {
181
+ return HTMDOC_TAGS.includes(tag);
182
+ }
@@ -0,0 +1,242 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://hia-doc.local/schema/hia-htmdoc-extraction-0.1.0-draft.json",
4
+ "type": "object",
5
+ "required": [
6
+ "contract",
7
+ "contractVersion",
8
+ "producer",
9
+ "profile",
10
+ "source",
11
+ "symbols",
12
+ "annotations",
13
+ "diagnostics",
14
+ "sourceMap"
15
+ ],
16
+ "additionalProperties": true,
17
+ "properties": {
18
+ "contract": {
19
+ "const": "hia-htmdoc-extraction"
20
+ },
21
+ "contractVersion": {
22
+ "const": "0.1.0-draft"
23
+ },
24
+ "producer": {
25
+ "$ref": "#/$defs/producer"
26
+ },
27
+ "profile": {
28
+ "$ref": "#/$defs/profile"
29
+ },
30
+ "source": {
31
+ "$ref": "#/$defs/source"
32
+ },
33
+ "symbols": {
34
+ "type": "array",
35
+ "items": {
36
+ "$ref": "#/$defs/symbol"
37
+ }
38
+ },
39
+ "annotations": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "object"
43
+ }
44
+ },
45
+ "diagnostics": {
46
+ "type": "array",
47
+ "items": {
48
+ "$ref": "#/$defs/diagnostic"
49
+ }
50
+ },
51
+ "sourceMap": {
52
+ "type": "object"
53
+ },
54
+ "metadata": {
55
+ "type": "object"
56
+ }
57
+ },
58
+ "$defs": {
59
+ "nonEmptyString": {
60
+ "type": "string",
61
+ "minLength": 1
62
+ },
63
+ "producer": {
64
+ "type": "object",
65
+ "required": [
66
+ "name",
67
+ "version"
68
+ ],
69
+ "additionalProperties": true,
70
+ "properties": {
71
+ "name": {
72
+ "$ref": "#/$defs/nonEmptyString"
73
+ },
74
+ "version": {
75
+ "$ref": "#/$defs/nonEmptyString"
76
+ }
77
+ }
78
+ },
79
+ "profile": {
80
+ "type": "object",
81
+ "required": [
82
+ "name",
83
+ "version"
84
+ ],
85
+ "additionalProperties": true,
86
+ "properties": {
87
+ "name": {
88
+ "$ref": "#/$defs/nonEmptyString"
89
+ },
90
+ "version": {
91
+ "$ref": "#/$defs/nonEmptyString"
92
+ }
93
+ }
94
+ },
95
+ "source": {
96
+ "type": "object",
97
+ "required": [
98
+ "kind",
99
+ "path"
100
+ ],
101
+ "additionalProperties": true,
102
+ "properties": {
103
+ "kind": {
104
+ "$ref": "#/$defs/nonEmptyString"
105
+ },
106
+ "path": {
107
+ "$ref": "#/$defs/nonEmptyString"
108
+ },
109
+ "sourcesContent": {
110
+ "type": "string"
111
+ }
112
+ }
113
+ },
114
+ "sourcePosition": {
115
+ "type": "object",
116
+ "required": [
117
+ "line"
118
+ ],
119
+ "additionalProperties": true,
120
+ "properties": {
121
+ "line": {
122
+ "type": "integer",
123
+ "minimum": 1
124
+ },
125
+ "column": {
126
+ "type": "integer",
127
+ "minimum": 1
128
+ }
129
+ }
130
+ },
131
+ "sourceRange": {
132
+ "anyOf": [
133
+ {
134
+ "type": "null"
135
+ },
136
+ {
137
+ "type": "object",
138
+ "required": [
139
+ "start"
140
+ ],
141
+ "additionalProperties": true,
142
+ "properties": {
143
+ "start": {
144
+ "$ref": "#/$defs/sourcePosition"
145
+ },
146
+ "end": {
147
+ "$ref": "#/$defs/sourcePosition"
148
+ }
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ "symbol": {
154
+ "type": "object",
155
+ "required": [
156
+ "id",
157
+ "kind",
158
+ "name",
159
+ "source"
160
+ ],
161
+ "additionalProperties": true,
162
+ "properties": {
163
+ "id": {
164
+ "$ref": "#/$defs/nonEmptyString"
165
+ },
166
+ "kind": {
167
+ "enum": [
168
+ "html-component",
169
+ "html-element",
170
+ "html-template",
171
+ "html-attribute",
172
+ "html-slot",
173
+ "html-event",
174
+ "html-style-hook",
175
+ "html-a11y-note",
176
+ "html-example"
177
+ ]
178
+ },
179
+ "name": {
180
+ "$ref": "#/$defs/nonEmptyString"
181
+ },
182
+ "parentId": {
183
+ "$ref": "#/$defs/nonEmptyString"
184
+ },
185
+ "summary": {
186
+ "type": "string"
187
+ },
188
+ "source": {
189
+ "type": "object",
190
+ "required": [
191
+ "path"
192
+ ],
193
+ "additionalProperties": true,
194
+ "properties": {
195
+ "path": {
196
+ "$ref": "#/$defs/nonEmptyString"
197
+ },
198
+ "range": {
199
+ "$ref": "#/$defs/sourceRange"
200
+ }
201
+ }
202
+ },
203
+ "annotation": {
204
+ "type": "object"
205
+ },
206
+ "metadata": {
207
+ "type": "object"
208
+ }
209
+ }
210
+ },
211
+ "diagnostic": {
212
+ "type": "object",
213
+ "required": [
214
+ "code",
215
+ "message",
216
+ "severity"
217
+ ],
218
+ "additionalProperties": true,
219
+ "properties": {
220
+ "code": {
221
+ "$ref": "#/$defs/nonEmptyString"
222
+ },
223
+ "message": {
224
+ "$ref": "#/$defs/nonEmptyString"
225
+ },
226
+ "severity": {
227
+ "enum": [
228
+ "info",
229
+ "warning",
230
+ "error"
231
+ ]
232
+ },
233
+ "path": {
234
+ "$ref": "#/$defs/nonEmptyString"
235
+ },
236
+ "data": {
237
+ "type": "object"
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }