Hello, is there an equivalent or a way to implemen...
# graphql-kotlin
j
Hello, is there an equivalent or a way to implement the
@constraint
directive from ApolloGraphQL? https://www.apollographql.com/blog/backend/validation/graphql-validation-using-directives/
Copy code
type SignUpInput {
  email: String! @constraint(format: "email", maxLength: 255)
  password: String! @constraint(maxLength: 255)
}
d
j
Thank you. Following the official samples, I created an annotated
ConstraintDirective
and its
ConstraintDirectiveWiring
which I registered in a `KotlinDirectiveWiringFactory`which itself is registered as hooks inside a
SchemaGeneratorConfig
But still the directive does not appear in the generated GraphQL Schema. I'm using ktor. Is there maybe some magic that works only with Spring Boot?
d
Sounds like it should work, can you share a repo?
👀 1
s
Just to clarify, the
@constraint
directive you are referring to is a schema or server side directive and is logic that is applied to the field on every client operation with out them specifying anything. The HTTP framework should not matter. Also it is not from Apollo, it is from the GitHub user
confuser
https://github.com/confuser/graphql-constraint-directive
j
d
👍 I'll take a look today