forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#27214 from phillip-kruger/graphql-upgrade
Upgrade to SmallRye GraphQL 1.7.0 (graphql-java 19.0)
- Loading branch information
Showing
20 changed files
with
353 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
.../deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/InstrumentationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package io.quarkus.smallrye.graphql.deployment; | ||
|
||
import static io.quarkus.smallrye.graphql.deployment.AbstractGraphQLTest.getPropertyAsString; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.nullValue; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
import org.eclipse.microprofile.graphql.Source; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
public class InstrumentationTest extends AbstractGraphQLTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(FooApi.class, Foo.class) | ||
.addAsResource(new StringAsset(getPropertyAsString(configuration())), "application.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")); | ||
|
||
@Test | ||
public void testQueryDepth() { | ||
String query = getPayload("{ foo { nestedFoo { nestedFoo { message}}}}"); | ||
RestAssured.given() | ||
.body(query) | ||
.contentType(MEDIATYPE_JSON) | ||
.post("/graphql/") | ||
.then() | ||
.log().all() | ||
.assertThat() | ||
.body("errors[0].message", equalTo("maximum query depth exceeded 4 > 1")) | ||
.body("data", nullValue()); | ||
} | ||
|
||
private static Map<String, String> configuration() { | ||
Map<String, String> m = new HashMap<>(); | ||
m.put("quarkus.smallrye-graphql.events.enabled", "true"); | ||
m.put("quarkus.smallrye-graphql.instrumentation-query-depth", "1"); | ||
return m; | ||
} | ||
|
||
public static class Foo { | ||
|
||
private String message; | ||
|
||
public Foo(String foo) { | ||
this.message = foo; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
} | ||
|
||
@GraphQLApi | ||
public static class FooApi { | ||
|
||
@Query | ||
@NonBlocking | ||
public Foo foo() { | ||
return new Foo("foo"); | ||
} | ||
|
||
public Foo nestedFoo(@Source Foo foo) { | ||
return new Foo("foo"); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tcks/microprofile-graphql/src/main/resources/overrides/createNewNullNamedHero/output2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "Validation error (WrongType@[createNewHero]) : argument 'hero.name' with value 'NullValue{}' must not be null", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 19 | ||
} | ||
] | ||
} | ||
], | ||
"data": null | ||
} |
14 changes: 14 additions & 0 deletions
14
tcks/microprofile-graphql/src/main/resources/overrides/createNewUnnamedHero/output2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "Validation error (WrongType@[createNewHero]) : argument 'hero' with value 'ObjectValue{objectFields=[ObjectField{name='realName', value=StringValue{value='John Smith'}}]}' is missing required fields '[name]'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 19 | ||
} | ||
] | ||
} | ||
], | ||
"data": null | ||
} |
16 changes: 16 additions & 0 deletions
16
tcks/microprofile-graphql/src/main/resources/overrides/invalidDataTypeValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'powerLevel' with value 'StringValue{value='Unlimited'}' is not a valid 'Int'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 37 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"updateItemPowerLevel": null | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tcks/microprofile-graphql/src/main/resources/overrides/invalidEnumValue/output2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "Validation error (WrongType@[createNewHero]) : argument 'hero.tshirtSize' with value 'EnumValue{name='XLTall'}' is not a valid 'ShirtSize' - Expected enum literal value not in allowable values - 'EnumValue{name='XLTall'}'.", | ||
"locations": [ | ||
{ | ||
"line": 3, | ||
"column": 19 | ||
} | ||
] | ||
} | ||
], | ||
"data": null | ||
} |
16 changes: 16 additions & 0 deletions
16
...oprofile-graphql/src/main/resources/overrides/invalidLocalDateFormattedValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'date' with value 'StringValue{value='Today'}' is not a valid 'Date'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 49 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"checkInWithCorrectDateFormat": null | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...file-graphql/src/main/resources/overrides/invalidLocalDateTimeFormattedValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'dateTime' with value 'StringValue{value='Today'}' is not a valid 'DateTime'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 48 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"battleWithCorrectDateFormat": null | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../microprofile-graphql/src/main/resources/overrides/invalidLocalDateTimeValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'dateTime' with value 'StringValue{value='Today'}' is not a valid 'DateTime'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 27 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"battle": null | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
tcks/microprofile-graphql/src/main/resources/overrides/invalidLocalDateValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'date' with value 'StringValue{value='Today'}' is not a valid 'Date'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 28 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"checkIn": null | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...oprofile-graphql/src/main/resources/overrides/invalidLocalTimeFormattedValue/output3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "argument 'time' with value 'StringValue{value='Today'}' is not a valid 'Time'", | ||
"locations": [ | ||
{ | ||
"line": 2, | ||
"column": 57 | ||
} | ||
] | ||
} | ||
], | ||
"data": { | ||
"startPatrollingWithCorrectDateFormat": null | ||
} | ||
} |
Oops, something went wrong.