Skip to content

Commit b9f9a52

Browse files
committed
fix issues with introspection schemas and KnownTypeName
bump 0.0.11
1 parent ba27b89 commit b9f9a52

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "graphql-tools"
3-
version = "0.0.10"
3+
version = "0.0.11"
44
edition = "2021"
55
description = "Tools for working with GraphQL in Rust, based on graphql-parser Document."
66
license = "MIT/Apache-2.0"

src/validation/rules/known_type_names.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ impl<'a> TypeInfoQueryVisitor<ValidationErrorContext<'a>> for KnownTypeNames {
2626
.ctx
2727
.find_schema_definition_by_name(fragment_type_name.clone())
2828
{
29-
_visitor_context.errors.push(ValidationError {
30-
locations: vec![_node.position],
31-
message: format!("Unknown type \"{}\".", fragment_type_name),
32-
});
29+
if !fragment_type_name.starts_with("__") {
30+
_visitor_context.errors.push(ValidationError {
31+
locations: vec![_node.position],
32+
message: format!("Unknown type \"{}\".", fragment_type_name),
33+
});
34+
}
3335
}
3436
}
3537

@@ -44,10 +46,12 @@ impl<'a> TypeInfoQueryVisitor<ValidationErrorContext<'a>> for KnownTypeNames {
4446
.ctx
4547
.find_schema_definition_by_name(fragment_type_name.clone())
4648
{
47-
_visitor_context.errors.push(ValidationError {
48-
locations: vec![_node.position],
49-
message: format!("Unknown type \"{}\".", fragment_type_name),
50-
});
49+
if !fragment_type_name.starts_with("__") {
50+
_visitor_context.errors.push(ValidationError {
51+
locations: vec![_node.position],
52+
message: format!("Unknown type \"{}\".", fragment_type_name),
53+
});
54+
}
5155
}
5256
}
5357
}
@@ -65,10 +69,12 @@ impl<'a> TypeInfoQueryVisitor<ValidationErrorContext<'a>> for KnownTypeNames {
6569
.ctx
6670
.find_schema_definition_by_name(base_type.clone())
6771
{
68-
_visitor_context.errors.push(ValidationError {
69-
locations: vec![_node.position],
70-
message: format!("Unknown type \"{}\".", base_type),
71-
});
72+
if !base_type.starts_with("__") {
73+
_visitor_context.errors.push(ValidationError {
74+
locations: vec![_node.position],
75+
message: format!("Unknown type \"{}\".", base_type),
76+
});
77+
}
7278
}
7379
}
7480
}

0 commit comments

Comments
 (0)