Skip to content

Commit

Permalink
Merge pull request #15576 from jmartisk/master-issue-15571
Browse files Browse the repository at this point in the history
Fix GraphQL queries returning Collection.class in native mode
  • Loading branch information
gsmet authored Mar 9, 2021
2 parents 75dc8df + 9397de4 commit 1a00681
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ private Class[] getGraphQLJavaClasses() {
classes.add(graphql.schema.GraphQLSchema.class);
classes.add(graphql.schema.GraphQLTypeReference.class);
classes.add(List.class);
classes.add(Collection.class);
return classes.toArray(new Class[] {});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.eclipse.microprofile.config.inject.ConfigProperty;
Expand Down Expand Up @@ -36,6 +37,13 @@ public Greetings load(Greetings greetings) {
public List<Greeting> buildInOptions(@Source Greeting greeting) {
List<Greeting> options = new ArrayList<>();
options.add(new Hello());
return options;
}

@Name("options2")
// make sure that returning Collection.class does not break native mode
public Collection<Greeting> buildInOptionsCollection(@Source Greeting greeting) {
List<Greeting> options = new ArrayList<>();
options.add(new Morning());
return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void testEndpoint() {
" options{\n" +
" message\n" +
" }\n" +
" options2{\n" +
" message\n" +
" }\n" +
" }\n" +
" farewell:farewell{\n" +
" type\n" +
Expand Down

0 comments on commit 1a00681

Please sign in to comment.