Skip to content
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

Order of @Directives relevant or not #590

Closed
jjn1056 opened this issue Jun 12, 2019 · 2 comments
Closed

Order of @Directives relevant or not #590

jjn1056 opened this issue Jun 12, 2019 · 2 comments

Comments

@jjn1056
Copy link

jjn1056 commented Jun 12, 2019

While working on the GraphQL implementation for Perl we are pondering if the order of Directives (where there is more than one) is important and should be preserved or not. I can't see to find anything in the specifications. Here's a use case I might have:

type User {
  first: String! @length(max: 50)
  last: String! @length(max: 50)
  nickname: String! @lowercase @unique
}

In this case I have a custom directive that requires the nickname to be unique but also that I have a filter that lower cases the nickname. Clearly to properly check the uniqueness I'd want to normalize the incoming data first. Possibly this is an abuse of the Directives system :) However I think it would be wise for the specification to clearly indicate if order is relevant and should be preserved (and processed in order) or if order should definitely not be counted on for 'pipelining' directives (in which my above use case is invalid and should be avoided).

@IvanGoncharov
Copy link
Member

@jjn1056 Thanks for detail description 👍
Currently, there is a #470 RFC to make directive order significant and ATM it's Stage 3 so it's mean it's almost merged.
You can track all RFC and their status here: https://github.com/graphql/graphql-spec/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc

@jjn1056
Copy link
Author

jjn1056 commented Jun 12, 2019

@IvanGoncharov thanks for clarifying this, and sorry I didn't see the RFC. I did a lot of searching on google and in the repository but I never came across that. We will build our library on the assumption that ordering is needed but I will follow that RFC and make any needed changes that are late occurring.

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

2 participants