- add ProjectIdentity (manifest root instance or workspace snapshot digest) and remove absolute-path root ids from Analysis bytes - replace the resources count with an addressable array over the two real marqdo-ir resource kinds (formula, code), including unit/span/payload digest and code language - project diagnostics by module/relative path/span, removing machine paths - define the digest as SHA-256 of the exact emitted bytes so consumers can verify it; Trace binds to the same digest - add analysis-v2 spec and JSON schema, supersede v1, update the independent Python consumer, schemas and docs - tests: location-independent byte equality and resource addressing
104 lines
4.0 KiB
JSON
104 lines
4.0 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://marqdo.dev/schemas/analysis-v2.schema.json",
|
|
"title": "Marqdo Analysis v2",
|
|
"type": "object",
|
|
"required": ["schema", "schema_version", "producer", "project", "modules", "diagnostics"],
|
|
"properties": {
|
|
"schema": {"const": "marqdo.analysis"},
|
|
"schema_version": {"const": 2},
|
|
"producer": {
|
|
"type": "object",
|
|
"required": ["name", "version", "markdown_profile"],
|
|
"properties": {
|
|
"name": {"type": "string"},
|
|
"version": {"type": "string"},
|
|
"markdown_profile": {"const": "marqdo.md.v1"}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"project": {
|
|
"type": "object",
|
|
"required": ["root_id", "identity_kind", "lock_digest"],
|
|
"properties": {
|
|
"root_id": {"type": "string", "minLength": 1, "pattern": "^(root:|sha256:[0-9a-f]{64}$)"},
|
|
"identity_kind": {"enum": ["manifest", "workspace_snapshot"]},
|
|
"lock_digest": {"type": "string", "pattern": "^(sha256:[0-9a-f]{64})?$"}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"modules": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["id", "package_instance_id", "relative_path", "source_digest", "units", "functions", "imports", "references", "calls", "resources"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "::"},
|
|
"package_instance_id": {"type": "string", "minLength": 1},
|
|
"relative_path": {"type": "string", "minLength": 1, "pattern": "^(?!/)(?!.*\\.\\.)"},
|
|
"source_digest": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
"units": {"type": "array"},
|
|
"functions": {"type": "array"},
|
|
"imports": {"type": "array"},
|
|
"references": {"type": "array"},
|
|
"calls": {"type": "array"},
|
|
"resources": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["id", "module_id", "unit_id", "kind", "span", "content_digest"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "#resource:(formula|code)-[0-9]+$"},
|
|
"module_id": {"type": "string", "pattern": "::"},
|
|
"unit_id": {"type": "string", "minLength": 1},
|
|
"kind": {"enum": ["formula", "code"]},
|
|
"span": {
|
|
"type": "object",
|
|
"required": ["start", "end"],
|
|
"properties": {
|
|
"start": {"type": "integer", "minimum": 0},
|
|
"end": {"type": "integer", "minimum": 0}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"content_digest": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
"language": {"type": ["string", "null"]},
|
|
"display": {"type": "boolean"}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
},
|
|
"diagnostics": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"required": ["module", "relative_path", "severity", "code", "message"],
|
|
"properties": {
|
|
"module": {"type": "string", "pattern": "::"},
|
|
"relative_path": {"type": "string", "minLength": 1},
|
|
"span": {
|
|
"type": ["object", "null"],
|
|
"required": ["start", "end"],
|
|
"properties": {
|
|
"start": {"type": "integer", "minimum": 0},
|
|
"end": {"type": "integer", "minimum": 0}
|
|
}
|
|
},
|
|
"line": {"type": ["integer", "null"], "minimum": 1},
|
|
"column": {"type": ["integer", "null"], "minimum": 1},
|
|
"severity": {"enum": ["error", "warning"]},
|
|
"code": {"type": "string", "minLength": 1},
|
|
"message": {"type": "string", "minLength": 1},
|
|
"hints": {"type": "array", "items": {"type": "string"}}
|
|
},
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
}
|