-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Detail Bug Report
Summary
- Context: The
PoiCategoryenum defines the point-of-interest categories used by the Apple Maps Server API for filtering search results and identifying place types in responses. - Bug: All
apiValuestrings in thePoiCategoryenum use PascalCase (e.g., "Airport", "Bakery") or UPPERCASE (e.g., "ATM") instead of the lowercase camelCase expected by the Apple Maps Server API (e.g., "airport", "bakery", "atm"). - Actual vs. expected: The code currently uses capitalized strings for the API values, but the Apple Maps Server API expects lowercase camelCase strings for both request parameters (
includePoiCategories,excludePoiCategories) and response fields (poiCategory). - Impact: This bug causes two major issues: (1) search result filtering fails because the API does not recognize the capitalized category names, and (2) the
poiCategoryfield in search responses is alwaysOptional.empty()because Jackson fails to match the lowercase strings from the API to the capitalized enum values.
Code with bug
/** Airport. */
AIRPORT("Airport"), // <-- BUG 🔴 Should be "airport"
/** Airport gate. */
AIRPORT_GATE("AirportGate"),
/** Airport terminal. */
AIRPORT_TERMINAL("AirportTerminal"),
/** Amusement park. */
AMUSEMENT_PARK("AmusementPark"),
/** ATM. */
ATM("ATM")Failing test
A reproduction test shows Jackson cannot deserialize the API's lowercase value into the enum when apiValue is capitalized.
// From PoiCategoryReproductionTest.java output:
PoiCategoryReproductionTest > testDeserialization() STANDARD_OUT
API Value: airport, Expected: Airport, Actual: null
PoiCategoryReproductionTest > testDeserialization() FAILED
org.opentest4j.AssertionFailedError: Failed to deserialize airport ==> expected: <Airport> but was: <null>Recommended fix
Update all apiValue strings in src/main/java/com/williamcallahan/applemaps/domain/model/PoiCategory.java to lowercase camelCase to match the Apple Maps Server API specification.
AIRPORT("airport"), // <-- FIX 🟢
AIRPORT_GATE("airportGate"),
EV_CHARGER("evCharger")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working