{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Examination Question Set", "description": "CS 知识应试强化系统 - 题目集 JSON Schema", "type": "object", "required": ["topic", "type", "schema_version", "questions"], "properties": { "topic": { "type": "string", "description": "主题 slug" }, "type": { "type": "string", "enum": ["single_choice", "multiple_choice", "true_false", "fill_blank", "short_answer", "code_reading", "scenario"], "description": "题目类型" }, "schema_version": { "type": "string", "const": "1.0.0" }, "generated": { "type": "string", "format": "date-time" }, "questions": { "type": "array", "items": { "$ref": "#/definitions/question" } } }, "definitions": { "question": { "type": "object", "required": ["id", "type", "difficulty", "tags", "question", "explanation"], "properties": { "id": { "type": "string", "pattern": "^(sc|mc|tf|fb|sa|cr|sn)-[0-9]{3}$", "description": "题目唯一标识,格式: typecode-number(如 fb-001, sc-003)" }, "type": { "type": "string", "enum": ["single_choice", "multiple_choice", "true_false", "fill_blank", "short_answer", "code_reading", "scenario"] }, "difficulty": { "type": "integer", "minimum": 1, "maximum": 5 }, "tags": { "type": "array", "items": { "type": "string" } }, "question": { "type": "string" }, "explanation": { "type": "string" }, "source": { "type": ["string", "null"], "default": null }, "related": { "type": "array", "items": { "type": "string" }, "default": [] }, "options": { "description": "选项(选择题类型)或 null" }, "answer": { "description": "答案(根据题型不同而不同)" }, "answer_rule": { "type": "string", "enum": ["any", "all", "ordered"], "default": "any", "description": "填空题答案匹配规则" }, "keywords": { "type": "array", "items": { "type": "string" }, "description": "简答题评分关键词" }, "scoring_rubric": { "type": "string", "description": "简答题评分标准" }, "code": { "type": ["string", "null"], "description": "代码片段(代码阅读题和场景题)" }, "language": { "type": "string", "description": "编程语言(代码阅读题必填)" }, "context": { "type": "string", "description": "场景描述(场景分析题必填)" }, "sub_questions": { "type": "array", "items": { "$ref": "#/definitions/sub_question" }, "description": "子问题列表(代码阅读题和场景分析题)" } }, "allOf": [ { "if": { "properties": { "type": { "const": "single_choice" } } }, "then": { "required": ["options", "answer"], "properties": { "options": { "type": "object", "patternProperties": { "^[A-Z]$": { "type": "string" } }, "additionalProperties": false, "minProperties": 2 }, "answer": { "type": "string", "pattern": "^[A-Z]$" } } } }, { "if": { "properties": { "type": { "const": "multiple_choice" } } }, "then": { "required": ["options", "answer"], "properties": { "options": { "type": "object", "patternProperties": { "^[A-Z]$": { "type": "string" } }, "additionalProperties": false, "minProperties": 2 }, "answer": { "type": "array", "items": { "type": "string", "pattern": "^[A-Z]$" }, "minItems": 1, "uniqueItems": true } } } }, { "if": { "properties": { "type": { "const": "true_false" } } }, "then": { "required": ["answer"], "properties": { "answer": { "type": "boolean" } } } }, { "if": { "properties": { "type": { "const": "fill_blank" } } }, "then": { "required": ["answer"], "properties": { "answer": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "answer_rule": { "type": "string", "enum": ["any", "all", "ordered"], "default": "any" } } } }, { "if": { "properties": { "type": { "const": "short_answer" } } }, "then": { "required": ["answer"], "properties": { "answer": { "type": "string" }, "keywords": { "type": "array", "items": { "type": "string" } }, "scoring_rubric": { "type": "string" } } } }, { "if": { "properties": { "type": { "const": "code_reading" } } }, "then": { "required": ["code", "language", "sub_questions"], "properties": { "code": { "type": "string" }, "language": { "type": "string" }, "sub_questions": { "type": "array", "items": { "$ref": "#/definitions/sub_question" }, "minItems": 1 } } } }, { "if": { "properties": { "type": { "const": "scenario" } } }, "then": { "required": ["context", "sub_questions"], "properties": { "context": { "type": "string" }, "code": { "type": ["string", "null"] }, "sub_questions": { "type": "array", "items": { "$ref": "#/definitions/sub_question" }, "minItems": 1 } } } } ] }, "sub_question": { "type": "object", "required": ["index", "type", "question", "answer", "explanation"], "properties": { "index": { "type": "integer", "minimum": 1 }, "type": { "type": "string", "enum": ["single_choice", "multiple_choice", "true_false", "fill_blank", "short_answer", "code_reading", "scenario"] }, "question": { "type": "string" }, "answer": {}, "explanation": { "type": "string" }, "options": { "type": "object", "patternProperties": { "^[A-Z]$": { "type": "string" } }, "additionalProperties": false }, "keywords": { "type": "array", "items": { "type": "string" } }, "scoring_rubric": { "type": "string" } }, "allOf": [ { "if": { "properties": { "type": { "const": "single_choice" } } }, "then": { "required": ["options"], "properties": { "options": { "type": "object", "patternProperties": { "^[A-Z]$": { "type": "string" } }, "additionalProperties": false, "minProperties": 2 }, "answer": { "type": "string", "pattern": "^[A-Z]$" } } } }, { "if": { "properties": { "type": { "const": "multiple_choice" } } }, "then": { "required": ["options"], "properties": { "options": { "type": "object", "patternProperties": { "^[A-Z]$": { "type": "string" } }, "additionalProperties": false, "minProperties": 2 }, "answer": { "type": "array", "items": { "type": "string", "pattern": "^[A-Z]$" }, "minItems": 1, "uniqueItems": true } } } }, { "if": { "properties": { "type": { "const": "true_false" } } }, "then": { "properties": { "answer": { "type": "boolean" } } } }, { "if": { "properties": { "type": { "const": "fill_blank" } } }, "then": { "properties": { "answer": { "type": "array", "items": { "type": "string" }, "minItems": 1 } } } }, { "if": { "properties": { "type": { "const": "short_answer" } } }, "then": { "properties": { "answer": { "type": "string" }, "keywords": { "type": "array", "items": { "type": "string" } }, "scoring_rubric": { "type": "string" } } } } ] } } }