graphql-constraint-directive
graphql-constraint-directive copied to clipboard
Using "uniqueTypeName: Int" behalves unexpected
When using limit: Int @constraint(uniqueTypeName: "Int", min: 1, max: 200),
I would expect the validation to still run. However no errors are generated.
Is this expected behavior? Is this something this library should support?
I get that conceptually there could be two types of "Int" (one with a constraint and one without) - which goes a little against the graphql schema logic. Consider throwing an assert maybe?
I'm honestly not sure what the correct path of action is here
Yes, this is expected. The validation won't run in this case; as the name suggests it needs to be a unique name. Under the hood, this module auto generates a unique type for anything decorated with the directive.
The correct action would be to throw an error if it's a type name which already exists
@confuser OK thank you for the reply! Should this issue be labeled improvement then?