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
I am wondering if I can get the type name of a FieldDefinition's return type?
For
type Merchant {
id: ID
name: String
businessDetails: BusinessDetails
}
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 ?????)
for def in doc.definitions() {
if let cst::Definition::ObjectTypeDefinition(object_type) = def {
for field_def in object_type.fields_definition().unwrap().field_definitions() {
println!("{}", field_def.name().unwrap().text()) // === "businessDetails"
println!("{}", ?????) // === "BusinessDetails"
}
}
}
The text was updated successfully, but these errors were encountered:
(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.
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?????
)The text was updated successfully, but these errors were encountered: