You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pagination: use "field key" instead of "field name" (apollographql#5898)
* Use "field key" instead of "field name"
* Add a few cache related terms to the glossary
* Apply suggestions from code review
Co-authored-by: Martin Bonnin <[email protected]>
---------
Co-authored-by: Martin Bonnin <[email protected]>
Copy file name to clipboardExpand all lines: design-docs/Glossary.md
+25-5
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,6 @@
1
-
# Codegen Glossary
2
-
3
-
## Glossary
4
-
5
-
A small Glossary of the terms used during codegen. The [GraphQL Spec](https://spec.graphql.org/draft/) does a nice job of defining the common terms like `Field`, `SelectionSet`, etc... so I'm not adding these terms here. But it misses some concepts that we bumped into during codegen and that I'm trying to clarify here.
1
+
# Glossary
6
2
3
+
The [GraphQL Spec](https://spec.graphql.org/draft/) does a nice job of defining common terms like `Field`, `SelectionSet`, etc. but here are a few other concepts that the library deals with, and their definition.
7
4
8
5
### Response shape
9
6
@@ -105,3 +102,26 @@ Example:
105
102
### Polymorphic field
106
103
107
104
A field that can take several shapes
105
+
106
+
### Record
107
+
108
+
A shallow map of a response object. Nested objects in the map values are replaced by a cache reference to another Record.
109
+
110
+
### Cache key
111
+
112
+
A unique identifier for a Record.
113
+
By default it is the path formed by all the field keys from the root of the query to the field referencing the Record.
114
+
To avoid duplication the Cache key can also be computed from the Record contents, usually using its key fields.
115
+
116
+
### Field key
117
+
118
+
A key that uniquely identifies a field within a Record. By default composed of the field name and the arguments passed to it.
119
+
120
+
### Key fields
121
+
122
+
Fields that are used to compute a Cache key for an object.
123
+
124
+
### Pagination arguments
125
+
126
+
Field arguments that control pagination, e.g. `first`, `after`, etc. They should be omitted when computing a field key so different pages can be merged into the same field.
Copy file name to clipboardExpand all lines: intellij-plugin/src/main/kotlin/com/apollographql/ijplugin/normalizedcache/provider/DatabaseNormalizedCacheProvider.kt
+2-2
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,8 @@ class DatabaseNormalizedCacheProvider : NormalizedCacheProvider<File> {
Copy file name to clipboardExpand all lines: libraries/apollo-normalized-cache-api-incubating/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/api/CacheResolver.kt
+24-26
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ interface CacheResolver {
65
65
* @param variables the variables of the current operation
66
66
* @param parent the parent object as a map. It can contain the same values as [Record]. Especially, nested objects will be represented
67
67
* by [CacheKey]
68
-
* @param parentId the id of the parent. Mainly used for debugging
68
+
* @param parentId the key of the parent. Mainly used for debugging
69
69
*
70
70
* @return a value that can go in a [Record]. No type checking is done. It is the responsibility of implementations to return the correct
0 commit comments