Similar to your comment about unions not be implemented yet, what about interfaces?
See original GitHub issueThis works when querying github, though snowflaq cannot validate it w/“unknown field author”
{
"name": "author",
"description": "The actor who authored the comment.",
"args": [],
"type": {
"kind": "INTERFACE",
"name": "Actor",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
query GetPullRequests($org: String!) {
organization(login: $org) {
name
url
repositories(first: 100) {
nodes {
name
pullRequests(first: 100, states: OPEN) {
nodes {
number
title
url
body
author {
login
}
reviews(last: 10, states: APPROVED) {
nodes {
author {
login
}
}
}
}
}
}
}
}
}
** this could just be me not knowing much about graphql…
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
typescript - When to use Discriminated Unions vs Classes ...
The key difference between discriminated unions and interfaces is that interfaces are open for extension, but unions are not.
Read more >c# - In what way are union types better for correctness than ...
Note that interfaces and union types have dual properties. An interface makes it easy to introduce new alternatives (the implementing classes) ...
Read more >remove union types and allow interfaces to have no fields ...
As you quoted from the spec, Unions are defined locally while Interfaces are defined by implementation of each Object type. This models the...
Read more >Types vs. interfaces in TypeScript
It can be difficult to choose between types and interfaces in TypeScript, but in this post, you'll learn which to use in specific...
Read more >Union types - #120 by kyay10 - Language Design
Right now, as I am writing an app in Kotlin, my project is littered with enum classes like SignInError, NetworkError, ExecuteRequestError, and they...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @mattsonlyattack,
It has been a long and exciting weekend. I think I have got this implemented like it should 😁 Snowflaqe now understands both GraphQL interfaces and unions, generates the corresponding F# union types and verifies the used fields just like it does with objects. The only requirement is that the subtypes both on interfaces and unions must now add a
__typenamefield and will otherwise throw a validation error. This field is used for deserialization.It would be great if you could put this version to the real test and run it against the Github schema that you working with. You have to modify your query slightly into this:
Please let me know how it goes and whether everything works for you 😄
@mattsonlyattack Thanks a lot for the sample queries! I think I know now where to look to find a solution. I am afraid however that it will be quite the challenge to implement this feature. I can’t promise a timeline but I will definitely look into it soon