Skip to content

False positives in Schema inspection when using Lists in CompletableFuture #674

Closed
@JamesPeters98

Description

@JamesPeters98

I just got around to testing the new schema inspection #386 when upgrading to Spring Boot 3.1 RC1. I seem to be getting false positives for unmapped fields that have a java field.

I think it happens when the controller method is a CompletableFuture of a List of the object:

@Controller
public class ExampleQueryController {
  @QueryMapping
  public CompletableFuture<List<ExampleObject>> exampleObject(DataFetchingEnvironment env) {
    return CompletableFuture.completedFuture(List.of(new ExampleObject(1, "name")));
  }

}

GraphQL schema:

type ExampleObject {
  name: String,
  id: Int
}

type Query {
  exampleObject: [ExampleObject]
}

Object class:

public class ExampleObject {

  public String name;
  public int id;

  public ExampleObject(int id, String name) {
    this.id = id;
    this.name = name;
  }

  public Integer getId() {
    return id;
  }

  public String getName() {
    return name;
  }

}

This results in the schema inspection giving a false positive that name and id aren't mapped for ExampleObject.

Metadata

Metadata

Assignees

Labels

in: coreIssues related to config and core supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions