feat: @inaccessible support
This commit is contained in:
parent
0204709de9
commit
06973ee09b
|
@ -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>(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -222,7 +222,7 @@ where
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
///
|
///
|
||||||
/// use async_graphql::*;
|
/// use async_graphql::*;
|
||||||
/// use async_graphql::types::connection::*;
|
/// use async_graphql::types::connection::*;
|
||||||
///
|
///
|
||||||
|
|
|
@ -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,167 @@ pub async fn test_entity_shareable() {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
pub async fn test_entity_inaccessible() {
|
||||||
|
#[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!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let schema_sdl = Schema::new(Query, EmptyMutation, EmptySubscription)
|
||||||
|
.sdl_with_options(SDLExportOptions::new().federation());
|
||||||
|
|
||||||
|
println!("{}", schema_sdl);
|
||||||
|
|
||||||
|
// 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"));
|
||||||
|
// INTERFACE
|
||||||
|
assert!(schema_sdl.contains("interface MyInterfaceInaccessible @inaccessible"));
|
||||||
|
// OBJECT
|
||||||
|
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