Struct async_graphql::dynamic::Field
source · pub struct Field { /* private fields */ }
dynamic-schema
only.Expand description
A GraphQL field
Implementations§
source§impl Field
impl Field
sourcepub fn new<N, T, F>(name: N, ty: T, resolver_fn: F) -> Selfwhere
N: Into<String>,
T: Into<TypeRef>,
F: for<'a> Fn(ResolverContext<'a>) -> FieldFuture<'a> + Send + Sync + 'static,
pub fn new<N, T, F>(name: N, ty: T, resolver_fn: F) -> Selfwhere
N: Into<String>,
T: Into<TypeRef>,
F: for<'a> Fn(ResolverContext<'a>) -> FieldFuture<'a> + Send + Sync + 'static,
Create a GraphQL field
sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the description
sourcepub fn deprecation(self, reason: Option<&str>) -> Self
pub fn deprecation(self, reason: Option<&str>) -> Self
Set the description
sourcepub fn external(self) -> Self
pub fn external(self) -> Self
Mark a field as owned by another service. This allows service A to use fields from service B while also knowing at runtime the types of that field.
sourcepub fn requires(self, fields: impl Into<String>) -> Self
pub fn requires(self, fields: impl Into<String>) -> Self
Annotate the required input fieldset from a base type for a resolver. It is used to develop a query plan where the required fields may not be needed by the client, but the service may need additional information from other services.
sourcepub fn provides(self, fields: impl Into<String>) -> Self
pub fn provides(self, fields: impl Into<String>) -> Self
Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway.
Indicate that an object type’s field is allowed to be resolved by multiple subgraphs
sourcepub fn inaccessible(self) -> Self
pub fn inaccessible(self) -> Self
Indicate that an enum is not accessible from a supergraph when using Apollo Federation
Reference: https://www.apollographql.com/docs/federation/federated-types/federated-directives/#inaccessible
Arbitrary string metadata that will be propagated to the supergraph when using Apollo Federation. This attribute is repeatable
sourcepub fn override_from(self, name: impl Into<String>) -> Self
pub fn override_from(self, name: impl Into<String>) -> Self
Indicate that an object type’s field is allowed to be resolved by multiple subgraphs
sourcepub fn argument(self, input_value: InputValue) -> Self
pub fn argument(self, input_value: InputValue) -> Self
Add an argument to the field