-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This diff connects the enables Terse Syntax with the new Relay Resolver Models. I want to have another pass over `relay-docblock` parser after this diff. Currently, we're passing `schema` to some of the methods in the `RelolverIr` trait, we can probably avoid this, and make it a little cleaner. But for now, to make it work, let's keep it simple. Specifically, in this diff - OutputType of the terser resolver is `Pending` and we are processing this pending type during the schema extension generation (where we have access to `&SDLSchema` - Fixed directives for terser syntax (these should be defined on the field, not on the type). - Implementation for `root_fragment` is shared between Resolver and TerserResolver IR --- ## Comparison of the old and the new API: Before: ``` type MyClientType { id: ID! } /** * RelayResolver * onType MyClientType * fieldName self * rootFragment MyClientType_selfFragment * live */ function MyClientType_self(rootKey: MyClientType_selfFragment$key): MyClientTypeFlow { const data = readFragment(graphql` fragment MyClientType_selfFragment on MyClientType { id }`, rootKey, ); return externalState.readAndSubscribe(data.id); } ``` After: ``` /** * RelayResolver MyClientType * live */ function MyClientType(id: DataID): MyClientTypeFlow { return externalState.readAndSubscribe(string); } ``` ### Individual Resolvers Before: ``` /** * RelayResolver * onType MyClientType * fieldName description */ function MyClientType_description(rootKey: MyClientType_descriptionFragment$key): string { const data = readFragment(graphql` fragment MyClientType_descriptionFragment on MyClientType { self }`, rootKey, ); return data?.self?.description } ``` After: ``` /** * RelayResolver MyClientType.description: String */ function MyClientType(instance: ?MyClientTypeFlow): ?string{ return instance?.description; } ``` Reviewed By: captbaritone Differential Revision: D40541088 fbshipit-source-id: 0ad921f845c7360738fa909430c3acacb7fa865d
- Loading branch information
1 parent
ef41099
commit 3a151b4
Showing
9 changed files
with
108 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.