Merge pull request #1026 from nmoutschen/fed2-inaccessible
Add Apollo Federation `@inaccessible` directive support
This commit is contained in:
commit
695ea81c2f
|
@ -153,6 +153,8 @@ pub struct SimpleObjectField {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub guard: Option<SpannedValue<String>>,
|
pub guard: Option<SpannedValue<String>>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
@ -202,6 +204,8 @@ pub struct SimpleObject {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default, multiple, rename = "concrete")]
|
#[darling(default, multiple, rename = "concrete")]
|
||||||
pub concretes: Vec<ConcreteType>,
|
pub concretes: Vec<ConcreteType>,
|
||||||
|
@ -226,6 +230,7 @@ pub struct Argument {
|
||||||
pub process_with: Option<String>,
|
pub process_with: Option<String>,
|
||||||
pub key: bool, // for entity
|
pub key: bool, // for entity
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub secret: bool,
|
pub secret: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +245,7 @@ pub struct Object {
|
||||||
pub cache_control: CacheControl,
|
pub cache_control: CacheControl,
|
||||||
pub extends: bool,
|
pub extends: bool,
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub use_type_description: bool,
|
pub use_type_description: bool,
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
pub serial: bool,
|
pub serial: bool,
|
||||||
|
@ -284,6 +290,7 @@ pub struct ObjectField {
|
||||||
pub provides: Option<String>,
|
pub provides: Option<String>,
|
||||||
pub requires: Option<String>,
|
pub requires: Option<String>,
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub guard: Option<SpannedValue<String>>,
|
pub guard: Option<SpannedValue<String>>,
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
pub complexity: Option<ComplexityType>,
|
pub complexity: Option<ComplexityType>,
|
||||||
|
@ -321,6 +328,8 @@ pub struct Enum {
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromVariant)]
|
#[derive(FromVariant)]
|
||||||
|
@ -336,6 +345,8 @@ pub struct EnumItem {
|
||||||
pub deprecation: Deprecation,
|
pub deprecation: Deprecation,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromDeriveInput)]
|
#[derive(FromDeriveInput)]
|
||||||
|
@ -352,6 +363,8 @@ pub struct Union {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromVariant)]
|
#[derive(FromVariant)]
|
||||||
|
@ -394,6 +407,8 @@ pub struct InputObjectField {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub secret: bool,
|
pub secret: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,6 +430,8 @@ pub struct InputObject {
|
||||||
pub rename_fields: Option<RenameRule>,
|
pub rename_fields: Option<RenameRule>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
#[darling(default, multiple, rename = "concrete")]
|
#[darling(default, multiple, rename = "concrete")]
|
||||||
pub concretes: Vec<ConcreteType>,
|
pub concretes: Vec<ConcreteType>,
|
||||||
// for SimpleObject
|
// for SimpleObject
|
||||||
|
@ -436,6 +453,8 @@ pub struct OneofObjectField {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub secret: bool,
|
pub secret: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,6 +474,8 @@ pub struct OneofObject {
|
||||||
pub rename_fields: Option<RenameRule>,
|
pub rename_fields: Option<RenameRule>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
#[darling(default, multiple, rename = "concrete")]
|
#[darling(default, multiple, rename = "concrete")]
|
||||||
pub concretes: Vec<ConcreteType>,
|
pub concretes: Vec<ConcreteType>,
|
||||||
}
|
}
|
||||||
|
@ -473,6 +494,8 @@ pub struct InterfaceFieldArgument {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub secret: bool,
|
pub secret: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,6 +521,8 @@ pub struct InterfaceField {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,6 +554,8 @@ pub struct Interface {
|
||||||
pub extends: bool,
|
pub extends: bool,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromMeta, Default)]
|
#[derive(FromMeta, Default)]
|
||||||
|
@ -538,6 +565,7 @@ pub struct Scalar {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub use_type_description: bool,
|
pub use_type_description: bool,
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub specified_by_url: Option<String>,
|
pub specified_by_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,6 +632,8 @@ pub struct MergedObject {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub serial: bool,
|
pub serial: bool,
|
||||||
|
@ -751,6 +781,8 @@ pub struct NewType {
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
#[darling(default)]
|
#[darling(default)]
|
||||||
|
pub inaccessible: bool,
|
||||||
|
#[darling(default)]
|
||||||
pub specified_by_url: Option<String>,
|
pub specified_by_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,6 +807,7 @@ pub struct ComplexObjectField {
|
||||||
pub provides: Option<String>,
|
pub provides: Option<String>,
|
||||||
pub requires: Option<String>,
|
pub requires: Option<String>,
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub guard: Option<SpannedValue<String>>,
|
pub guard: Option<SpannedValue<String>>,
|
||||||
pub visible: Option<Visible>,
|
pub visible: Option<Visible>,
|
||||||
pub complexity: Option<ComplexityType>,
|
pub complexity: Option<ComplexityType>,
|
||||||
|
|
|
@ -173,6 +173,7 @@ pub fn generate(
|
||||||
let field_deprecation = gen_deprecation(&method_args.deprecation, &crate_name);
|
let field_deprecation = gen_deprecation(&method_args.deprecation, &crate_name);
|
||||||
let external = method_args.external;
|
let external = method_args.external;
|
||||||
let shareable = method_args.shareable;
|
let shareable = method_args.shareable;
|
||||||
|
let inaccessible = method_args.inaccessible;
|
||||||
let requires = match &method_args.requires {
|
let requires = match &method_args.requires {
|
||||||
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
||||||
None => quote! { ::std::option::Option::None },
|
None => quote! { ::std::option::Option::None },
|
||||||
|
@ -208,6 +209,7 @@ pub fn generate(
|
||||||
validator,
|
validator,
|
||||||
process_with,
|
process_with,
|
||||||
visible,
|
visible,
|
||||||
|
inaccessible,
|
||||||
secret,
|
secret,
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
|
@ -242,6 +244,7 @@ pub fn generate(
|
||||||
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -367,6 +370,7 @@ pub fn generate(
|
||||||
provides: #provides,
|
provides: #provides,
|
||||||
requires: #requires,
|
requires: #requires,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
compute_complexity: #complexity,
|
compute_complexity: #complexity,
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -89,6 +89,7 @@ pub fn generate(
|
||||||
ty: <#arg_ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#arg_ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub fn generate(enum_args: &args::Enum) -> GeneratorResult<TokenStream> {
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
||||||
|
|
||||||
|
let inaccessible = enum_args.inaccessible;
|
||||||
let desc = get_rustdoc(&enum_args.attrs)?
|
let desc = get_rustdoc(&enum_args.attrs)?
|
||||||
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
||||||
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
||||||
|
@ -47,6 +48,7 @@ pub fn generate(enum_args: &args::Enum) -> GeneratorResult<TokenStream> {
|
||||||
.rename_items
|
.rename_items
|
||||||
.rename(variant.ident.unraw().to_string(), RenameTarget::EnumItem)
|
.rename(variant.ident.unraw().to_string(), RenameTarget::EnumItem)
|
||||||
});
|
});
|
||||||
|
let inaccessible = variant.inaccessible;
|
||||||
let item_deprecation = gen_deprecation(&variant.deprecation, &crate_name);
|
let item_deprecation = gen_deprecation(&variant.deprecation, &crate_name);
|
||||||
let item_desc = get_rustdoc(&variant.attrs)?
|
let item_desc = get_rustdoc(&variant.attrs)?
|
||||||
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
||||||
|
@ -67,6 +69,7 @@ pub fn generate(enum_args: &args::Enum) -> GeneratorResult<TokenStream> {
|
||||||
description: #item_desc,
|
description: #item_desc,
|
||||||
deprecation: #item_deprecation,
|
deprecation: #item_deprecation,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -141,6 +144,7 @@ pub fn generate(enum_args: &args::Enum) -> GeneratorResult<TokenStream> {
|
||||||
enum_items
|
enum_items
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
||||||
let crate_name = get_crate_name(object_args.internal);
|
let crate_name = get_crate_name(object_args.internal);
|
||||||
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
||||||
let ident = &object_args.ident;
|
let ident = &object_args.ident;
|
||||||
|
let inaccessible = object_args.inaccessible;
|
||||||
let s = match &object_args.data {
|
let s = match &object_args.data {
|
||||||
Data::Struct(s) => s,
|
Data::Struct(s) => s,
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -65,6 +66,7 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
||||||
.rename_fields
|
.rename_fields
|
||||||
.rename(ident.unraw().to_string(), RenameTarget::Field)
|
.rename(ident.unraw().to_string(), RenameTarget::Field)
|
||||||
});
|
});
|
||||||
|
let inaccessible = field.inaccessible;
|
||||||
|
|
||||||
if field.skip || field.skip_input {
|
if field.skip || field.skip_input {
|
||||||
get_fields.push(quote! {
|
get_fields.push(quote! {
|
||||||
|
@ -188,6 +190,7 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
||||||
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -240,6 +243,7 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
||||||
fields
|
fields
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
oneof: false,
|
oneof: false,
|
||||||
})
|
})
|
||||||
|
@ -287,6 +291,7 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
||||||
fields
|
fields
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
oneof: false,
|
oneof: false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -31,6 +31,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
let mut enum_names = Vec::new();
|
let mut enum_names = Vec::new();
|
||||||
let mut enum_items = HashSet::new();
|
let mut enum_items = HashSet::new();
|
||||||
let mut type_into_impls = Vec::new();
|
let mut type_into_impls = Vec::new();
|
||||||
|
let inaccessible = interface_args.inaccessible;
|
||||||
let gql_typename = interface_args
|
let gql_typename = interface_args
|
||||||
.name
|
.name
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -138,6 +139,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
requires,
|
requires,
|
||||||
visible,
|
visible,
|
||||||
shareable,
|
shareable,
|
||||||
|
inaccessible,
|
||||||
} in &interface_args.fields
|
} in &interface_args.fields
|
||||||
{
|
{
|
||||||
let (name, method_name) = if let Some(method) = method {
|
let (name, method_name) = if let Some(method) = method {
|
||||||
|
@ -179,6 +181,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
default,
|
default,
|
||||||
default_with,
|
default_with,
|
||||||
visible,
|
visible,
|
||||||
|
inaccessible,
|
||||||
secret,
|
secret,
|
||||||
} in args
|
} in args
|
||||||
{
|
{
|
||||||
|
@ -224,6 +227,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -276,6 +280,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
provides: #provides,
|
provides: #provides,
|
||||||
requires: #requires,
|
requires: #requires,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
compute_complexity: ::std::option::Option::None,
|
compute_complexity: ::std::option::Option::None,
|
||||||
});
|
});
|
||||||
|
@ -361,6 +366,7 @@ pub fn generate(interface_args: &args::Interface) -> GeneratorResult<TokenStream
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub fn generate(object_args: &args::MergedObject) -> GeneratorResult<TokenStream
|
||||||
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
||||||
let extends = object_args.extends;
|
let extends = object_args.extends;
|
||||||
let shareable = object_args.shareable;
|
let shareable = object_args.shareable;
|
||||||
|
let inaccessible = object_args.inaccessible;
|
||||||
let gql_typename = object_args
|
let gql_typename = object_args
|
||||||
.name
|
.name
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -105,6 +106,7 @@ pub fn generate(object_args: &args::MergedObject) -> GeneratorResult<TokenStream
|
||||||
cache_control,
|
cache_control,
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub fn generate(object_args: &args::MergedSubscription) -> GeneratorResult<Token
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: true,
|
is_subscription: true,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub fn generate(newtype_args: &args::NewType) -> GeneratorResult<TokenStream> {
|
||||||
let crate_name = get_crate_name(newtype_args.internal);
|
let crate_name = get_crate_name(newtype_args.internal);
|
||||||
let ident = &newtype_args.ident;
|
let ident = &newtype_args.ident;
|
||||||
let (impl_generics, ty_generics, where_clause) = newtype_args.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = newtype_args.generics.split_for_impl();
|
||||||
|
let inaccessible = newtype_args.inaccessible;
|
||||||
let gql_typename = match &newtype_args.name {
|
let gql_typename = match &newtype_args.name {
|
||||||
NewTypeName::New(name) => Some(name.clone()),
|
NewTypeName::New(name) => Some(name.clone()),
|
||||||
NewTypeName::Rust => Some(RenameTarget::Type.rename(ident.to_string())),
|
NewTypeName::Rust => Some(RenameTarget::Type.rename(ident.to_string())),
|
||||||
|
@ -51,6 +52,7 @@ pub fn generate(newtype_args: &args::NewType) -> GeneratorResult<TokenStream> {
|
||||||
description: #desc,
|
description: #desc,
|
||||||
is_valid: |value| <#ident as #crate_name::ScalarType>::is_valid(value),
|
is_valid: |value| <#ident as #crate_name::ScalarType>::is_valid(value),
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
specified_by_url: #specified_by_url,
|
specified_by_url: #specified_by_url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ pub fn generate(
|
||||||
let (impl_generics, _, where_clause) = item_impl.generics.split_for_impl();
|
let (impl_generics, _, where_clause) = item_impl.generics.split_for_impl();
|
||||||
let extends = object_args.extends;
|
let extends = object_args.extends;
|
||||||
let shareable = object_args.shareable;
|
let shareable = object_args.shareable;
|
||||||
|
let inaccessible = object_args.inaccessible;
|
||||||
let gql_typename = if !object_args.name_type {
|
let gql_typename = if !object_args.name_type {
|
||||||
object_args
|
object_args
|
||||||
.name
|
.name
|
||||||
|
@ -317,6 +318,7 @@ pub fn generate(
|
||||||
let field_deprecation = gen_deprecation(&method_args.deprecation, &crate_name);
|
let field_deprecation = gen_deprecation(&method_args.deprecation, &crate_name);
|
||||||
let external = method_args.external;
|
let external = method_args.external;
|
||||||
let shareable = method_args.shareable;
|
let shareable = method_args.shareable;
|
||||||
|
let inaccessible = method_args.inaccessible;
|
||||||
let requires = match &method_args.requires {
|
let requires = match &method_args.requires {
|
||||||
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
||||||
None => quote! { ::std::option::Option::None },
|
None => quote! { ::std::option::Option::None },
|
||||||
|
@ -353,6 +355,7 @@ pub fn generate(
|
||||||
validator,
|
validator,
|
||||||
visible,
|
visible,
|
||||||
secret,
|
secret,
|
||||||
|
inaccessible,
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
) in &args
|
) in &args
|
||||||
|
@ -386,6 +389,7 @@ pub fn generate(
|
||||||
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -510,6 +514,7 @@ pub fn generate(
|
||||||
provides: #provides,
|
provides: #provides,
|
||||||
requires: #requires,
|
requires: #requires,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
compute_complexity: #complexity,
|
compute_complexity: #complexity,
|
||||||
});
|
});
|
||||||
|
@ -644,6 +649,7 @@ pub fn generate(
|
||||||
cache_control: #cache_control,
|
cache_control: #cache_control,
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
@ -684,6 +690,7 @@ pub fn generate(
|
||||||
cache_control: #cache_control,
|
cache_control: #cache_control,
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
|
|
@ -16,6 +16,7 @@ pub fn generate(object_args: &args::OneofObject) -> GeneratorResult<TokenStream>
|
||||||
let desc = get_rustdoc(&object_args.attrs)?
|
let desc = get_rustdoc(&object_args.attrs)?
|
||||||
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
||||||
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
||||||
|
let inaccessible = object_args.inaccessible;
|
||||||
let gql_typename = object_args
|
let gql_typename = object_args
|
||||||
.name
|
.name
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -41,6 +42,7 @@ pub fn generate(object_args: &args::OneofObject) -> GeneratorResult<TokenStream>
|
||||||
.rename_fields
|
.rename_fields
|
||||||
.rename(enum_name.to_string(), RenameTarget::Field)
|
.rename(enum_name.to_string(), RenameTarget::Field)
|
||||||
});
|
});
|
||||||
|
let inaccessible = variant.inaccessible;
|
||||||
let desc = get_rustdoc(&object_args.attrs)?
|
let desc = get_rustdoc(&object_args.attrs)?
|
||||||
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
||||||
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
||||||
|
@ -80,6 +82,7 @@ pub fn generate(object_args: &args::OneofObject) -> GeneratorResult<TokenStream>
|
||||||
ty: <::std::option::Option<#ty> as #crate_name::InputType>::create_type_info(registry),
|
ty: <::std::option::Option<#ty> as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: ::std::option::Option::None,
|
default_value: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -133,6 +136,7 @@ pub fn generate(object_args: &args::OneofObject) -> GeneratorResult<TokenStream>
|
||||||
fields
|
fields
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
oneof: true,
|
oneof: true,
|
||||||
})
|
})
|
||||||
|
@ -183,6 +187,7 @@ pub fn generate(object_args: &args::OneofObject) -> GeneratorResult<TokenStream>
|
||||||
fields
|
fields
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
oneof: true,
|
oneof: true,
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub fn generate(
|
||||||
let generic = &item_impl.generics;
|
let generic = &item_impl.generics;
|
||||||
let where_clause = &item_impl.generics.where_clause;
|
let where_clause = &item_impl.generics.where_clause;
|
||||||
let visible = visible_fn(&scalar_args.visible);
|
let visible = visible_fn(&scalar_args.visible);
|
||||||
|
let inaccessible = scalar_args.inaccessible;
|
||||||
let specified_by_url = match &scalar_args.specified_by_url {
|
let specified_by_url = match &scalar_args.specified_by_url {
|
||||||
Some(specified_by_url) => quote! { ::std::option::Option::Some(#specified_by_url) },
|
Some(specified_by_url) => quote! { ::std::option::Option::Some(#specified_by_url) },
|
||||||
None => quote! { ::std::option::Option::None },
|
None => quote! { ::std::option::Option::None },
|
||||||
|
@ -52,6 +53,7 @@ pub fn generate(
|
||||||
description: #desc,
|
description: #desc,
|
||||||
is_valid: |value| <#self_ty as #crate_name::ScalarType>::is_valid(value),
|
is_valid: |value| <#self_ty as #crate_name::ScalarType>::is_valid(value),
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
specified_by_url: #specified_by_url,
|
specified_by_url: #specified_by_url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -82,6 +84,7 @@ pub fn generate(
|
||||||
description: #desc,
|
description: #desc,
|
||||||
is_valid: |value| <#self_ty as #crate_name::ScalarType>::is_valid(value),
|
is_valid: |value| <#self_ty as #crate_name::ScalarType>::is_valid(value),
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
specified_by_url: #specified_by_url,
|
specified_by_url: #specified_by_url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ pub fn generate(object_args: &args::SimpleObject) -> GeneratorResult<TokenStream
|
||||||
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
||||||
let extends = object_args.extends;
|
let extends = object_args.extends;
|
||||||
let shareable = object_args.shareable;
|
let shareable = object_args.shareable;
|
||||||
|
let inaccessible = object_args.inaccessible;
|
||||||
let gql_typename = if !object_args.name_type {
|
let gql_typename = if !object_args.name_type {
|
||||||
object_args
|
object_args
|
||||||
.name
|
.name
|
||||||
|
@ -129,6 +130,7 @@ pub fn generate(object_args: &args::SimpleObject) -> GeneratorResult<TokenStream
|
||||||
let field_deprecation = gen_deprecation(&field.deprecation, &crate_name);
|
let field_deprecation = gen_deprecation(&field.deprecation, &crate_name);
|
||||||
let external = field.external;
|
let external = field.external;
|
||||||
let shareable = field.shareable;
|
let shareable = field.shareable;
|
||||||
|
let inaccessible = field.inaccessible;
|
||||||
let requires = match &field.requires {
|
let requires = match &field.requires {
|
||||||
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
Some(requires) => quote! { ::std::option::Option::Some(#requires) },
|
||||||
None => quote! { ::std::option::Option::None },
|
None => quote! { ::std::option::Option::None },
|
||||||
|
@ -177,6 +179,7 @@ pub fn generate(object_args: &args::SimpleObject) -> GeneratorResult<TokenStream
|
||||||
provides: #provides,
|
provides: #provides,
|
||||||
requires: #requires,
|
requires: #requires,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
compute_complexity: ::std::option::Option::None,
|
compute_complexity: ::std::option::Option::None,
|
||||||
});
|
});
|
||||||
|
@ -333,6 +336,7 @@ pub fn generate(object_args: &args::SimpleObject) -> GeneratorResult<TokenStream
|
||||||
cache_control: #cache_control,
|
cache_control: #cache_control,
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
@ -398,6 +402,7 @@ pub fn generate(object_args: &args::SimpleObject) -> GeneratorResult<TokenStream
|
||||||
cache_control: #cache_control,
|
cache_control: #cache_control,
|
||||||
extends: #extends,
|
extends: #extends,
|
||||||
shareable: #shareable,
|
shareable: #shareable,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
|
|
@ -119,6 +119,7 @@ pub fn generate(
|
||||||
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
||||||
default_value: #schema_default,
|
default_value: #schema_default,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: #secret,
|
is_secret: #secret,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -269,6 +270,7 @@ pub fn generate(
|
||||||
provides: ::std::option::Option::None,
|
provides: ::std::option::Option::None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: false,
|
||||||
compute_complexity: #complexity,
|
compute_complexity: #complexity,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -410,6 +412,7 @@ pub fn generate(
|
||||||
keys: ::std::option::Option::None,
|
keys: ::std::option::Option::None,
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: true,
|
is_subscription: true,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub fn generate(union_args: &args::Union) -> GeneratorResult<TokenStream> {
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
||||||
|
|
||||||
|
let inaccessible = union_args.inaccessible;
|
||||||
let desc = get_rustdoc(&union_args.attrs)?
|
let desc = get_rustdoc(&union_args.attrs)?
|
||||||
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
||||||
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
||||||
|
@ -193,6 +194,7 @@ pub fn generate(union_args: &args::Union) -> GeneratorResult<TokenStream> {
|
||||||
possible_types
|
possible_types
|
||||||
},
|
},
|
||||||
visible: #visible,
|
visible: #visible,
|
||||||
|
inaccessible: #inaccessible,
|
||||||
rust_typename: ::std::any::type_name::<Self>(),
|
rust_typename: ::std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
- The `shareable` directive is used to indicate that an object type's field is allowed to be resolved by multiple subgraphs (by default, each field can be resolved by only one subgraph).
|
- The `shareable` directive is used to indicate that an object type's field is allowed to be resolved by multiple subgraphs (by default, each field can be resolved by only one subgraph).
|
||||||
|
|
||||||
|
- The `inaccessible` directive is used to indicate that a location in the schema cannot be queried at the supergraph level, but can still be queried at the subgraph level.
|
||||||
|
|
||||||
## Entity lookup function
|
## Entity lookup function
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|
|
@ -16,6 +16,7 @@ some simple fields, and use the `ComplexObject` macro to define some other field
|
||||||
| rename_fields | Rename all the fields according to the given case convention. The possible values are "lowercase", "UPPERCASE", "PascalCase", "camelCase", "snake_case", "SCREAMING_SNAKE_CASE". | string | Y |
|
| rename_fields | Rename all the fields according to the given case convention. The possible values are "lowercase", "UPPERCASE", "PascalCase", "camelCase", "snake_case", "SCREAMING_SNAKE_CASE". | string | Y |
|
||||||
| rename_args | Rename all the arguments according to the given case convention. The possible values are "lowercase", "UPPERCASE", "PascalCase", "camelCase", "snake_case", "SCREAMING_SNAKE_CASE". | string | Y |
|
| rename_args | Rename all the arguments according to the given case convention. The possible values are "lowercase", "UPPERCASE", "PascalCase", "camelCase", "snake_case", "SCREAMING_SNAKE_CASE". | string | Y |
|
||||||
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
||||||
|
| inaccessible | Indicate that an object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Field attributes
|
# Field attributes
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ some simple fields, and use the `ComplexObject` macro to define some other field
|
||||||
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
||||||
| requires | 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. | string | Y |
|
| requires | 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. | string | Y |
|
||||||
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
||||||
|
| inaccessible | Indicate that a field is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
@ -49,6 +51,7 @@ some simple fields, and use the `ComplexObject` macro to define some other field
|
||||||
| default | Argument default value | literal | Y |
|
| default | Argument default value | literal | Y |
|
||||||
| default_with | Expression to generate default value | code string | Y |
|
| default_with | Expression to generate default value | code string | Y |
|
||||||
| validator | Input value validator *[See also the Book](https://async-graphql.github.io/async-graphql/en/input_value_validators.html)* | object | Y |
|
| validator | Input value validator *[See also the Book](https://async-graphql.github.io/async-graphql/en/input_value_validators.html)* | object | Y |
|
||||||
|
| inaccessible | Indicate that a field argument is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
||||||
|
|
|
@ -11,16 +11,18 @@ Define a GraphQL enum
|
||||||
| remote | Derive a remote enum | string | Y |
|
| remote | Derive a remote enum | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an enum is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Item attributes
|
# Item attributes
|
||||||
|
|
||||||
| Attribute | description | Type | Optional |
|
| Attribute | description | Type | Optional |
|
||||||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
||||||
| name | Item name | string | Y |
|
| name | Item name | string | Y |
|
||||||
| deprecation | Item deprecated | bool | Y |
|
| deprecation | Item deprecated | bool | Y |
|
||||||
| deprecation | Item deprecation reason | string | Y |
|
| deprecation | Item deprecation reason | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an item is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ Define a GraphQL input object
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. | ConcreteType | Y |
|
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. | ConcreteType | Y |
|
||||||
|
| inaccessible | Indicate that an input object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Field attributes
|
# Field attributes
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ Define a GraphQL input object
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
||||||
|
| inaccessible | Indicate that a field is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,12 @@ Define a GraphQL interface
|
||||||
| extends | Add fields to an entity that's defined in another service | bool | Y |
|
| extends | Add fields to an entity that's defined in another service | bool | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an interface is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Field attributes
|
# Field attributes
|
||||||
|
|
||||||
| Attribute | description | Type | Optional |
|
| Attribute | description | Type | Optional |
|
||||||
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|----------|
|
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|----------|
|
||||||
| name | Field name | string | N |
|
| name | Field name | string | N |
|
||||||
| type | Field type | string | N |
|
| type | Field type | string | N |
|
||||||
| method | Rust resolver method name. If specified, `name` will not be camelCased in schema definition | string | Y |
|
| method | Rust resolver method name. If specified, `name` will not be camelCased in schema definition | string | Y |
|
||||||
|
@ -30,6 +31,7 @@ Define a GraphQL interface
|
||||||
| requires | 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. | string | Y |
|
| requires | 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. | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that a field is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Field argument attributes
|
# Field argument attributes
|
||||||
|
|
||||||
|
@ -44,6 +46,8 @@ Define a GraphQL interface
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
||||||
|
| inaccessible | Indicate that an argument is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
|
|
||||||
# Define an interface
|
# Define an interface
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ Define a merged object with multiple object types.
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| serial | Resolve each field sequentially. | bool | Y |
|
| serial | Resolve each field sequentially. | bool | Y |
|
||||||
|
| inaccessible | Indicate that an object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ It also implements `From<InnerType>` and `Into<InnerType>`.
|
||||||
| visible(Only valid for new scalars) | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible(Only valid for new scalars) | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible(Only valid for new scalars) | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible(Only valid for new scalars) | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| specified_by_url(Only valid for new scalars) | Provide a specification URL for this scalar type, it must link to a human-readable specification of the data format, serialization and coercion rules for this scalar. | string | Y |
|
| specified_by_url(Only valid for new scalars) | Provide a specification URL for this scalar type, it must link to a human-readable specification of the data format, serialization and coercion rules for this scalar. | string | Y |
|
||||||
|
| inaccessible | Indicate that an object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ All methods are converted to camelCase.
|
||||||
| use_type_description | Specifies that the description of the type is on the type declaration. [`Description`]()(derive.Description.html) | bool | Y |
|
| use_type_description | Specifies that the description of the type is on the type declaration. [`Description`]()(derive.Description.html) | bool | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| serial | Resolve each field sequentially. | bool | Y |
|
| serial | Resolve each field sequentially. | bool | Y |
|
||||||
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. | ConcreteType | Y |
|
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. | ConcreteType | Y |
|
||||||
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
||||||
|
@ -35,6 +36,7 @@ All methods are converted to camelCase.
|
||||||
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
||||||
| requires | 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. | string | Y |
|
| requires | 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. | string | Y |
|
||||||
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
||||||
|
| inaccessible | Indicate that a field is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
@ -55,6 +57,7 @@ All methods are converted to camelCase.
|
||||||
| validator | Input value validator *[See also the Book](https://async-graphql.github.io/async-graphql/en/input_value_validators.html)* | object | Y |
|
| validator | Input value validator *[See also the Book](https://async-graphql.github.io/async-graphql/en/input_value_validators.html)* | object | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an argument is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
| secret | Mark this field as a secret, it will not output the actual value in the log. | bool | Y |
|
||||||
| key | Is entity key(for Federation) | bool | Y |
|
| key | Is entity key(for Federation) | bool | Y |
|
||||||
| process_with | Upon successful parsing, invokes specified function. Its signature must be `fn(&mut T)`. | code path | Y |
|
| process_with | Upon successful parsing, invokes specified function. Its signature must be `fn(&mut T)`. | code path | Y |
|
||||||
|
|
|
@ -6,3 +6,4 @@ Define a Scalar
|
||||||
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
||||||
| name | Scalar name | string | Y |
|
| name | Scalar name | string | Y |
|
||||||
| specified_by_url | Provide a specification URL for this scalar type, it must link to a human-readable specification of the data format, serialization and coercion rules for this scalar. | string | Y |
|
| specified_by_url | Provide a specification URL for this scalar type, it must link to a human-readable specification of the data format, serialization and coercion rules for this scalar. | string | Y |
|
||||||
|
| inaccessible | Indicate that a scalar is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
|
@ -13,6 +13,7 @@ Similar to `Object`, but defined on a structure that automatically generates get
|
||||||
| cache_control | Object cache control | [`CacheControl`](struct.CacheControl.html) | Y |
|
| cache_control | Object cache control | [`CacheControl`](struct.CacheControl.html) | Y |
|
||||||
| extends | Add fields to an entity that's defined in another service | bool | Y |
|
| extends | Add fields to an entity that's defined in another service | bool | Y |
|
||||||
| shareable | Indicate that an object type's field is allowed to be resolved by multiple subgraphs | bool | Y |
|
| shareable | Indicate that an object type's field is allowed to be resolved by multiple subgraphs | bool | Y |
|
||||||
|
| inaccessible | Indicate that an object is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. *[See also the Book](https://async-graphql.github.io/async-graphql/en/define_simple_object.html#generic-simpleobjects) | ConcreteType | Y |
|
| concretes | Specify how the concrete type of the generic SimpleObject should be implemented. *[See also the Book](https://async-graphql.github.io/async-graphql/en/define_simple_object.html#generic-simpleobjects) | ConcreteType | Y |
|
||||||
|
@ -35,6 +36,8 @@ Similar to `Object`, but defined on a structure that automatically generates get
|
||||||
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
| provides | Annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the gateway. | string | Y |
|
||||||
| requires | 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. | string | Y |
|
| requires | 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. | string | Y |
|
||||||
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
| shareable | Indicate that a field is allowed to be resolved by multiple subgraphs | bool | Y |
|
||||||
|
|
||||||
|
| inaccessible | Indicate that a field is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
| guard | Field of guard *[See also the Book](https://async-graphql.github.io/async-graphql/en/field_guard.html)* | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
|
|
@ -5,10 +5,11 @@ Define a GraphQL union
|
||||||
# Macro attributes
|
# Macro attributes
|
||||||
|
|
||||||
| Attribute | description | Type | Optional |
|
| Attribute | description | Type | Optional |
|
||||||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------|----------|
|
||||||
| name | Object name | string | Y |
|
| name | Object name | string | Y |
|
||||||
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
| visible | If `false`, it will not be displayed in introspection. *[See also the Book](https://async-graphql.github.io/async-graphql/en/visibility.html).* | bool | Y |
|
||||||
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
| visible | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||||
|
| inaccessible | Indicate that an union is not accessible from a supergraph when using Apollo Federation | bool | Y |
|
||||||
|
|
||||||
# Item attributes
|
# Item attributes
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,10 @@ impl Registry {
|
||||||
sdl.push_str(", ");
|
sdl.push_str(", ");
|
||||||
}
|
}
|
||||||
sdl.push_str(&export_input_value(arg));
|
sdl.push_str(&export_input_value(arg));
|
||||||
|
|
||||||
|
if options.federation && arg.inaccessible {
|
||||||
|
write!(sdl, " @inaccessible").ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write!(sdl, "): {}", field.ty).ok();
|
write!(sdl, "): {}", field.ty).ok();
|
||||||
} else {
|
} else {
|
||||||
|
@ -173,6 +177,9 @@ impl Registry {
|
||||||
if field.shareable {
|
if field.shareable {
|
||||||
write!(sdl, " @shareable").ok();
|
write!(sdl, " @shareable").ok();
|
||||||
}
|
}
|
||||||
|
if field.inaccessible {
|
||||||
|
write!(sdl, " @inaccessible").ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(sdl).ok();
|
writeln!(sdl).ok();
|
||||||
|
@ -182,7 +189,10 @@ impl Registry {
|
||||||
fn export_type(&self, ty: &MetaType, sdl: &mut String, options: &SDLExportOptions) {
|
fn export_type(&self, ty: &MetaType, sdl: &mut String, options: &SDLExportOptions) {
|
||||||
match ty {
|
match ty {
|
||||||
MetaType::Scalar {
|
MetaType::Scalar {
|
||||||
name, description, ..
|
name,
|
||||||
|
description,
|
||||||
|
inaccessible,
|
||||||
|
..
|
||||||
} => {
|
} => {
|
||||||
let mut export_scalar = !SYSTEM_SCALARS.contains(&name.as_str());
|
let mut export_scalar = !SYSTEM_SCALARS.contains(&name.as_str());
|
||||||
if options.federation && FEDERATION_SCALARS.contains(&name.as_str()) {
|
if options.federation && FEDERATION_SCALARS.contains(&name.as_str()) {
|
||||||
|
@ -192,7 +202,12 @@ impl Registry {
|
||||||
if let Some(description) = description {
|
if let Some(description) = description {
|
||||||
export_description(sdl, options, true, description);
|
export_description(sdl, options, true, description);
|
||||||
}
|
}
|
||||||
writeln!(sdl, "scalar {}", name).ok();
|
write!(sdl, "scalar {} ", name).ok();
|
||||||
|
|
||||||
|
if options.federation && *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
|
writeln!(sdl).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MetaType::Object {
|
MetaType::Object {
|
||||||
|
@ -202,6 +217,7 @@ impl Registry {
|
||||||
keys,
|
keys,
|
||||||
description,
|
description,
|
||||||
shareable,
|
shareable,
|
||||||
|
inaccessible,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
if Some(name.as_str()) == self.subscription_type.as_deref()
|
if Some(name.as_str()) == self.subscription_type.as_deref()
|
||||||
|
@ -248,6 +264,10 @@ impl Registry {
|
||||||
if *shareable {
|
if *shareable {
|
||||||
write!(sdl, "@shareable ").ok();
|
write!(sdl, "@shareable ").ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(sdl, "{{").ok();
|
writeln!(sdl, "{{").ok();
|
||||||
|
@ -260,6 +280,7 @@ impl Registry {
|
||||||
extends,
|
extends,
|
||||||
keys,
|
keys,
|
||||||
description,
|
description,
|
||||||
|
inaccessible,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
if let Some(description) = description {
|
if let Some(description) = description {
|
||||||
|
@ -277,6 +298,9 @@ impl Registry {
|
||||||
write!(sdl, "@key(fields: \"{}\") ", key).ok();
|
write!(sdl, "@key(fields: \"{}\") ", key).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.write_implements(sdl, name);
|
self.write_implements(sdl, name);
|
||||||
|
|
||||||
|
@ -288,6 +312,7 @@ impl Registry {
|
||||||
name,
|
name,
|
||||||
enum_values,
|
enum_values,
|
||||||
description,
|
description,
|
||||||
|
inaccessible,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
if let Some(description) = description {
|
if let Some(description) = description {
|
||||||
|
@ -295,6 +320,9 @@ impl Registry {
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(sdl, "enum {} ", name).ok();
|
write!(sdl, "enum {} ", name).ok();
|
||||||
|
if options.federation && *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
writeln!(sdl, "{{").ok();
|
writeln!(sdl, "{{").ok();
|
||||||
|
|
||||||
let mut values = enum_values.values().collect::<Vec<_>>();
|
let mut values = enum_values.values().collect::<Vec<_>>();
|
||||||
|
@ -305,6 +333,9 @@ impl Registry {
|
||||||
for value in values {
|
for value in values {
|
||||||
write!(sdl, "\t{}", value.name).ok();
|
write!(sdl, "\t{}", value.name).ok();
|
||||||
write_deprecated(sdl, &value.deprecation);
|
write_deprecated(sdl, &value.deprecation);
|
||||||
|
if options.federation && value.inaccessible {
|
||||||
|
write!(sdl, " @inaccessible").ok();
|
||||||
|
}
|
||||||
writeln!(sdl).ok();
|
writeln!(sdl).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +345,7 @@ impl Registry {
|
||||||
name,
|
name,
|
||||||
input_fields,
|
input_fields,
|
||||||
description,
|
description,
|
||||||
|
inaccessible,
|
||||||
oneof,
|
oneof,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
|
@ -326,6 +358,9 @@ impl Registry {
|
||||||
if *oneof {
|
if *oneof {
|
||||||
write!(sdl, "@oneof ").ok();
|
write!(sdl, "@oneof ").ok();
|
||||||
}
|
}
|
||||||
|
if options.federation && *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
writeln!(sdl, "{{").ok();
|
writeln!(sdl, "{{").ok();
|
||||||
|
|
||||||
let mut fields = input_fields.values().collect::<Vec<_>>();
|
let mut fields = input_fields.values().collect::<Vec<_>>();
|
||||||
|
@ -337,7 +372,11 @@ impl Registry {
|
||||||
if let Some(description) = field.description {
|
if let Some(description) = field.description {
|
||||||
export_description(sdl, options, false, description);
|
export_description(sdl, options, false, description);
|
||||||
}
|
}
|
||||||
writeln!(sdl, "\t{}", export_input_value(&field)).ok();
|
write!(sdl, "\t{} ", export_input_value(&field)).ok();
|
||||||
|
if options.federation && field.inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
|
writeln!(sdl).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(sdl, "}}").ok();
|
writeln!(sdl, "}}").ok();
|
||||||
|
@ -346,13 +385,19 @@ impl Registry {
|
||||||
name,
|
name,
|
||||||
possible_types,
|
possible_types,
|
||||||
description,
|
description,
|
||||||
|
inaccessible,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
if let Some(description) = description {
|
if let Some(description) = description {
|
||||||
export_description(sdl, options, true, description);
|
export_description(sdl, options, true, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(sdl, "union {} =", name).ok();
|
write!(sdl, "union {} ", name).ok();
|
||||||
|
if options.federation && *inaccessible {
|
||||||
|
write!(sdl, "@inaccessible ").ok();
|
||||||
|
}
|
||||||
|
write!(sdl, "=").ok();
|
||||||
|
|
||||||
for (idx, ty) in possible_types.iter().enumerate() {
|
for (idx, ty) in possible_types.iter().enumerate() {
|
||||||
if idx == 0 {
|
if idx == 0 {
|
||||||
write!(sdl, " {}", ty).ok();
|
write!(sdl, " {}", ty).ok();
|
||||||
|
|
|
@ -111,6 +111,7 @@ pub struct MetaInputValue {
|
||||||
pub ty: String,
|
pub ty: String,
|
||||||
pub default_value: Option<String>,
|
pub default_value: Option<String>,
|
||||||
pub visible: Option<MetaVisibleFn>,
|
pub visible: Option<MetaVisibleFn>,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub is_secret: bool,
|
pub is_secret: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +168,7 @@ pub struct MetaField {
|
||||||
pub provides: Option<&'static str>,
|
pub provides: Option<&'static str>,
|
||||||
pub visible: Option<MetaVisibleFn>,
|
pub visible: Option<MetaVisibleFn>,
|
||||||
pub shareable: bool,
|
pub shareable: bool,
|
||||||
|
pub inaccessible: bool,
|
||||||
pub compute_complexity: Option<ComplexityType>,
|
pub compute_complexity: Option<ComplexityType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +178,7 @@ pub struct MetaEnumValue {
|
||||||
pub description: Option<&'static str>,
|
pub description: Option<&'static str>,
|
||||||
pub deprecation: Deprecation,
|
pub deprecation: Deprecation,
|
||||||
pub visible: Option<MetaVisibleFn>,
|
pub visible: Option<MetaVisibleFn>,
|
||||||
|
pub inaccessible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetaVisibleFn = fn(&Context<'_>) -> bool;
|
type MetaVisibleFn = fn(&Context<'_>) -> bool;
|
||||||
|
@ -210,6 +213,7 @@ pub enum MetaType {
|
||||||
description: Option<&'static str>,
|
description: Option<&'static str>,
|
||||||
is_valid: fn(value: &Value) -> bool,
|
is_valid: fn(value: &Value) -> bool,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
specified_by_url: Option<&'static str>,
|
specified_by_url: Option<&'static str>,
|
||||||
},
|
},
|
||||||
Object {
|
Object {
|
||||||
|
@ -221,6 +225,7 @@ pub enum MetaType {
|
||||||
shareable: bool,
|
shareable: bool,
|
||||||
keys: Option<Vec<String>>,
|
keys: Option<Vec<String>>,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
is_subscription: bool,
|
is_subscription: bool,
|
||||||
rust_typename: &'static str,
|
rust_typename: &'static str,
|
||||||
},
|
},
|
||||||
|
@ -232,6 +237,7 @@ pub enum MetaType {
|
||||||
extends: bool,
|
extends: bool,
|
||||||
keys: Option<Vec<String>>,
|
keys: Option<Vec<String>>,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
rust_typename: &'static str,
|
rust_typename: &'static str,
|
||||||
},
|
},
|
||||||
Union {
|
Union {
|
||||||
|
@ -239,6 +245,7 @@ pub enum MetaType {
|
||||||
description: Option<&'static str>,
|
description: Option<&'static str>,
|
||||||
possible_types: IndexSet<String>,
|
possible_types: IndexSet<String>,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
rust_typename: &'static str,
|
rust_typename: &'static str,
|
||||||
},
|
},
|
||||||
Enum {
|
Enum {
|
||||||
|
@ -246,6 +253,7 @@ pub enum MetaType {
|
||||||
description: Option<&'static str>,
|
description: Option<&'static str>,
|
||||||
enum_values: IndexMap<&'static str, MetaEnumValue>,
|
enum_values: IndexMap<&'static str, MetaEnumValue>,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
rust_typename: &'static str,
|
rust_typename: &'static str,
|
||||||
},
|
},
|
||||||
InputObject {
|
InputObject {
|
||||||
|
@ -253,6 +261,7 @@ pub enum MetaType {
|
||||||
description: Option<&'static str>,
|
description: Option<&'static str>,
|
||||||
input_fields: IndexMap<String, MetaInputValue>,
|
input_fields: IndexMap<String, MetaInputValue>,
|
||||||
visible: Option<MetaVisibleFn>,
|
visible: Option<MetaVisibleFn>,
|
||||||
|
inaccessible: bool,
|
||||||
rust_typename: &'static str,
|
rust_typename: &'static str,
|
||||||
oneof: bool,
|
oneof: bool,
|
||||||
},
|
},
|
||||||
|
@ -495,6 +504,7 @@ impl Registry {
|
||||||
cache_control: Default::default(),
|
cache_control: Default::default(),
|
||||||
extends: false,
|
extends: false,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
|
@ -623,6 +633,7 @@ impl Registry {
|
||||||
requires: None,
|
requires: None,
|
||||||
provides: None,
|
provides: None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
visible: None,
|
visible: None,
|
||||||
compute_complexity: None,
|
compute_complexity: None,
|
||||||
},
|
},
|
||||||
|
@ -637,6 +648,7 @@ impl Registry {
|
||||||
description: None,
|
description: None,
|
||||||
possible_types,
|
possible_types,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
rust_typename: "async_graphql::federation::Entity",
|
rust_typename: "async_graphql::federation::Entity",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -657,6 +669,7 @@ impl Registry {
|
||||||
ty: "[_Any!]!".to_string(),
|
ty: "[_Any!]!".to_string(),
|
||||||
default_value: None,
|
default_value: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: false,
|
is_secret: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -670,6 +683,7 @@ impl Registry {
|
||||||
provides: None,
|
provides: None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
compute_complexity: None,
|
compute_complexity: None,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -701,6 +715,7 @@ impl Registry {
|
||||||
provides: None,
|
provides: None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
compute_complexity: None,
|
compute_complexity: None,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -711,6 +726,7 @@ impl Registry {
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
rust_typename: "async_graphql::federation::Service",
|
rust_typename: "async_graphql::federation::Service",
|
||||||
},
|
},
|
||||||
|
|
|
@ -164,6 +164,7 @@ macro_rules! scalar_internal {
|
||||||
description: $desc,
|
description: $desc,
|
||||||
is_valid: |value| <$ty as $crate::ScalarType>::is_valid(value),
|
is_valid: |value| <$ty as $crate::ScalarType>::is_valid(value),
|
||||||
visible: ::std::option::Option::None,
|
visible: ::std::option::Option::None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: $specified_by_url,
|
specified_by_url: $specified_by_url,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -199,6 +200,7 @@ macro_rules! scalar_internal {
|
||||||
description: $desc,
|
description: $desc,
|
||||||
is_valid: |value| <$ty as $crate::ScalarType>::is_valid(value),
|
is_valid: |value| <$ty as $crate::ScalarType>::is_valid(value),
|
||||||
visible: ::std::option::Option::None,
|
visible: ::std::option::Option::None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: $specified_by_url,
|
specified_by_url: $specified_by_url,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -399,6 +399,7 @@ where
|
||||||
ty: "Boolean!".to_string(),
|
ty: "Boolean!".to_string(),
|
||||||
default_value: None,
|
default_value: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: false,
|
is_secret: false,
|
||||||
});
|
});
|
||||||
args
|
args
|
||||||
|
@ -423,6 +424,7 @@ where
|
||||||
ty: "Boolean!".to_string(),
|
ty: "Boolean!".to_string(),
|
||||||
default_value: None,
|
default_value: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: false,
|
is_secret: false,
|
||||||
});
|
});
|
||||||
args
|
args
|
||||||
|
|
|
@ -57,6 +57,7 @@ impl OutputType for EmptyMutation {
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
rust_typename: std::any::type_name::<Self>(),
|
rust_typename: std::any::type_name::<Self>(),
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,6 +26,7 @@ impl SubscriptionType for EmptySubscription {
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: true,
|
is_subscription: true,
|
||||||
rust_typename: std::any::type_name::<Self>(),
|
rust_typename: std::any::type_name::<Self>(),
|
||||||
})
|
})
|
||||||
|
|
2
src/types/external/json_object/btreemap.rs
vendored
2
src/types/external/json_object/btreemap.rs
vendored
|
@ -29,6 +29,7 @@ where
|
||||||
description: Some("A scalar that can represent any JSON Object value."),
|
description: Some("A scalar that can represent any JSON Object value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -84,6 +85,7 @@ where
|
||||||
description: Some("A scalar that can represent any JSON Object value."),
|
description: Some("A scalar that can represent any JSON Object value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
2
src/types/external/json_object/hashmap.rs
vendored
2
src/types/external/json_object/hashmap.rs
vendored
|
@ -36,6 +36,7 @@ where
|
||||||
description: Some("A scalar that can represent any JSON Object value."),
|
description: Some("A scalar that can represent any JSON Object value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ where
|
||||||
description: Some("A scalar that can represent any JSON Object value."),
|
description: Some("A scalar that can represent any JSON Object value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ impl<T: DeserializeOwned + Serialize + Send + Sync> InputType for Json<T> {
|
||||||
description: Some("A scalar that can represent any JSON value."),
|
description: Some("A scalar that can represent any JSON value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -83,6 +84,7 @@ impl<T: Serialize + Send + Sync> OutputType for Json<T> {
|
||||||
description: Some("A scalar that can represent any JSON value."),
|
description: Some("A scalar that can represent any JSON value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,6 +112,7 @@ impl InputType for serde_json::Value {
|
||||||
description: Some("A scalar that can represent any JSON value."),
|
description: Some("A scalar that can represent any JSON value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -141,6 +144,7 @@ impl OutputType for serde_json::Value {
|
||||||
description: Some("A scalar that can represent any JSON value."),
|
description: Some("A scalar that can represent any JSON value."),
|
||||||
is_valid: |_| true,
|
is_valid: |_| true,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: None,
|
specified_by_url: None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -80,6 +80,7 @@ where
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
rust_typename: std::any::type_name::<Self>(),
|
rust_typename: std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
|
@ -139,6 +140,7 @@ where
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
rust_typename: std::any::type_name::<Self>(),
|
rust_typename: std::any::type_name::<Self>(),
|
||||||
}
|
}
|
||||||
|
@ -173,6 +175,7 @@ impl SubscriptionType for MergedObjectTail {
|
||||||
shareable: false,
|
shareable: false,
|
||||||
keys: None,
|
keys: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_subscription: false,
|
is_subscription: false,
|
||||||
rust_typename: std::any::type_name::<Self>(),
|
rust_typename: std::any::type_name::<Self>(),
|
||||||
})
|
})
|
||||||
|
|
|
@ -132,6 +132,7 @@ impl<T: ObjectType> OutputType for QueryRoot<T> {
|
||||||
requires: None,
|
requires: None,
|
||||||
provides: None,
|
provides: None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
visible: None,
|
visible: None,
|
||||||
compute_complexity: None,
|
compute_complexity: None,
|
||||||
},
|
},
|
||||||
|
@ -152,6 +153,7 @@ impl<T: ObjectType> OutputType for QueryRoot<T> {
|
||||||
ty: "String!".to_string(),
|
ty: "String!".to_string(),
|
||||||
default_value: None,
|
default_value: None,
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
is_secret: false,
|
is_secret: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -164,6 +166,7 @@ impl<T: ObjectType> OutputType for QueryRoot<T> {
|
||||||
requires: None,
|
requires: None,
|
||||||
provides: None,
|
provides: None,
|
||||||
shareable: false,
|
shareable: false,
|
||||||
|
inaccessible: false,
|
||||||
visible: None,
|
visible: None,
|
||||||
compute_complexity: None,
|
compute_complexity: None,
|
||||||
},
|
},
|
||||||
|
|
|
@ -113,6 +113,7 @@ impl InputType for Upload {
|
||||||
description: None,
|
description: None,
|
||||||
is_valid: |value| matches!(value, Value::String(_)),
|
is_valid: |value| matches!(value, Value::String(_)),
|
||||||
visible: None,
|
visible: None,
|
||||||
|
inaccessible: false,
|
||||||
specified_by_url: Some("https://github.com/jaydenseric/graphql-multipart-request-spec"),
|
specified_by_url: Some("https://github.com/jaydenseric/graphql-multipart-request-spec"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,3 +327,185 @@ pub async fn test_entity_shareable() {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
pub async fn test_entity_inaccessible() {
|
||||||
|
struct MyCustomObjInaccessible;
|
||||||
|
|
||||||
|
#[Object(inaccessible)]
|
||||||
|
impl MyCustomObjInaccessible {
|
||||||
|
async fn a(&self) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
async fn custom_object_inaccessible(&self) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(SimpleObject)]
|
||||||
|
struct MyObjFieldInaccessible {
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
obj_field_inaccessible_a: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(SimpleObject)]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
struct MyObjInaccessible {
|
||||||
|
a: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(InputObject)]
|
||||||
|
struct MyInputObjFieldInaccessible {
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
input_field_inaccessible_a: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(InputObject)]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
struct MyInputObjInaccessible {
|
||||||
|
a: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Enum, PartialEq, Eq, Copy, Clone)]
|
||||||
|
enum MyEnumVariantInaccessible {
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
OptionAInaccessible,
|
||||||
|
OptionB,
|
||||||
|
OptionC,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Enum, PartialEq, Eq, Copy, Clone)]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
enum MyEnumInaccessible {
|
||||||
|
OptionA,
|
||||||
|
OptionB,
|
||||||
|
OptionC,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(SimpleObject)]
|
||||||
|
struct MyInterfaceObjA {
|
||||||
|
inaccessible_interface_value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(SimpleObject)]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
struct MyInterfaceObjB {
|
||||||
|
inaccessible_interface_value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Interface)]
|
||||||
|
#[graphql(field(name = "inaccessible_interface_value", type = "String", inaccessible))]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
enum MyInterfaceInaccessible {
|
||||||
|
MyInterfaceObjA(MyInterfaceObjA),
|
||||||
|
MyInterfaceObjB(MyInterfaceObjB),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Union)]
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
enum MyUnionInaccessible {
|
||||||
|
MyInterfaceObjA(MyInterfaceObjA),
|
||||||
|
MyInterfaceObjB(MyInterfaceObjB),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MyNumberInaccessible(i32);
|
||||||
|
|
||||||
|
#[Scalar(inaccessible)]
|
||||||
|
impl ScalarType for MyNumberInaccessible {
|
||||||
|
fn parse(_value: Value) -> InputValueResult<Self> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_value(&self) -> Value {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Query;
|
||||||
|
|
||||||
|
#[Object(extends)]
|
||||||
|
impl Query {
|
||||||
|
#[graphql(entity)]
|
||||||
|
async fn find_obj_field_inaccessible(&self, _id: i32) -> MyObjFieldInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[graphql(entity)]
|
||||||
|
async fn find_obj_inaccessible(&self, _id: i32) -> MyObjInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn enum_variant_inaccessible(&self, _id: i32) -> MyEnumVariantInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn enum_inaccessible(&self, _id: i32) -> MyEnumInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[graphql(inaccessible)]
|
||||||
|
async fn inaccessible_field(&self, _id: i32) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_argument(&self, #[graphql(inaccessible)] _id: i32) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_interface(&self) -> MyInterfaceInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_union(&self) -> MyUnionInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_scalar(&self) -> MyNumberInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_input_field(&self, _value: MyInputObjFieldInaccessible) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_input(&self, _value: MyInputObjInaccessible) -> i32 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn inaccessible_custom_object(&self) -> MyCustomObjInaccessible {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let schema_sdl = Schema::new(Query, EmptyMutation, EmptySubscription)
|
||||||
|
.sdl_with_options(SDLExportOptions::new().federation());
|
||||||
|
|
||||||
|
// FIELD_DEFINITION
|
||||||
|
assert!(schema_sdl.contains("inaccessibleField(id: Int!): Int! @inaccessible"));
|
||||||
|
assert!(schema_sdl.contains("objFieldInaccessibleA: Int! @inaccessible"));
|
||||||
|
assert!(schema_sdl.contains("inaccessibleInterfaceValue: String! @inaccessible"));
|
||||||
|
assert!(schema_sdl.contains("customObjectInaccessible: Int! @inaccessible"));
|
||||||
|
// INTERFACE
|
||||||
|
assert!(schema_sdl.contains("interface MyInterfaceInaccessible @inaccessible"));
|
||||||
|
// OBJECT
|
||||||
|
assert!(schema_sdl.contains("type MyCustomObjInaccessible @inaccessible"));
|
||||||
|
assert!(schema_sdl.contains(r#"type MyObjInaccessible @key(fields: "id") @inaccessible"#));
|
||||||
|
assert!(schema_sdl
|
||||||
|
.contains("type MyInterfaceObjB implements MyInterfaceInaccessible @inaccessible"));
|
||||||
|
// UNION
|
||||||
|
assert!(schema_sdl.contains("union MyUnionInaccessible @inaccessible ="));
|
||||||
|
// ARGUMENT_DEFINITION
|
||||||
|
assert!(schema_sdl.contains("inaccessibleArgument(id: Int! @inaccessible): Int!"));
|
||||||
|
// SCALAR
|
||||||
|
assert!(schema_sdl.contains("scalar MyNumberInaccessible @inaccessible"));
|
||||||
|
// ENUM
|
||||||
|
assert!(schema_sdl.contains("enum MyEnumInaccessible @inaccessible"));
|
||||||
|
// ENUM_VALUE
|
||||||
|
assert!(schema_sdl.contains("OPTION_A_INACCESSIBLE @inaccessible"));
|
||||||
|
// INPUT_OBJECT
|
||||||
|
assert!(schema_sdl.contains("input MyInputObjInaccessible @inaccessible"));
|
||||||
|
// INPUT_FIELD_DEFINITION
|
||||||
|
assert!(schema_sdl.contains("inputFieldInaccessibleA: Int! @inaccessible"));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user