Fix the problem that EmptyMutation
may cause when used in MergedObject
. #694
This commit is contained in:
parent
70fb209b30
commit
ff994dc1ec
|
@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Fix the problem that `EmptyMutation` may cause when used in `MergedObject`. [#694](https://github.com/async-graphql/async-graphql/issues/694)
|
||||||
|
|
||||||
|
## [2.11.1] 2021-11-07
|
||||||
|
|
||||||
- Add `chrono::Duration` custom scalar. [#689](https://github.com/async-graphql/async-graphql/pull/689)
|
- Add `chrono::Duration` custom scalar. [#689](https://github.com/async-graphql/async-graphql/pull/689)
|
||||||
- Implement `From<Option<Option<T>>>` for `MaybeUndefined<T>`.
|
- Implement `From<Option<Option<T>>>` for `MaybeUndefined<T>`.
|
||||||
- Add `MaybeUndefined::as_opt_ref`, `MaybeUndefined::as_opt_deref`, `MaybeUndefined::map`, `MaybeUndefined::map_value`, `MaybeUndefined::contains`, `MaybeUndefined::contains_value`, and `MaybeUndefined::transpose` methods.
|
- Add `MaybeUndefined::as_opt_ref`, `MaybeUndefined::as_opt_deref`, `MaybeUndefined::map`, `MaybeUndefined::map_value`, `MaybeUndefined::contains`, `MaybeUndefined::contains_value`, and `MaybeUndefined::transpose` methods.
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl ContainerType for EmptyMutation {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn resolve_field(&self, _ctx: &Context<'_>) -> ServerResult<Option<Value>> {
|
async fn resolve_field(&self, _ctx: &Context<'_>) -> ServerResult<Option<Value>> {
|
||||||
unreachable!()
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,3 +401,30 @@ pub async fn test_issue_539() {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
pub async fn test_issue_694() {
|
||||||
|
struct Query;
|
||||||
|
|
||||||
|
#[Object]
|
||||||
|
impl Query {
|
||||||
|
async fn test(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(MergedObject)]
|
||||||
|
pub struct QueryRoot(Query, EmptyMutation);
|
||||||
|
|
||||||
|
let schema = Schema::new(
|
||||||
|
QueryRoot(Query, EmptyMutation),
|
||||||
|
EmptyMutation,
|
||||||
|
EmptySubscription,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
schema.execute("{ test }").await.into_result().unwrap().data,
|
||||||
|
value!({
|
||||||
|
"test": true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user