question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I have three type.

class A(InputType):
    pass

class B(InputType):
    start_time = String()

class C(InputType):
    start_time = String()
    end_time = String()

So I hope that:

class T(Union):
    class Meta:
        types = (A, B, C)

the data maybe like:

{_type: A}
{_type:B, start_time: xxxx}
{_type:C,  start_time:xxx, end_time: xxx}

By the way, why an ObjectType or InputType must have fields?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
fcoclaverocommented, Mar 2, 2021

@jkimbo the input union spec was updated on the GraphQL RFC.

2reactions
yywingcommented, May 7, 2018

And I think it is a very normal usage.Is there any way to solve it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL Union and Input Type?
Is it possible in GraphQL to have an input type that is also a union? Something like:
Read more >
graphql-wg/InputUnion.md at main
Migrating a field to a polymorphic input type is non-breaking G. Input unions may include other input unions H. Input unions should accept...
Read more >
What's the best way to input union types? : r/graphql
I was really counting on this but recently found out that this is not possible in the current specification.
Read more >
Reaching Consensus: GraphQL Input Unions
GraphQL Unions represent an object that could be one of a list of GraphQL ... PostInput input type for text-based posts input PostInput ......
Read more >
Unions
Read more about the GraphQL Union Type in the official GraphQL docs. Usage. Let's start by creating the object types from the example...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found