Repository navigation
[QTI] QTI 3.0 schema XML validation utilities #6005
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
One authoritative backend validator that checks any QTI item against the QTI 3.0 schema, independent of source. The frontend surfaces only user-correctable errors; full compliance is guaranteed here.
Complexity: Medium
Target branch: unstable
Context
- QTI arrives from the editor and from ricecooker, and may use interaction types or constructs the editor never produces.
- The sync API accepts writes outside the editor, so the frontend's by-construction validity can't be assumed; QTI must be validated on save, not only at upload and publish.
- Publish validates every item in a channel and ricecooker uploads in bulk, so the schema can't be re-parsed per item.
- The pydantic models ([QTI] Build the QTI declaration model with XML parsing and serialization #5965) cover a restricted generation subset, not the full spec.
The Change
- Provide a reusable backend entry point that validates a QTI item against the QTI 3.0 schema and returns pass/fail plus actionable errors.
- Compile the schema once and reuse it across items, so bulk publish and upload stay efficient.
- Keep it a standalone validator; the entry points wire it in — save ([QTI] Allow API endpoint to handle AssessmentItem.raw_data to store QTI data #5999), upload ([QTI] Accept QTI items through the internal API for ricecooker import #6002), publish ([QTI] Publish raw_data QTI assessment items as QTI/IMSCP packages #6000).
Acceptance Criteria
- A reusable function validates a QTI item against the QTI 3.0 schema, returning structured pass/fail + errors
- Valid QTI passes, including interaction types the editor does not author
- Malformed or non-compliant QTI fails with errors that identify the problem
- The compiled schema is reused across items, not re-parsed per item
- Tests cover valid items across multiple interaction types and representative invalid items
References
- QTI 3.0 specification: https://www.imsglobal.org/spec/qti/v3p0/impl
- [QTI] Build the QTI declaration model with XML parsing and serialization #5965 — pydantic QTI model
AI usage
Architecture decided with the maintainer across an iterative session: blanket
QTItype with the item XML inraw_data; XSD-authoritative validation across all sources; a legacy→QTI global migration with an API-layer dual-read; ricecooker upload delegating to the AssessmentItem serializer; and a Perseus custom-interaction contract confirmed against the QTI 3.0 specification. Claude mapped the existing publish/validation/ricecooker code, proposed the breakdown, and drafted each issue; the maintainer steered every decision and reviewed throughout.

Activity
rtibblesbot commentedon Jul 2, 2026
Plan: Add a reusable, source-independent backend function that validates a QTI item's raw XML against the official QTI 3.0 item XSD schema and returns a structured pass/fail result with actionable errors, compiling the schema once and reusing it across items.
validate_qti_item()— secure parsing, schema validation, structured result@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
rtibblesbot commentedon Jul 3, 2026
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.