Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generics not supported #511

Closed
apellizzn opened this issue Nov 9, 2020 · 1 comment
Closed

Generics not supported #511

apellizzn opened this issue Nov 9, 2020 · 1 comment

Comments

@apellizzn
Copy link

Using quarkus 1.9.2.Final
With the following code

package test.graphql;

import test.graphql.dtos.PaginationInfo;

import java.util.List;

public interface Connection<T> {
    List<T> getData();
    PaginationInfo getPagination();
}
package test.graphql;

import test.dtos.PaginationInfo;
import lombok.Builder;
import java.util.List;

@Builder
public class FruitConnection implements Connection<Fruit> {

    private List<Fruit> data;
    private PaginationInfo paginationInfo;

    @Override
    public List<Fruit> getData() {
        return data;
    }

    @Override
    public PaginationInfo getPagination() {
        return paginationInfo;
    }
}
package test.graphql;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class Fruit {
    private String name;
}
package test.graphql;

import test.dtos.PaginationInfo;
import org.eclipse.microprofile.graphql.GraphQLApi;
import org.eclipse.microprofile.graphql.Query;

import java.util.ArrayList;

@GraphQLApi
public class FruitsResource {

    @Query
    public FruitConnection all() {
        return FruitConnection.builder()
                .data(new ArrayList<>() {{ add(new Fruit("apple")); }})
                .paginationInfo(new PaginationInfo())
                .build();
    }
}
package test.graphql.dtos;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class PaginationInfo {
    private Long total;
    private boolean hasNextPage;
    private boolean hasPreviousPage;
    private Integer pageSize;
}
package com.camelot.avalon.graphql;

import com.camelot.avalon.dtos.PaginationInfo;

import java.util.List;

public interface Connection<T> {
    List<T> getData();
    PaginationInfo getPagination();
}

The compilation step throws the following error

2020-11-09 10:20:46,960 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.smallrye.graphql.deployment.SmallRyeGraphQLProcessor#buildExecutionService threw an exception: java.lang.IllegalArgumentException: Not a type variable!
at org.jboss.jandex.Type.asTypeVariable(Type.java:241)
at io.smallrye.graphql.schema.creator.ReferenceCreator.createReference(ReferenceCreator.java:203)
at io.smallrye.graphql.schema.creator.type.TypeCreator.addInterfaces(TypeCreator.java:153)
at io.smallrye.graphql.schema.creator.type.TypeCreator.create(TypeCreator.java:78)
at io.smallrye.graphql.schema.creator.type.TypeCreator.create(TypeCreator.java:41)
at io.smallrye.graphql.schema.SchemaBuilder.createAndAddToSchema(SchemaBuilder.java:197)
at io.smallrye.graphql.schema.SchemaBuilder.addTypesToSchema(SchemaBuilder.java:130)

Linked to to #281 @velias

@velias
Copy link
Collaborator

velias commented Nov 9, 2020

Thanks for your report. As we just discussed in #281, the problem is patched in smallrye-graphql 1.0.15 which will be in Quarkus 1.10.0 (CR release tomorrow). Tests added through my PR #512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants