Skip to content

Missing ListMapper generation for List<T> fields #6

@wassertim

Description

@wassertim

Issue Description

The annotation processor is not generating mappers correctly for List<T> fields where T is a custom type annotated with @DynamoMappable.

Current Behavior

The generated mapper code tries to reference non-existent ListMapper class, causing CDI injection failure:

jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type ListMapper and qualifiers [@Default]

All @DynamoMappable Classes

// Route.java - Top-level entity with @Table
@DynamoMappable
@Table(name = "routes")
public class Route {
    private String userId;
    private String routeId;
    private String name;
    private String description;
    private RouteType type;
    private Difficulty difficulty;
    private String routingProfile;
    private List<Waypoint> waypoints;           // ⚠️ List of custom type
    private RouteGeometry routeGeometry;
    private RouteMetadata metadata;
    private Instant createdAt;
    private Instant updatedAt;
    private Instant lastUsed;
    private List<String> tags;                  // ✅ List of String works
}

// RouteMetadata.java
@DynamoMappable
public class RouteMetadata {
    private Double distance;
    private Double duration;
    private Double elevationGain;
    private Double elevationLoss;
    private Double minElevation;
    private Double maxElevation;
    private Double averageSpeed;
    private List<RouteInstruction> instructions;  // ⚠️ List of custom type
}

// RouteInstruction.java
@DynamoMappable
public class RouteInstruction {
    private String text;
    private Double distance;
    private Double duration;
    private String type;
    private List<Integer> waypointIndices;       // ✅ List of Integer works
}

// Waypoint.java
@DynamoMappable
public class Waypoint {
    private double lat;
    private double lng;
    private String name;
    private String description;
    private WaypointType type;
}

// RouteGeometry.java
@DynamoMappable
public class RouteGeometry {
    private final GeometryType type;
    private final List<List<Double>> coordinates;  // ✅ List of List<Double> works
}

Problem

The generated RouteInstructionMapper (and similar mappers) reference ListMapper that doesn't exist:

@ApplicationScoped
public class RouteInstructionMapper {
    private final ListMapper listMapper;  // ❌ Class not generated

    public RouteInstructionMapper(ListMapper listMapper) {
        this.listMapper = listMapper;
    }
}

Expected Behavior

Should either:

  1. Generate ListMapper for custom types automatically
  2. Inline the list mapping logic (like the fix shows for Route.waypoints)
  3. Document that nested List<CustomType> is not supported

Environment

  • dynamodb-toolkit version: v1.1.1
  • Quarkus version: 3.28.1
  • Java version: 21

Question

Is List<CustomType> support actually needed? Should we remove nested list fields or is this a feature gap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions