nerdsupremacist / Graphaello

A Tool for Writing Declarative, Type-Safe and Data-Driven Applications in SwiftUI using GraphQL

Home Page:https://graphaello.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

graphaello add throws Fatal error

eruveo opened this issue · comments

Can anybody explain to me why my API generation throws an error? I am using graphcms.com.

Screen Shot 2021-08-10 at 8 35 39 pm

graphaello add --apiName GAPI https://api-eu-central-1.graphcms.com/v2/ckqxy4gw1m2gb01z6gj25c7nf/master

It does generate the json, but nothing in Graphaello.swift.

Thanks,
Michal

Thank you for reporting this issue.

Sounds like some assertion failed while trying to convert some default GraphQL Value to Swift code. I'll take a look at it closely tomorrow

Should be fixed with 0.1.0-beta.8

The actual issue was a mistake I made in the GraphQL Parser. It misinterpreted boolean values to be enum cases, and those didn't match up with the type expected.

If you're using Homebrew just run:

brew upgrade graphaello

Thank you for the link to the API, that's a tricky one. Found a lot of other bugs using that one ❤️
Other faults found with this API include:

  • Connections in this API have nonNull arrays, and Graphaello didn't recognize them as connections
  • Some of the fields and arguments are named like swift keywords and need backticks in the generated code. For example: "where"
  • Some of the input types where recursive, making structs not very effective for storing the input values. The generated code now just creates an initializer but doesn't store anything. If the type is every actually used, we switch to using Apollo's types instead, who use a dictionary instead of a struct