Skip to content

Accept ROSÉ catalogue colour on file and web import - #25

Merged
T0liver merged 1 commit into
mainfrom
c-rose-colour-import-cd1b
Nov 21, 2026
Merged

T0liver merged 1 commit into
mainfrom
c-rose-colour-import-cd1b

Conversation

@T0liver

@T0liver T0liver commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Fixes #19

Cause

The official catalogue uses "colour": "ROSÉ" while the app enum is ROSE. File import validated colours with an exact enum name match, and web import’s toWineColour() used valueOf and fell back to RED for anything that did not match.

Fix

  • Add parseWineColour() that trims, strips accents (Unicode NFD), uppercases, and matches WineColour enum names.
  • Use it in CatalogSyncRepositoryImpl.validateWineDto (file import) and String.toWineColour() (web/DTO mapping).
  • Unknown colours no longer silently map to RED; mapping throws IllegalArgumentException instead.

Tests

  • WineColourParsingTest covers ROSÉ, case-insensitive ROSE, unknown values, and toWineColour().

Build

  • ./gradlew testDebugUnitTest assembleDebug -Dorg.gradle.jvmargs="-Xmx4g" — BUILD SUCCESSFUL
Open in Web Open in Cursor 

Normalize accent marks when mapping catalogue colour strings so ROSÉ
matches WineColour.ROSE on file validation and web import. Stop defaulting
unknown colours to RED during DTO mapping.

Co-authored-by: T0liver <T0liver@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Test Results

5 tests  +4   5 ✅ +4   0s ⏱️ ±0s
2 suites +1   0 💤 ±0 
2 files   +1   0 ❌ ±0 

Results for commit 09b0166. ± Comparison against base commit c865cc7.

@T0liver
T0liver merged commit 5fb5752 into main Nov 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Automated test] File import rejects the official full.json ("ROSÉ"); web import stores Rosé as Red

2 participants