apollographql / apollographql/apollo-tooling
Codegen fails on "AType" vs "AType!"
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
**Intended outcome:**
Code generation works
**Actual outcome:**
Code generation does not work
**How to reproduce the issue:**
I'm attempting to generate some code to access the Github v4 API. I've got this query I've built using github's GraphQL API Explorer: https://gist.github.com/davedelong/f18f4aa29b1b3938e4e15dc9122ac019
In my project in Xcode 11.2, I've added the "Run Script" build phase as instructed by the documentation, and am passing in my graphql file, as well as the Github schema file I downloaded from here: https://developer.github.com/v4/public_schema/
When I attempt to build, I'm getting an error from the code generator:
```
./GraphQL/RecentPRs.graphql:87: error: Fields "commit" conflict because they return conflicting types Commit! and Commit. Use different aliases on the fields to fetch both if this was intentional.
./GraphQL/RecentPRs.graphql:25: error: Fields "commit" conflict because they return conflicting types Commit! and Commit. Use different aliases on the fields to fetch both if this was intentional.
```
**Versions**
I am using the latest version of Apollo.
Contributor guide
Research direction
Start with the conflicting fields at lines 25 and 87 of GraphQL/RecentPRs.graphql, the downloaded GitHub schema, and the code generator invoked by the Xcode Run Script. Reproduce the Commit! versus Commit error with the supplied query and schema; done means the generator accepts the query and the project builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100