Fix the problem that the validation does not work on some inline fragments.

This commit is contained in:
Sunli 2021-03-14 10:10:15 +08:00
parent d37297bb06
commit 4c34494e52
3 changed files with 20 additions and 1 deletions

View File

@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [2.5.14] - 2021-03-14
- Add `DataLoader::loader` method. [#441](https://github.com/async-graphql/async-graphql/issues/441)
- Fix the validation does not work on some inline fragments.
## [2.5.13] - 2021-03-09

View File

@ -253,6 +253,22 @@ mod tests {
);
}
#[test]
fn variable_used_by_inline_fragment() {
expect_passes_rule!(
factory,
r#"
query Foo($a: String) {
... {
field(a: $a) {
...FragA
}
}
}
"#,
);
}
#[test]
fn variable_not_used() {
expect_fails_rule!(

View File

@ -616,6 +616,8 @@ fn visit_selection<'a, V: Visitor<'a>>(
ctx.with_type(ctx.registry.types.get(name.node.as_str()), |ctx| {
visit_inline_fragment(v, ctx, inline_fragment)
});
} else {
visit_inline_fragment(v, ctx, inline_fragment)
}
}
}