GraphQL 1 (18.02.2023 3M) Flashcards

1
Q

What is GraphQL?

A

GraphQL is a query language for API, and a server-side runtime for executing queries using a type system defined for particular data.

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

What is requred from implementers in order to create GraphQL service?

A

A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type.

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

What does GraphQL service make when receiving an request?

A

The service first checks a query to ensure it only refers to the types and fields defined, and then runs the provided functions to produce a result.

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

Give an example of GraphQL type definition and corresponding methods for querying.

A

See the picture.

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

What is the essential thing about GraphQL querying?

A

At its simplest, GraphQL querying is about asking for specific fields on objects. And this is essential to GraphQL, that you always get back what you requested, and the server knows exactly what fields the client is asking for.

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

Can you make nested object fields selection in GraphQL query?

A

Yes. You can do it by making a so-called sub-selection of fields for the nested object. GraphQL queries can traverse related objects and their fields, letting clients fetch lots of related data in one request, instead of making several roundtrips as one would need in a classic REST architecture.

See the example of a nested object sub-selection call.

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

Does GraphQL have a different syntax for selecting fields of object and for fields of an array of objects?

A

No. GraphQL queries look the same for both single items or lists of items, however, we know which one to expect based on what is indicated in the schema.

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