-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Add __typename
to generated classes
#151
Comments
Alternatively, there is a proposal (2) in the #126. For example, for the union called public interface IAssignee { }
public class Team : IAssignee
{
public string Name { get; set; }
}
public class Employee : IAssignee
{
public string FullName { get; set; }
} Usage: var assignee = QueryAssignee();
var greeting = assignee switch
{
Team team => $"Hello {team.Name}!",
Employee employee => $"Hello {employee.FullName}!",
_ => throw new ArgumentException($"Unexpected assignee type {assignee.GetType().Name}", nameof(assignee))
}; |
I think it should deserialize into appropriate type just as interfaces do. |
I'll implement it during this week. |
It would be great if the generated classes had the
__typename
field, which is needed when dealing with unions.The text was updated successfully, but these errors were encountered: