Expand description
Macro to extract data from deeply nested types representing GraphQL results
§Suggested workflow
- Generate query types using cynic and its generator
- Use insta to define an inline snapshot test so that the query string is visible in the module that defines the query types
- Define an
extractfunction that takes the root query type and returns the data of interest - Inside
extract, useextract!asextract!(data => { ... }) - Inside the curly braces, past the query string from the snapshot test above
- Change all node names from
camelCasetosnake_case - Add
?after the nodes that are nullable - Add
[]after the nodes that are iterable