-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
relay-compiler - @stream argument naming does not follow spec: initialCount
vs initial_count
?
#3619
Comments
initialCount
or initial_count
? initialCount
vs initial_count
?
initialCount
vs initial_count
? initialCount
vs initial_count
?
Thanks for the report!
Our overall plan is to deprecate the current JS compiler: #3180. So all our current efforts are focused on that, and we're not planning on adding/fixing issues in the JS version. |
@alunyov Are you sure that rust one has not equal problem ? I can see usage of The problem is most of servers fully follow GraphQL spec with it is not possible to compile.... because compiler use different arg. naming as specification and throw always error... This is from rust sources
Can be find directly in tests |
Yeah, our implementation is based on Facebook's internal implementation of stream and defer upon which the official GraphQL spec version was based. However the spec made some changes such as renaming some fields. We have an outstanding task to update to support the OSS spec in addition to our internal version. |
Heh ok understand that... Good thanks, that server I'm using able me to override core framework types so i can use it.. Because this is usually hardcoded on both sides.. |
Fairly sure this is all you need to override in a server to be Relay compliant: |
@maraisr Nice to see also this workeround... I'm currently doing this on server since HC enable to write TypeInterceptor. But yes thats server specific workeround.. public class StreamTypeInterceptor : TypeInterceptor{
#nullable enable
public override void OnBeforeCompleteType(
ITypeCompletionContext completionContext,
DefinitionBase? definition,
IDictionary<string, object?> contextData)
{
#nullable disable
if(definition is DirectiveTypeDefinition directiveTypeDefinition
&& directiveTypeDefinition?.RuntimeType == typeof(StreamDirective)){
var InitCountArg = directiveTypeDefinition.Arguments
.First(e=>e.Property?.Name == "InitialCount");
if(InitCountArg != null){
InitCountArg.Name = "initial_count";
}
}
}
} (+) You need the Document rewrite middleware (iterate and rewrite stream SintaxNodes in tree) since HC use some hardcoded constant.. So TypeInterceptor only adapt schema but not execution stuff.. |
Ya just a rename and all is well. 🚀 Hope this lands in OSS under similar flags as the other things do. |
Current compiler (not rust experimental) require for @stream argument naming as @stream(
initial_count
:value) but gql-specification define this asinitialCount
...If i go over sources relay specialy check for
nitial_count
naming :relay/packages/relay-compiler/transforms/DeferStreamTransform.js
Line 119 in a07750f
If GraphQL server follow schema specification (
initialCount
) it is not possible to compile with error:Schema specification for @defer and @stream:
https://graphql.org/blog/2020-12-08-improving-latency-with-defer-and-stream-directives/
or
https://github.com/graphql/graphql-spec/pull/742/files
Compiler should follow schema specification or don't check this and use type from schema definition...
Versions:
"relay-compiler": "12.0.0",
The text was updated successfully, but these errors were encountered: