Tier 1: error model, validation window & native [CsvKey] dictionary (v2.4.0)#2
Open
zitgatech wants to merge 3 commits into
Open
Tier 1: error model, validation window & native [CsvKey] dictionary (v2.4.0)#2zitgatech wants to merge 3 commits into
zitgatech wants to merge 3 commits into
Conversation
Tier 1 core. Three cohesive changes that share the reader/postprocessor core: Error model (#19) - New public CsvReaderException + CsvCellError carrying (row, column, value, reason). - Per-cell DATA errors are now collected across the whole file and thrown together (ParseCell wrapper + BeginCollect/ThrowIfCellErrors), so a whole CSV can be fixed in one pass instead of one error per re-import. Structural errors (empty CSV, missing column, unknown type, no assemblies) still fail fast. No asset is written on failure. Validation window (#1) - CsvValidationReport accumulates a batch; CsvValidationWindow (Tools > Csv-Reader > Validation Report) lists errors grouped by file with an Open CSV shortcut and is focused automatically after a failing import. A bad file no longer blocks the rest of the batch; the postprocessor catches CsvReaderException, reports it, and skips that asset. Native Dictionary (#6) - New [CsvKey] attribute; Reader.DeserializeToDictionary + CsvReaderUtils helpers (TryGetDictionaryTypes / GetCsvKeyField). A Dictionary<K,V> field is built directly from the row type's [CsvKey] field. Duplicate/null keys are data errors. Scope is one CSV to one dictionary; merged-folder + Dictionary fails fast with a clear NotSupportedException. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- ReaderErrorCollectionTests: a file with a bad enum and a bad int surfaces both as one CsvReaderException (correct 1-based rows + column names), not just the first. - ReaderDictionaryTests: DeserializeToDictionary builds a [CsvKey]-keyed dictionary; duplicate key is a data error; missing [CsvKey] and key-type mismatch fail fast. 41/41 EditMode tests pass (via unity-mcp tests-run). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- README: native Dictionary (`[CsvKey]`) section, `[CsvKey]` attribute row, and a rewritten Error handling section (fail-fast structural vs. collected data errors + Validation window). - CHANGELOG 2.4.0 with a migration note (catch CsvReaderException for bad-cell errors). - package.json 2.3.0 -> 2.4.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tier 1 of the roadmap: a consistent error model, a validation report window, and native
Dictionarycolumns. Bumps the package to 2.4.0. Editor-only; no runtime cost.1. Collect-all error model
CsvReaderException+CsvCellErrorcarry(row, column, value, reason).aborting on the first bad value — fix a whole CSV in one pass. Invalid enum, non-numeric
number, bad bool and duplicate
[CsvKey]are all data errors.still fail fast. Nothing is written for a file that has data errors.
2. Validation Report window
Tools → Csv-Reader → Validation Reportlists every data error from the last import batch,grouped by file, with an Open CSV shortcut. Focused automatically after a failing import.
3. Native
Dictionary<K,V>via[CsvKey][CsvKey]and make the target field aDictionary<K,V>;the reader builds it directly — no convert-method boilerplate.
[CsvKey]type must equal the key type;exactly one per row type.
SerializedScriptableObject). Merged-folder + Dictionary fails fast with a clear message.⚠ Behavior change (see CHANGELOG)
FormatException/KeyNotFoundExceptionon the first offender.It now throws a single
CsvReaderExceptionaggregating every bad cell. Code that caught theold specific types around a cell should catch
CsvReaderException(exposesCellErrors).Structural exceptions are unchanged.
Testing
EditMode tests: 41/41 passing (35 previous + 6 new), verified via the Unity Test Runner.
New fixtures:
ReaderErrorCollectionTests,ReaderDictionaryTests.Commits
[CsvKey]dictionary (core)🤖 Generated with Claude Code