AnkiIO 1.0.2
Build, validate, import, and export Anki-compatible decks from .NET
Loading...
Searching...
No Matches
AnkiIO.AnkiDiagnostic(AnkiDiagnosticSeverity Severity, string Code, string Message, string? Location=null, long? DeckId=null, long? NoteId=null, long? CardId=null, string? FieldName=null, string? MediaFileName=null, string? SuggestedRemediation=null) Class Referencesealed

Provides one machine-readable validation, compatibility, or preservation finding. More...

Properties

AnkiDiagnosticSeverity Severity = Severity [get]
 Gets the operational impact of the finding.
string Code = Code [get]
 Gets the stable identifier intended for filtering and automation.
string Message = Message [get]
 Gets the current human-readable explanation.
string? Location = Location [get]
 Gets optional source-format context.
long? DeckId = DeckId [get]
 Gets the related deck identifier when available.
long? NoteId = NoteId [get]
 Gets the related note identifier when available.
long? CardId = CardId [get]
 Gets the related card identifier when available.
string? FieldName = FieldName [get]
 Gets the related note-type field name when available.
string? MediaFileName = MediaFileName [get]
 Gets the related media filename when available.
string? SuggestedRemediation = SuggestedRemediation [get]
 Gets optional corrective guidance.

Detailed Description

Provides one machine-readable validation, compatibility, or preservation finding.

Parameters
SeverityWhether the finding is explanatory, lossy, or blocks a validated write.
CodeA stable, non-localized identifier such as ANKI020 or CROWD002.
MessageA human-readable explanation for logs or user interfaces.
LocationAn optional JSON path, archive entry, source path, or adapter-defined logical location.
DeckIdThe related deck ID when the finding is deck-specific.
NoteIdThe related note ID when the finding is note-specific.
CardIdThe related card ID when the finding is card-specific.
FieldNameThe related note-type field using its stored case-sensitive spelling.
MediaFileNameThe related collection media filename.
SuggestedRemediationOptional concise guidance for correcting or safely handling the finding.

The immutable record is safe to retain after validation. Branch on Code and Severity rather than parsing Message, because wording and remediation may improve without a breaking API change. Context properties are independently optional: an archive-wide security or compatibility finding may have no object ID, while a template failure normally carries deck, note, and field context.

foreach (AnkiDiagnostic diagnostic in AnkiValidator.Validate(deck).Diagnostics)
{
if (diagnostic.Severity == AnkiDiagnosticSeverity.Error)
{
Console.Error.WriteLine($"{diagnostic.Code}: {diagnostic.Message}");
}
}
Provides one machine-readable validation, compatibility, or preservation finding.
AnkiDiagnosticSeverity Severity
Gets the operational impact of the finding.
IReadOnlyList< AnkiDiagnostic > Diagnostics
Gets findings in deterministic hierarchy and card traversal order.
Checks a complete deck hierarchy before native JSON, CrowdAnki-style JSON, or APKG output.
static AnkiValidationResult Validate(AnkiDeck root)
Validates a root deck and every reachable descendant without modifying them.
AnkiDiagnosticSeverity
Classifies whether a diagnostic is explanatory, lossy, or blocks a validated write.

Definition at line 31 of file AnkiDiagnostic.cs.

Property Documentation

◆ CardId

long? AnkiIO.AnkiDiagnostic.CardId = CardId
get

Gets the related card identifier when available.

A stable card ID, or null for findings not tied to one card.

Definition at line 69 of file AnkiDiagnostic.cs.

◆ Code

string AnkiIO.AnkiDiagnostic.Code = Code
get

Gets the stable identifier intended for filtering and automation.

A non-localized code whose meaning is part of the compatibility contract.

Definition at line 49 of file AnkiDiagnostic.cs.

◆ DeckId

long? AnkiIO.AnkiDiagnostic.DeckId = DeckId
get

Gets the related deck identifier when available.

A stable deck ID, or null for findings not tied to one deck.

Definition at line 61 of file AnkiDiagnostic.cs.

◆ FieldName

string? AnkiIO.AnkiDiagnostic.FieldName = FieldName
get

Gets the related note-type field name when available.

The exact stored field spelling, or null.

Definition at line 73 of file AnkiDiagnostic.cs.

◆ Location

string? AnkiIO.AnkiDiagnostic.Location = Location
get

Gets optional source-format context.

A path, entry name, JSON location, or logical adapter location; otherwise null.

Definition at line 57 of file AnkiDiagnostic.cs.

◆ MediaFileName

string? AnkiIO.AnkiDiagnostic.MediaFileName = MediaFileName
get

Gets the related media filename when available.

A collection-relative media filename, or null.

Definition at line 77 of file AnkiDiagnostic.cs.

◆ Message

string AnkiIO.AnkiDiagnostic.Message = Message
get

Gets the current human-readable explanation.

Text suitable for display or logs, but not for machine parsing.

Definition at line 53 of file AnkiDiagnostic.cs.

◆ NoteId

long? AnkiIO.AnkiDiagnostic.NoteId = NoteId
get

Gets the related note identifier when available.

A stable note ID, or null for findings not tied to one note.

Definition at line 65 of file AnkiDiagnostic.cs.

◆ Severity

AnkiDiagnosticSeverity AnkiIO.AnkiDiagnostic.Severity = Severity
get

Gets the operational impact of the finding.

Information, warning, or error; only error invalidates a validation result.

Definition at line 45 of file AnkiDiagnostic.cs.

◆ SuggestedRemediation

string? AnkiIO.AnkiDiagnostic.SuggestedRemediation = SuggestedRemediation
get

Gets optional corrective guidance.

A concise suggested next action, or null when no generic remediation is safe.

Definition at line 81 of file AnkiDiagnostic.cs.


The documentation for this class was generated from the following file: