-
Notifications
You must be signed in to change notification settings - Fork 2k
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] Added support for repeatable directives #1541
Changes from 4 commits
cab37c7
ea40e38
7eb1fd7
8cd0e52
77f85b3
20deb26
1180d92
f8378d0
3b5bf03
3a7fafa
ae9e7f9
56fee7d
0dff21f
1a07bd9
89f5780
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,6 +33,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string { | |||||||||||
args { | ||||||||||||
...InputValue | ||||||||||||
} | ||||||||||||
repeatable | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OlegIlyenko As discussed on the working group we can't assume that legacy servers would support I would suggest making option graphql-js/src/utilities/introspectionQuery.js Lines 12 to 16 in f8378d0
Long term solution would be to implement two-stage introspection as suggested by Lee. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good point, I added an option for it 3b5bf03 I also made if disabled by defult in order to maintain backwards compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also this one: 3a7fafa I forgot to update the introspection flow type |
||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
@@ -273,4 +274,5 @@ export type IntrospectionDirective = {| | |||||||||||
+description?: ?string, | ||||||||||||
+locations: $ReadOnlyArray<DirectiveLocationEnum>, | ||||||||||||
+args: $ReadOnlyArray<IntrospectionInputValue>, | ||||||||||||
+repeatable: boolean, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OlegIlyenko Can you please address this comment in spec RFC: It blocks this PR but I think we should discuss it in the scope of spec RFC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please describe in more detail what kind of information you would like to add? I'm not 100% sure I understood your comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OlegIlyenko I mean if merge this PR that will expose Everything else in this PR looks good so would be great to discuss this last point but since this PR is just an implementation of spec RFC I think we should discuss it in spec PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks for the clarification. Sure thing, I will open a discussion on this topic in the RFC PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OlegIlyenko I feel very stupid because in the first comment of this thread I linked review comment I forget to submit (review comments UI is very weird). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 i see, thanks! now it's clear, i was confused about wrong link There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did the renaming 56fee7d I will adjust the spec text accordingly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I just saw this comment. Sorry for the late comment: I guess keeping consistent with |
||||||||||||
|}; |
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.
In JS you can do that with a single
config.repeatable == null
and we already using it in couple places.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 believe
config.repeatable === undefined
is still necessary since I defined the flow type like this:If I don't do the check, I will get following flow error:
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.
@OlegIlyenko Note
== null
(two equal signs) compares both tonull
andundefined
and Flow should handle it without problems.It's because you use
===
instead of==
.It's safe and very common pattern in JS to do
== null
:https://eslint.org/docs/rules/eqeqeq#smart
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.
Ah, I see. Haven't noticed this, thanks for the clarification.
I got an impression that the use of
==
is discouraged in javascript community since it relies of a set of coercion rules that many people find error-prone. This is why I tried to avoid using it. I was not aware of the exceptions described in the eslint documentation though. I will update the code and use==
.