Closed ZeroWM closed 1 year ago
Have you created a config file ? My code wasnt working because of that Here's mine,
@Configuration public class ValidationDirectiveConfig {
@Bean
public RuntimeWiringConfigurer runtimeWiringConfigurer() {
ValidationRules validationRules = ValidationRules.newValidationRules()
.onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL)
.build();
ValidationSchemaWiring schemaWiring = new ValidationSchemaWiring(validationRules);
return builder -> builder.directiveWiring(schemaWiring).build();
}
}
implementation('com.graphql-java:graphql-java-extended-validation:19.0')
in the build.gradledirective @NotBlank(message : String = "graphql.validation.NotBlank.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @Size(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Size.message")on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
extend type Mutation { createVirtualGPU(input: CreateVirtualGPUInput): ClusterGPU }
input CreateVirtualGPUInput{ gpuType: GPUType partition: Int = 0 @Size(min : 2, max : 10) count: Int = 0 @Size(min : 1, max : 1000) name: String! @Size(min : 1, max : 100) @NotBlank }
when i tested the code, it doesn't work , don't throw any exception, can you tell me what's the problem in my code?