-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Fix extracting the type from GraphQLNonNull in getProps #460
Conversation
The internal type stored in `GraphQLNonNull` was never extracted as the whole `field` needs to be passed according to `extractFromNonNull` definition.
I think we have to decide either extractFromNonNull returns a This still not pass : if (
fieldType instanceof graphql.GraphQLScalarType &&
fieldType.name === 'Float'
) {
ready.decimal = true
} Because to refer to the internal type, we need to do |
It should return the underlying type, so |
I added the failing case by making the decimal a non nullable. Now we can see that we never pass into : if (fieldType instanceof graphql.GraphQLScalarType && fieldType.name === 'Float') {
ready.decimal = true;
} As you say, const extractFromNonNull = type => type && type instanceof graphql.GraphQLNonNull ? type.ofType : type; |
Huh, I'm not sure anymore. I'm not really sure about what the implementation should be, but I think that two things are important here: one, we need to pass I'll get to it later today. |
OK, so: const fieldType = extractFromNonNull(field).type; Seems to work. Can you check if it works for you too? |
It works! 👍 |
Codecov Report
@@ Coverage Diff @@
## master #460 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 157 157
Lines 1404 1404
=====================================
Hits 1404 1404
Continue to review full report at Codecov.
|
The internal type stored in
GraphQLNonNull
was never extracted as the wholefield
needs to be passed according toextractFromNonNull
definition.