apollographql / apollographql/apollo-tooling

Code generation is creating Swift code that won't compile in 4.0 or 4.2

Open
#998 1 comment 0 reactions 0 assignees View on GitHub
:bird: component - swift 🤖 component - codegen
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

The following query seems to be generating code that isn't valid.

```graphql
query WirelessInfoQuery($listingId: Long!) {
miso {
wirelessInfos(request: { listingId: $listingId }) {
wirelessInfos {
...WirelessInfo
}
}
}
}

mutation WirelessInfoWrite($listingId: Long!, $wirelessInfo: [MisoWirelessInfoWriteOnlyInput]){
miso {
updateWirelessInfos(request: {
listingId: $listingId
wirelessInfos: $wirelessInfo
}) {
wirelessInfos {
...WirelessInfo
}
}
}
}

fragment WirelessInfo on MisoWirelessInfoReadOnly {
id
wirelessSsid
wirelessPassword
wirelessType
}
```

screen shot 2019-02-08 at 3 35 38 pm

I am using Apollo 0.9.5.

You will notice in the leading side panel that there are a few other failures as well.

Let me know what other info I can provide to help debug this.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the GraphQL query and mutation with Apollo 0.9.5, then inspect the generated Swift output and the compiler failures under Swift 4.0 and 4.2. Done means the generated code compiles in both versions and the other reported failures are understood or covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, swift, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.