Files
main.tsmain
What you'll learn
- Resolve a field on demand with @ResolveField() and @Parent(), so that it costs nothing unless a query selects it
- Split one type's fields across resolvers, so each module resolves what it knows
- Gather a query's arguments in an @ArgsType() class, with optional arguments and defaults
- Read the arguments and their defaults the schema publishes, through introspection
Press Run tests to start the app. Its log appears here.Graded endpoints
owner is resolved per cat from its ownerId, and is null for Oscar, who has not gone home yet
The Owner type gets its cats field from a second resolver, in the cats module; Kim has none yet
A cat, its owner, and that owner's cats, in one query: each field resolver only runs because the query selects it
The object types still publish every field: id, age and breed on a cat, id on an owner
The optional breed argument keeps only the Tabbies
skip and take page through the list, in order
The breed filter applies before paging: the second Siamese
Introspection shows the three arguments of cats: breed an optional String, skip and take non-null Ints with their defaults