Skip to content

[RFC] Add note recommending directive names to be namespaced #657

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

Merged
merged 4 commits into from
Jan 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,11 @@ and operations.
As future versions of GraphQL adopt new configurable execution capabilities,
they may be exposed via directives.

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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 ».

Copy link
Contributor

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.

Copy link
Collaborator

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.


**Directive order is significant**

Directives may be provided in a specific syntactic order which may have semantic interpretation.
Expand Down