@@ -0,0 +1,2279 @@
+package io.quarkus.smallrye.graphql.deployment;%0A%0Aimport static io.restassured.RestAssured.get;%0Aimport static org.hamcrest.Matchers.containsString;%0A%0Aimport javax.validation.Valid;%0Aimport javax.validation.constraints.Size;%0A%0Aimport org.eclipse.microprofile.graphql.GraphQLApi;%0Aimport org.eclipse.microprofile.graphql.Query;%0Aimport org.jboss.shrinkwrap.api.asset.EmptyAsset;%0Aimport org.jboss.shrinkwrap.api.asset.StringAsset;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.extension.RegisterExtension;%0A%0Aimport io.quarkus.test.QuarkusUnitTest;%0A%0A/**%0A * Basic test to verify that bean validation constraints on input fields are transformed into GraphQL directives when%0A * the option to include directives in the schema is enabled.%0A */%0Apublic class BeanValidationGraphQLDirectivesTest extends AbstractGraphQLTest %7B%0A%0A    @RegisterExtension%0A    static QuarkusUnitTest test = new QuarkusUnitTest()%0A            .withApplicationRoot((jar) -%3E jar%0A                    .addClasses(Person.class)%0A                    .addAsResource(new StringAsset(%22quarkus.smallrye-graphql.schema-include-directives=true%22),%0A                            %22application.properties%22)%0A                    .addAsManifestResource(EmptyAsset.INSTANCE, %22beans.xml%22));%0A%0A    @Test%0A    public void validateDirectivesPresentInSchema() %7B%0A        get(%22/graphql/schema.graphql%22)%0A                .then()%0A                .body(containsString(%22input PersonInput %7B%5Cn%22 +%0A                        %22  name: String @constraint(maxLength : 20, minLength : 5)%5Cn%22 +%0A                        %22%7D%5Cn%22))%0A                .body(containsString(%0A                        %22queryWithConstrainedArgument(constrained: String @constraint(maxLength : 123)): String%22));%0A    %7D%0A%0A    @GraphQLApi%0A    public static class ValidationApi %7B%0A%0A        @Query%0A        public String query(@Valid Person person) %7B%0A            return null;%0A        %7D%0A%0A        @Query%0A        public String queryWithConstrainedArgument(@Size(max = 123) String constrained) %7B%0A            return null;%0A        %7D%0A%0A    %7D%0A%0A    public static class Person %7B%0A%0A        @Size(min = 5, max = 20)%0A        private String name;%0A%0A        public String getName() %7B%0A            return name;%0A        %7D%0A%0A        public void setName(String name) %7B%0A            this.name = name;%0A        %7D%0A    %7D%0A%0A%7D%0A

Test for bean validation directives