DefaultFakeResolver
A FakeResolver that generates:
values based on the object id hashcode for Int/Float/Boolean/ID
values based on the field name for strings
For object id, DefaultFakeResolver uses @typePolicy
if present. Or you can also override it by setting the "__stableId" property:
val cat = buildCat {
this["stableId"] = "foo"
}
Functions
Resolves a leaf (scalar or enum) type. Note that because of list and not-nullable types, the type of context.mergedField
is not always the leaf type. You can get the type of the leaf type with:
Resolves the size of a list. Note that lists might be nested. You can use context.path
to get the current nesting depth
Use stableIdForObject to provide FakeResolverContext.id. You can then use FakeResolverContext.id to derive stable values in the resolveXyz() methods above. This way, you're guaranteed that a fake object will have the same field values no matter its path in the query.