This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
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
Weakky
force-pushed
the
feature/enums-support
branch
2 times, most recently
from
November 4, 2018 22:34
439e697
to
12382b6
Compare
Weakky
force-pushed
the
feature/enums-support
branch
from
November 4, 2018 23:09
12382b6
to
561ac12
Compare
schickling
suggested changes
Nov 5, 2018
@@ -141,8 +142,7 @@ export namespace PostResolvers { | |||
export namespace UserResolvers { | |||
export const defaultResolvers = { | |||
id: (parent: User) => parent.id, | |||
name: (parent: User) => | |||
parent.name === undefined || parent.name === null ? null : parent.name, | |||
name: (parent: User) => (parent.name === undefined ? null : parent.name), |
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.
Any reason why ()
is needed here?
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.
The parenthesis aren't in the code generator. They must be added by prettier somehow 😕
packages/graphqlgen-templates/typescript-yoga/src/generated/graphqlgen.ts
Show resolved
Hide resolved
I've released a first version which can be installed via |
schickling
approved these changes
Nov 5, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a proper TS/Flow parser to be able to make valuable comparisons between GraphQL and Model types.
Support Enum as scalar values (GraphQL enums are always inlined in graphqlgen.ts)
Support smart code generation/scaffolding:
Given the following GraphQL types:
and the following model type:
the resolver for the
penColor
field will be generated as adefaultResolver
if:ModelColor
is a subset or has the same values asColor
. That is to say ifModelColor
is of type:type ModelColor = 'RED'
type ModelColor = 'BLUE'
type ModelColor = 'GREEN'
type ModelColor = 'RED' | 'BLUE'
type ModelColor = 'RED' | 'GREEN'
type ModelColor = 'BLUE' | 'GREEN'
type ModelColor = 'RED' | 'BLUE' | 'GREEN'
etc..or if
penColor
is of type:penColor: 'RED'
penColor: 'BLUE'
penColor: 'GREEN'
penColor: 'RED' | 'BLUE'
penColor: 'RED' | 'GREEN'
penColor: 'BLUE' | 'GREEN'
penColor: 'RED' | 'BLUE' | 'GREEN'
etc..