parent
1a6655e0d7
commit
c40d80f26b
5 changed files with 51 additions and 0 deletions
|
@ -65,6 +65,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
|
|||
- Unsupported spreading GraphQL interface fragments on unions and other interfaces. ([#965], [#798])
|
||||
- Unsupported expressions in `graphql_value!` macro. ([#996], [#503])
|
||||
- Incorrect GraphQL list coercion rules: `null` cannot be coerced to an `[Int!]!` or `[Int]!`. ([#1004])
|
||||
- All procedural macros expansion inside `macro_rules!`. ([#1054], [#1051])
|
||||
|
||||
[#503]: /../../issues/503
|
||||
[#750]: /../../issues/750
|
||||
|
@ -89,6 +90,8 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
|
|||
[#1017]: /../../pull/1017
|
||||
[#1025]: /../../pull/1025
|
||||
[#1026]: /../../pull/1026
|
||||
[#1051]: /../../issues/1051
|
||||
[#1054]: /../../pull/1054
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ All user visible changes to `juniper_codegen` crate will be documented in this f
|
|||
|
||||
- `#[derive(GraphQLInterface)]` macro allowing using structs as GraphQL interfaces. ([#1026])
|
||||
|
||||
### Fixed
|
||||
|
||||
- All procedural macros expansion inside `macro_rules!`. ([#1054], [#1051])
|
||||
|
||||
[#971]: /../../pull/971
|
||||
[#985]: /../../pull/985
|
||||
[#987]: /../../pull/987
|
||||
|
@ -47,6 +51,8 @@ All user visible changes to `juniper_codegen` crate will be documented in this f
|
|||
[#1017]: /../../pull/1017
|
||||
[#1025]: /../../pull/1025
|
||||
[#1026]: /../../pull/1026
|
||||
[#1051]: /../../issues/1051
|
||||
[#1054]: /../../pull/1054
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ impl TypeExt for syn::Type {
|
|||
fn unparenthesized(&self) -> &Self {
|
||||
match self {
|
||||
Self::Paren(ty) => ty.elem.unparenthesized(),
|
||||
Self::Group(ty) => ty.elem.unparenthesized(),
|
||||
ty => ty,
|
||||
}
|
||||
}
|
||||
|
|
39
tests/integration/src/inside_macro.rs
Normal file
39
tests/integration/src/inside_macro.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
//! Checks that `#[graphql_object]` macro correctly expands inside a declarative
|
||||
//! macro definition.
|
||||
//! See [#1051](https://github.com/graphql-rust/juniper/pull/1051) and
|
||||
//! [#1054](https://github.com/graphql-rust/juniper/pull/1054) for details.
|
||||
|
||||
use juniper::{
|
||||
graphql_object, graphql_value, graphql_vars, EmptyMutation, EmptySubscription, RootNode,
|
||||
};
|
||||
|
||||
macro_rules! impl_id {
|
||||
($typename:ident) => {
|
||||
#[graphql_object]
|
||||
impl $typename {
|
||||
fn id(&self) -> i32 {
|
||||
42
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
struct Unit;
|
||||
impl_id!(Unit);
|
||||
|
||||
#[tokio::test]
|
||||
async fn works() {
|
||||
let query = r#"
|
||||
query Unit {
|
||||
id
|
||||
}
|
||||
"#;
|
||||
|
||||
let schema = RootNode::new(Unit, EmptyMutation::new(), EmptySubscription::new());
|
||||
let (res, errs) = juniper::execute(query, None, &schema, &graphql_vars! {}, &())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(errs.len(), 0);
|
||||
assert_eq!(res, graphql_value!({"id": 42}));
|
||||
}
|
|
@ -11,6 +11,8 @@ mod explicit_null;
|
|||
#[cfg(test)]
|
||||
mod infallible_as_field_error;
|
||||
#[cfg(test)]
|
||||
mod inside_macro;
|
||||
#[cfg(test)]
|
||||
mod issue_371;
|
||||
#[cfg(test)]
|
||||
mod issue_372;
|
||||
|
|
Loading…
Reference in a new issue