-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[RFC] Add note recommending directive names to be namespaced #657
Conversation
Implements #646 |
spec/Section 2 -- Language.md
Outdated
Note: When defining a directive, it is recommended to namespace the directive name | ||
to prevent name collisions with directives added in future versions of the specification. | ||
For example, `@fb_auth` directive would represent an authentication directive | ||
with the prefix `fb` as namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus, we are talking about the prefix, and not about the namespace. GraphQL has no concept of namespaces. Perhaps the term namespace is not worth mentioning at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other term would you use then?
I didn’t want to only use the term « prefix » because it focuses on the how rather than what we are trying to achieve. One can use any other technique like suffixing if they prefer, to achieve « namespacing ».
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say that the term namespace should not be used, because as a rule a certain meaning is invested in it. In addition, some syntax rules are always associated with namespaces. There is nothing here. Despite the fact that someone may not like the term prefix (I don't like it either), it is described here - without clear syntax rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, especially since there's been past discussion about adding namespaces as a first class concept to GraphQL. We didn't follow that path, but we both want to avoid confusion and make sure that in some rare case we revisit namespaces that we don't accidentally create an ambiguity here.
👍 from me on the intent, just some details to iron out.
I could be wrong, but I think the term "custom" and is well-understood in this context already? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge thanks for getting this started and my apologies for the late review.
I'll make some editorial edits and get this merged.
spec/Section 2 -- Language.md
Outdated
Note: When defining a directive, it is recommended to namespace the directive name | ||
to prevent name collisions with directives added in future versions of the specification. | ||
For example, `@fb_auth` directive would represent an authentication directive | ||
with the prefix `fb` as namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, especially since there's been past discussion about adding namespaces as a first class concept to GraphQL. We didn't follow that path, but we both want to avoid confusion and make sure that in some rare case we revisit namespaces that we don't accidentally create an ambiguity here.
As discussed in the 2012-12-05 working group meeting, this informal RFC proposes adding a non-normative note recommending directive names to be namespaced to prevent name collisions when the specification adds new directives.
Motivation / Context
The Custom Scalar Specification URIs RFC was discussed during multiple working group meetings and the potential winning approach involves defining a new standard directive named
@specified
. Existing GraphQL schemas that already defined this directive would now break as directive names must be unique. To prevent this inconvenience, it was proposed we add an explicit note to the specification recommending schema designers to prefix/namespace directive names to prevent name collisions when upgrading their GraphQL server.Open Questions