use crate::model::__InputValue;
use crate::registry;
use async_graphql_derive::{Enum, Object};
#[Enum(internal)]
#[derive(Debug)]
#[allow(non_camel_case_types)]
pub enum __DirectiveLocation {
QUERY,
MUTATION,
SUBSCRIPTION,
FIELD,
FRAGMENT_DEFINITION,
FRAGMENT_SPREAD,
INLINE_FRAGMENT,
VARIABLE_DEFINITION,
SCHEMA,
SCALAR,
OBJECT,
FIELD_DEFINITION,
ARGUMENT_DEFINITION,
INTERFACE,
UNION,
ENUM,
ENUM_VALUE,
INPUT_OBJECT,
INPUT_FIELD_DEFINITION,
}
pub struct __Directive<'a> {
pub registry: &'a registry::Registry,
pub directive: &'a registry::MetaDirective,
}
#[Object(internal)]
impl<'a> __Directive<'a> {
async fn name(&self) -> String {
self.directive.name.to_string()
}
async fn description(&self) -> Option<String> {
self.directive.description.map(|s| s.to_string())
}
async fn locations(&self) -> &Vec<__DirectiveLocation> {
&self.directive.locations
}
async fn args(&self) -> Vec<__InputValue<'a>> {
self.directive
.args
.values()
.map(|input_value| __InputValue {
registry: self.registry,
input_value,
})
.collect()
}
}