dgs-codegen icon indicating copy to clipboard operation
dgs-codegen copied to clipboard

Client projection of a field with arguments does not return correct projection

Open TLmaK0 opened this issue 1 year ago • 1 comments

In versions 6.x when you create a schema like this:

type Query {
    request: Response
}

type Foobar {
    foo(first: Int): String
}

type Response {
    bar: Foobar
}

Field foo(Integer first) returns FieldObjectProjection instead of FieldObjectProjection<PARENT, ROOT>.

public class FoobarProjection<PARENT extends BaseSubProjectionNode<?, ?>, ROOT extends BaseSubProjectionNode<?, ?>> extends BaseSubProjectionNode<PARENT, ROOT> {
  public FoobarProjection(PARENT parent, ROOT root) {
    super(parent, root, java.util.Optional.of("Foobar"));
  }

  public FoobarProjection<PARENT, ROOT> foo() {
    getFields().put("foo", null);
    return this;
  }

  public FoobarProjection foo(Integer first) {
    getFields().put("foo", null);
    getInputArguments().computeIfAbsent("foo", k -> new ArrayList<>());
    InputArgument firstArg = new InputArgument("first", first);
    getInputArguments().get("foo").add(firstArg);
    return this;
  }
}

TLmaK0 avatar Jan 13 '24 11:01 TLmaK0

Thanks for reporting, we will look into a fix for this issue.

srinivasankavitha avatar Jan 14 '24 23:01 srinivasankavitha