Skip to content

Unwrap non-null types#20

Merged
jneurock merged 2 commits intokloeckner-i:masterfrom
jgwhite:unwrap-non-null-selections
Jun 19, 2019
Merged

Unwrap non-null types#20
jneurock merged 2 commits intokloeckner-i:masterfrom
jgwhite:unwrap-non-null-selections

Conversation

@jgwhite
Copy link
Copy Markdown
Contributor

@jgwhite jgwhite commented Jun 18, 2019

We ran into the following error due to having non-null edges fields in our schema:

type FooConnection {
  edges: [FooNode!]!
  #              ↑ ↑
}
Cannot read property 'cursor' of undefined

And a similar issue with non-null mutation return types:

mutation {
  createFoo(input: CreateFooInput!): CreateFooResult!
  #                                                 ↑
}
Cannot read property 'replace' of undefined

This PR adds examples of non-null edges and non-null mutation return types to the schema and the accompanying logic to unwrap non-null types as required.

We deliberately modified only one of the two occurrences of edges to ensure it continues to work both ways.

We’ve been slightly lazy an amended the single existing mutation rather than adding a second mutation to test against. Happy to add an explicit mutation example if needsbe.

We ran into the following error when we had a non-null `edges` field in
our schema (with a non-null type within the collection):

    Cannot read property 'cursor' of undefined

This patch adds a similar non-null `edges` field to the schema and adds
code to unwrap non-null types when inferring the type of a selection.
@jgwhite jgwhite force-pushed the unwrap-non-null-selections branch from 96aab5e to 29905db Compare June 18, 2019 11:36
@jgwhite
Copy link
Copy Markdown
Contributor Author

jgwhite commented Jun 18, 2019

Looks like CI is failing because the coverage report isn’t being generated:

cat: coverage/lcov.info: No such file or directory

@jgwhite jgwhite force-pushed the unwrap-non-null-selections branch from 73275c2 to cede4a8 Compare June 18, 2019 12:06
@jgwhite jgwhite changed the title Unwrap non-null types during selection type inference Unwrap non-null types Jun 18, 2019
@jneurock
Copy link
Copy Markdown
Contributor

Hey! Thanks for the contribution. It looks like the coverage issues were an issue with Travis.

@jneurock jneurock merged commit f702ee6 into kloeckner-i:master Jun 19, 2019
@jgwhite jgwhite deleted the unwrap-non-null-selections branch June 19, 2019 07:58
@jgwhite
Copy link
Copy Markdown
Contributor Author

jgwhite commented Jun 19, 2019

Awesome. Thanks @jneurock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants