How to use @GraphQLInterface in SPQR

90 views Asked by At

I want to return list of interfaces with different implementations by calling query/mutation in grpahql spqr.

For this purpose I suppose I need to use @GraphQLInterface. Maybe I doing something wrong, but it not works.

I have spring-boot app 2.3.3.RELEASE with graphql-spqr-spring-boot-starter 0.0.4 There is my model:

public class ResponseDto {
    ...
    List<IValidation> validations;
}

@GraphQLInterface(name = "ValidationError", implementationAutoDiscovery = true)
public interface ValidationError {

    @GraphQLQuery(name = "message")
    String getMessage();
}

@GraphQLType(name = "SimpleError")
@AllArgsConstructor
@Getter
public enum SimpleError implements ValidationError {

    ERROR("some msg");

    private String message;
}

But when I get graphql schema there is no any info about SimpleError and field message in ValidationError.

I also tried without GraphQLType and GraphQLQuery, it not works. And I tried with no enum implementation also, same result.

Could anyone explain what I'm doing wrong?

Thank you.

0

There are 0 answers