feat(myopencre): add export-compatible CSV validation for imports #680
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
This PR adds layered validation to the MyOpenCRE CSV import endpoint while preserving full compatibility with OpenCRE-exported CSV templates.
The intent is to make imports safer and errors clearer without introducing stricter requirements than those enforced by the exporter itself.
What’s included
This change introduces validation in three scoped stages:
1. File-level validation
2. Schema / header validation
CRE*columnstandard|namestandard|id3. Row-level validation (export-compatible)
Why this approach
The OpenCRE exporter currently produces CSV files that may contain:
The importer now explicitly supports these cases and enforces validation only where semantic meaning exists. This ensures:
Out of scope
Frontend error rendering improvements are intentionally left out and will be handled in a follow-up PR to keep this change focused and easy to review.