GraphQL 8 Flashcards

1
Q

How can you write inline fragment when types in a union implement the same interface?

A

union SearchResult = Human | Droid | Starship

Since Human and Droid share a common interface (Character), you can query their common fields in one place rather than having to repeat the same fields across multiple types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the input type?

A

More often scalar values, like enums or strings, are passed as arguments into a field.

But you can also easily pass complex objects. This is particularly valuable in the case of mutations, where you might want to pass in a whole object to be created.

In the GraphQL schema language, input types look exactly the same as regular object types, but with the keyword input instead of type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you mix regular types and input types?

A

The fields on an input object type can themselves refer to input object types, but you can’t mix input and output types (just type) in your schema.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Can input types have arguments on their fields?

A

Input object types can’t have arguments on their fields.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly