Closed alexhancock closed 7 months ago
In apollo-parser, that would be the ty
method: https://docs.rs/apollo-parser/latest/apollo_parser/cst/struct.FieldDefinition.html#method.ty
(It’s named that way because type
is a Rust keyword and can’t be used as a name.)
However, consider using apollo-compiler instead as it provides more convenient APIs. Version 1.0 is still in beta (and doesn’t have as many up-to-date examples yet) but it’s what Apollo Router has been using for a while and where most of our focus is: https://docs.rs/apollo-compiler/1.0.0-beta.12/
Closing as I believe the specific question was answered, and we’ll rework documentation as part of finishing up apollo-compiler 1.0. Feel free to open another issue or discussion.
@SimonSapin Sorry I forgot to reply before. apollo-compiler
gave me what I needed - thank you!
Description
I am wondering if I can get the type name of a
FieldDefinition
's return type?For
I see how I can get
id, name, payments
using this example from the docs.And I see how I could get the names of all
ObjectTypeDefinitions
, but I am stumped on how to capture the association of field to return type, like the below (see?????
)