Skip to content

Some directives should apply to the ID type #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paul-pop opened this issue Aug 28, 2020 · 2 comments
Closed

Some directives should apply to the ID type #21

paul-pop opened this issue Aug 28, 2020 · 2 comments

Comments

@paul-pop
Copy link

paul-pop commented Aug 28, 2020

First and foremost, thank you for this library, it's fantastic and I hope it gets the love it deserves 🙂

I am currently seeing an issue when I try to add certain directives to ID fields:

Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'graphQLSchema' threw exception; nested exception is graphql.AssertException: The directive rule '@NotBlank' cannot be placed on elements of type 'ID'"

I think some directives like @NotEmpty, @NotBlank to start off would really help on ID fields. If you want to be extra safe we could even add @Pattern, @Expression, @Size and others later.

If I get the chance I will work on this and raise a PR but currently a bit swamped.

@setchy
Copy link
Collaborator

setchy commented Sep 19, 2020

@paul-pop - I got some time this morning and added ID scalar support to @Pattern, @NotEmpty, @NotBlank and @Size. @Expression already supports all types.

PR #24

bbakerman added a commit that referenced this issue Sep 19, 2020
…Size (#24)

* Adding support for ID scalar type to Pattern, NotEmpty, NotBlank and Size constraints as per #21

* Update README.md

(cherry picked from commit 9d6efff)

* Update README.md

tweaks

(cherry picked from commit d8ba27b)

Co-authored-by: Brad Baker <[email protected]>
bbakerman pushed a commit that referenced this issue Sep 19, 2020
bbakerman added a commit that referenced this issue Sep 19, 2020
@setchy
Copy link
Collaborator

setchy commented Sep 22, 2020

@bbakerman just wanted to confirm if we close this issue after we've released new versions of 14.x.x and 15.x.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants