Add `extends` attribute for derive macros Subscription and MergedSubscription.
This commit is contained in:
parent
197b3ae0a9
commit
f6c0c33885
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Remove unnecessary Box from WebSocket messages.
|
||||
- Export subscription type to Federation SDL. (for [GraphGate](https://github.com/async-graphql/graphgate) 😁)
|
||||
- Add `extends` attribute for derive macros Subscription and MergedSubscription.
|
||||
|
||||
## [2.5.11] - 2021-03-07
|
||||
|
||||
|
|
|
@ -427,6 +427,7 @@ pub struct Subscription {
|
|||
pub rename_fields: Option<RenameRule>,
|
||||
pub rename_args: Option<RenameRule>,
|
||||
pub use_type_description: bool,
|
||||
pub extends: bool,
|
||||
}
|
||||
|
||||
#[derive(FromMeta, Default)]
|
||||
|
@ -497,6 +498,8 @@ pub struct MergedSubscription {
|
|||
pub name: Option<String>,
|
||||
#[darling(default)]
|
||||
pub visible: Option<Visible>,
|
||||
#[darling(default)]
|
||||
pub extends: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, FromMeta)]
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::utils::{get_crate_name, get_rustdoc, visible_fn, GeneratorResult};
|
|||
pub fn generate(object_args: &args::MergedSubscription) -> GeneratorResult<TokenStream> {
|
||||
let crate_name = get_crate_name(object_args.internal);
|
||||
let ident = &object_args.ident;
|
||||
let extends = object_args.extends;
|
||||
let gql_typename = object_args
|
||||
.name
|
||||
.clone()
|
||||
|
@ -68,7 +69,7 @@ pub fn generate(object_args: &args::MergedSubscription) -> GeneratorResult<Token
|
|||
description: #desc,
|
||||
fields,
|
||||
cache_control: ::std::default::Default::default(),
|
||||
extends: false,
|
||||
extends: #extends,
|
||||
keys: ::std::option::Option::None,
|
||||
visible: #visible,
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ pub fn generate(
|
|||
) -> GeneratorResult<TokenStream> {
|
||||
let crate_name = get_crate_name(subscription_args.internal);
|
||||
let (self_ty, self_name) = get_type_path_and_name(item_impl.self_ty.as_ref())?;
|
||||
let extends = subscription_args.extends;
|
||||
|
||||
let gql_typename = subscription_args
|
||||
.name
|
||||
|
@ -441,7 +442,7 @@ pub fn generate(
|
|||
fields
|
||||
},
|
||||
cache_control: ::std::default::Default::default(),
|
||||
extends: false,
|
||||
extends: #extends,
|
||||
keys: ::std::option::Option::None,
|
||||
visible: ::std::option::Option::None,
|
||||
})
|
||||
|
|
|
@ -825,6 +825,7 @@ pub use async_graphql_derive::Union;
|
|||
/// | name | Object name | 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 |
|
||||
/// | extends | Add fields to an entity that's defined in another service | bool | Y |
|
||||
/// | use_type_description | Specifies that the description of the type is on the type declaration. [`Description`]()(derive.Description.html) | bool | Y |
|
||||
///
|
||||
/// # Field parameters
|
||||
|
@ -945,7 +946,6 @@ pub use async_graphql_derive::NewType;
|
|||
/// | name | Object name | string | 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 |
|
||||
/// | 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 | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||
///
|
||||
|
@ -985,6 +985,9 @@ pub use async_graphql_derive::MergedObject;
|
|||
/// | Attribute | description | Type | Optional |
|
||||
/// |---------------|---------------------------|----------|----------|
|
||||
/// | name | Object name | string | 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 | Call the specified function. If the return value is `false`, it will not be displayed in introspection. | string | Y |
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue