-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metadata for graphql-java-extended-validation
- Loading branch information
Showing
15 changed files
with
206 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
metadata/com.graphql-java/graphql-java-extended-validation/19.1/index.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,5 @@ | ||
[ | ||
"proxy-config.json", | ||
"reflect-config.json", | ||
"resource-config.json" | ||
] |
7 changes: 7 additions & 0 deletions
7
metadata/com.graphql-java/graphql-java-extended-validation/19.1/proxy-config.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,7 @@ | ||
[ | ||
{ | ||
"interfaces": [ | ||
"graphql.validation.interpolation.ResourceBundleMessageInterpolator$BridgeAnnotation" | ||
] | ||
} | ||
] |
14 changes: 14 additions & 0 deletions
14
metadata/com.graphql-java/graphql-java-extended-validation/19.1/reflect-config.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 @@ | ||
[ | ||
{ | ||
"name": "graphql.schema.DataFetchingEnvironmentImpl", | ||
"methods": [ | ||
{ | ||
"name": "getLocale", | ||
"parameterTypes": [] | ||
} | ||
], | ||
"condition": { | ||
"typeReachable": "graphql.GraphQL" | ||
} | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
metadata/com.graphql-java/graphql-java-extended-validation/19.1/resource-config.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,7 @@ | ||
{ | ||
"bundles": [ | ||
{ | ||
"name": "graphql.validation.ValidationMessages" | ||
} | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
metadata/com.graphql-java/graphql-java-extended-validation/index.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,10 @@ | ||
[ | ||
{ | ||
"latest": true, | ||
"metadata-version": "19.1", | ||
"module": "com.graphql-java:graphql-java-extended-validation", | ||
"tested-versions": [ | ||
"19.1" | ||
] | ||
} | ||
] |
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
4 changes: 4 additions & 0 deletions
4
tests/src/com.graphql-java/graphql-java-extended-validation/19.1/.gitignore
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,4 @@ | ||
gradlew.bat | ||
gradlew | ||
gradle/ | ||
build/ |
28 changes: 28 additions & 0 deletions
28
tests/src/com.graphql-java/graphql-java-extended-validation/19.1/build.gradle
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,28 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck" | ||
} | ||
|
||
String libraryVersion = tck.testedLibraryVersion.get() | ||
|
||
dependencies { | ||
implementation "com.graphql-java:graphql-java-extended-validation:$libraryVersion" | ||
implementation "org.jboss.logging:jboss-logging:3.5.0.Final" | ||
implementation "org.hibernate.validator:hibernate-validator:7.0.4.Final" | ||
testImplementation 'org.assertj:assertj-core:3.22.0' | ||
} | ||
|
||
graalvmNative { | ||
binaries { | ||
test { | ||
buildArgs.add('--no-fallback') | ||
buildArgs.add('-H:IncludeLocales=fr') | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
tests/src/com.graphql-java/graphql-java-extended-validation/19.1/gradle.properties
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,2 @@ | ||
library.version = 19.1 | ||
metadata.dir = com.graphql-java/graphql-java-extended-validation/19.1/ |
13 changes: 13 additions & 0 deletions
13
tests/src/com.graphql-java/graphql-java-extended-validation/19.1/settings.gradle
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,13 @@ | ||
pluginManagement { | ||
def tckPath = Objects.requireNonNullElse( | ||
System.getenv("GVM_TCK_TCKDIR"), | ||
"../../../../tck-build-logic" | ||
) | ||
includeBuild(tckPath) | ||
} | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT" | ||
} | ||
|
||
rootProject.name = 'graphql-java-extended-validation-tests' |
69 changes: 69 additions & 0 deletions
69
...a/graphql-java-extended-validation/19.1/src/test/java/graphql/GraphQlValidationTests.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,69 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package graphql; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Locale; | ||
import java.util.function.Consumer; | ||
|
||
import graphql.schema.GraphQLSchema; | ||
import graphql.schema.StaticDataFetcher; | ||
import graphql.schema.idl.RuntimeWiring; | ||
import graphql.schema.idl.SchemaGenerator; | ||
import graphql.schema.idl.SchemaParser; | ||
import graphql.schema.idl.TypeDefinitionRegistry; | ||
import graphql.validation.rules.OnValidationErrorStrategy; | ||
import graphql.validation.rules.ValidationRules; | ||
import graphql.validation.schemawiring.ValidationSchemaWiring; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Brian Clozel | ||
*/ | ||
public class GraphQlValidationTests { | ||
|
||
|
||
@Test | ||
void validationErrorQuery() throws Exception { | ||
GraphQLSchema graphQLSchema = parseSchema("validation", runtimeWiringBuilder -> | ||
runtimeWiringBuilder.type("Query", builder -> | ||
builder.dataFetcher("hired", new StaticDataFetcher(true)))); | ||
GraphQL graphQl = GraphQL.newGraphQL(graphQLSchema).build(); | ||
ExecutionResult result = graphQl.execute("{ hired(application: {name: \"p\"}) }"); | ||
assertThat(result.getErrors()).isNotEmpty(); | ||
assertThat(result.getErrors().get(0).getMessage()).isEqualTo("/hired/application/name size must be between 3 and 100"); | ||
} | ||
|
||
@Test | ||
void validationErrorQueryInFrench() throws Exception { | ||
GraphQLSchema graphQLSchema = parseSchema("validation", runtimeWiringBuilder -> | ||
runtimeWiringBuilder.type("Query", builder -> | ||
builder.dataFetcher("hired", new StaticDataFetcher(true)))); | ||
GraphQL graphQl = GraphQL.newGraphQL(graphQLSchema).build(); | ||
ExecutionResult result = graphQl.execute(ExecutionInput.newExecutionInput("{ hired(application: {name: \"p\"}) }").locale(Locale.FRENCH).build()); | ||
assertThat(result.getErrors()).isNotEmpty(); | ||
assertThat(result.getErrors().get(0).getMessage()).isEqualTo("/hired/application/name la taille doit etre comprise entre 3 et 100"); | ||
} | ||
|
||
private GraphQLSchema parseSchema(String schemaFileName, Consumer<RuntimeWiring.Builder> consumer) throws IOException { | ||
try (InputStream inputStream = GraphQlValidationTests.class.getResourceAsStream(schemaFileName + ".graphqls")) { | ||
TypeDefinitionRegistry registry = new SchemaParser().parse(inputStream); | ||
ValidationRules validationRules = ValidationRules.newValidationRules() | ||
.onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL) | ||
.build(); | ||
ValidationSchemaWiring schemaWiring = new ValidationSchemaWiring(validationRules); | ||
RuntimeWiring.Builder runtimeWiringBuilder = RuntimeWiring.newRuntimeWiring(); | ||
runtimeWiringBuilder.directiveWiring(schemaWiring); | ||
consumer.accept(runtimeWiringBuilder); | ||
return new SchemaGenerator().makeExecutableSchema(registry, runtimeWiringBuilder.build()); | ||
} | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...est/resources/META-INF/native-image/graphql-validation-test-metadata/resource-config.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,13 @@ | ||
{ | ||
"bundles": [], | ||
"resources": { | ||
"includes": [ | ||
{ | ||
"pattern": "\\Qgraphql/validation.graphqls\\E", | ||
"condition": { | ||
"typeReachable": "graphql.GraphQL" | ||
} | ||
} | ||
] | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...java/graphql-java-extended-validation/19.1/src/test/resources/graphql/validation.graphqls
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,10 @@ | ||
type Query { | ||
hired (application : Application!) : Boolean | ||
} | ||
|
||
directive @Size(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Size.message") | ||
on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ||
|
||
input Application { | ||
name : String @Size(min : 3, max : 100) | ||
} |
1 change: 1 addition & 0 deletions
1
...ed-validation/19.1/src/test/resources/graphql/validation/ValidationMessages_fr.properties
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 @@ | ||
graphql.validation.Size.message={path} la taille doit etre comprise entre {min} et {max} |
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