Skip to content

Missing import for Record BeanParam's that have a collection as a parameter #207

Closed
@LoonyRules

Description

@LoonyRules

In avaje-http v1.36 the following endpoint definition:

@Get("myEndpoint")
public void myEndpoint(@BeanParam MyRecord myRecord) {
  ....
}

with the following record definition:

public record MyRecord(@QueryParam("myEnum") Set<MyEnum> myEnums) { }

generates the following code:

ApiBuilder.get("myEndpoint", ctx -> {
  ctx.status(200);
  var myRecord = new MyRecord(
    set(qp -> (MyEnum) asEnum(MyEnum.class, qp), ctx.queryParams("myEnum")
  );

  ...
});

but fails to import the MyEnum.class, so the generated code is invalid resulting in an error at compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions