Checks a complete deck hierarchy before native JSON, CrowdAnki-style JSON, or APKG output. More...
Static Public Member Functions | |
| static AnkiValidationResult | Validate (AnkiDeck root) |
| Validates a root deck and every reachable descendant without modifying them. | |
| static AnkiValidationResult | Validate (IEnumerable< AnkiDeck > roots) |
| Validates several top-level deck hierarchies as one output graph. | |
Checks a complete deck hierarchy before native JSON, CrowdAnki-style JSON, or APKG output.
Validation is read-only and returns every detected content error instead of failing at the first one. Checks cover duplicate object IDs, conflicting note-type definitions, missing fields or templates, template field references, scheduler type/queue combinations, non-negative review counters, new-card counters, and the three-bit card flag.
Active scheduling pairs are New/New, Learning/Learning, Learning/DayLearning, Review/Review, Relearning/Learning, and Relearning/DayLearning. Suspended, sibling-buried, scheduler-buried, and preview queues retain any defined underlying card type. Validation preserves queue-specific values; it does not run Anki's scheduler or infer a new due date.
The hierarchy is mutable and not thread-safe, so callers must not change it while validation enumerates it.
Definition at line 18 of file AnkiValidator.cs.
|
inlinestatic |
Validates a root deck and every reachable descendant without modifying them.
| root | The root of the hierarchy to inspect. |
| ArgumentNullException | root is null. |
Definition at line 36 of file AnkiValidator.cs.
|
inlinestatic |
Validates several top-level deck hierarchies as one output graph.
| roots | The non-empty sequence of hierarchy roots to inspect. The sequence is enumerated once into a snapshot before validation starts; individual deck graphs remain live and must not be mutated concurrently. |
Use this overload before producing a package that contains more than one root. Calling Validate(AnkiDeck) separately for each root cannot detect an ID reused by two different hierarchies or two conflicting note-type definitions with the same ID. Package writers use this overload automatically.
This validates deck-domain structure and scheduler state. It does not inspect ZIP safety, media payload availability, or same-name media collisions; those checks belong to the package reader/writer because they require archive or stream access.
| ArgumentNullException | roots is null. |
| ArgumentException | roots is empty or contains a null hierarchy root. |
Definition at line 72 of file AnkiValidator.cs.