Closed
Description
Hi extended-validation team,
I'm facing an issue where nested input objects are not being validated by the validation jar.
I've done the following
- Defined the directive in the SDL
directive @Size(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Size.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
- Defined the directive annotation against the input field
input NameRequest {
# The title associated to the name
title: String @Size(min : 1, max : 1)
# The given name
givenName: String! @Size(min : 1, max : 1)
# Middle Name
middleName: String
# Last Name
surName: String!
}
- Add the SchemaDirectiveWiring
@Bean
public SchemaDirectiveWiring initializeValidators() {
/*
* Can add new rules, but on default it will apply the standard set found in {@link
* DirectiveConstraints}
**/
ValidationRules validationRules = ValidationRules.newValidationRules()
.onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL).build();
return new ValidationSchemaWiring(validationRules);
}
I am using graphql-kickstart-springboot, graphql-java 14.1 and graphql-java-tools from graphql-kickstart.
What is successful is argument based validation. The following kicks off the validation
createProgram(
#Your partner id
partnerId: String! @Size(min: 1, max:1),
# The program request
programRequest: ProgramRequest!) : Program!
I saw an earlier post that nested validations were solved, but I am not seeing ValidationSchemaWiring.onField being called for Input Types.
Metadata
Metadata
Assignees
Labels
No labels