{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://explicit-learning.local/schemas/compiled_program.schema.json", "title": "Canonical executable question program proposal", "type": "object", "additionalProperties": false, "required": [ "schema_version", "compile_id", "base_id", "compiler_role", "model", "question_sha256", "choices_sha256", "compile_status" ], "properties": { "schema_version": {"const": 1}, "compile_id": {"$ref": "#/$defs/sha256"}, "base_id": {"$ref": "#/$defs/sha256"}, "compiler_role": { "type": "string", "enum": ["program_proposer", "independent_program_verifier"] }, "model": { "type": "object", "additionalProperties": false, "required": ["repo_id", "revision"], "properties": { "repo_id": {"type": "string", "minLength": 3}, "revision": {"type": "string", "pattern": "^[a-f0-9]{40}$"} } }, "question_sha256": {"$ref": "#/$defs/sha256"}, "choices_sha256": {"$ref": "#/$defs/sha256"}, "compile_status": { "type": "string", "enum": ["compiled", "unsupported", "invalid_response"] }, "dsl": { "type": "string", "enum": ["plotqa_dsl_v1", "geometry_dsl_v1", "table_dsl_v1", "clevr_dsl_v1"] }, "program": {"$ref": "#/$defs/astNode"}, "referent_selector": { "oneOf": [{"$ref": "#/$defs/astNode"}, {"type": "null"}] }, "required_referent_cardinality": { "type": ["integer", "null"], "minimum": 0 }, "referenced_node_ids": { "type": "array", "items": {"type": "string", "minLength": 1}, "uniqueItems": true }, "canonical_program_sha256": { "anyOf": [{"$ref": "#/$defs/sha256"}, {"type": "null"}] }, "reason_code": {"type": ["string", "null"]}, "request_sha256": {"$ref": "#/$defs/sha256"}, "response_sha256": {"$ref": "#/$defs/sha256"}, "parse_status": { "type": "string", "enum": ["valid_first_response", "valid_after_one_repair", "invalid"] } }, "allOf": [ { "if": { "properties": {"compile_status": {"const": "compiled"}}, "required": ["compile_status"] }, "then": { "required": [ "dsl", "program", "referent_selector", "required_referent_cardinality", "referenced_node_ids", "canonical_program_sha256" ] } }, { "if": { "properties": { "compile_status": {"enum": ["unsupported", "invalid_response"]} }, "required": ["compile_status"] }, "then": { "required": ["reason_code"] } } ], "$defs": { "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }, "astNode": { "type": "object", "additionalProperties": false, "required": ["op", "args"], "properties": { "op": {"type": "string", "minLength": 1}, "args": { "type": "array", "items": { "oneOf": [ {"$ref": "#/$defs/astNode"}, {"type": "string"}, {"type": "number"}, {"type": "boolean"} ] } }, "return_type": {"type": "string", "minLength": 1} } } } }