Docs: graphql.org/learn Flashcards

1
Q

Query and Mutations / Operation name

What is operation name?

A

Any operation can be prefixed by operation type (query/mutation/subscription) and operation name.

Required in multi-operation documents.

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

Query and Mutations / Operation name

What are operation types?

A
  1. query
  2. mutation
  3. subscription
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Queries and Mutations / Fragments

Can fragments use variables?

A

Fragments can access variables declared in the query or mutation.

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

Query and Mutations / Variables

3 types of variables.

A
  1. Scalars
  2. Enums
  3. Input types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Query and Mutations / Inline Fragments

What is inline fragment?

A

It’s a fragment defined withing a query. Used for interfaces and unions.

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

Queries and Mutations / Inline Fragments

Is it possible to find out the concrete type (when union or interface was used)?

A

Yes, using meta field like __typename

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

Schemas and Types / Arguments

Is it correct

type Starship {

id: ID!name: String!

length(unit: LengthUnit! = METER): Float

}

A

No, only optional arguments can have default values.

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

Schemas and Types / Scalar Types

Is Date an official scalar type?

A

No, it has to be implemented as custom scalar type.

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

Schemas and Types / Lists and Non-Null

Is

myField: null

valid for

myField: [String]!

?

A

No

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

Schemas and Types / Interfaces

Do you need to provide interface fields in a type implementing an interface?

A

Yes.

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

Schemas and Types / Input Types

Can input type contain a field being a type?

A

No, it has to be also an input type.

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

Schemas and Types / Input Types

Can input type fields have arguments?

A

No.

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

Validation

Can fragment refer to itself?

A

No, as this could result in an unbounded result!

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

Validation

Can we return type without specifying any field?

A

No, the graph leaves must be scalar type.

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

Introspection?

Can you ask GraphQL for a schema?

A

Yes, using __schema query.

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

Introspection

Why type/name is null for fields
id: ID!

friends: [String]

appearsIn: [Episode!]!

A

Because they are wrapper types (not null/list) and ofType must be used to find out what is the type.

17
Q

Global Object Identification

What is a requirement for plural identifying root fields?

A

It is a requirement that array in the response is the same size as the array passed as an argument, and that the order in the response will match the order in the argument.