Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compiler): validate field merging using the Xing algorithm #816

Merged
merged 46 commits into from
Feb 14, 2024
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2200540
Add failing test for partially non-overlapping selections
goto-bus-stop Jan 25, 2024
d9d9b25
Fix field merging validation when more than 2 fields are in play
goto-bus-stop Jan 25, 2024
344c7e3
clippy
goto-bus-stop Jan 25, 2024
54d3dd0
Pull some field merging code into smaller functions
goto-bus-stop Jan 26, 2024
68d09c4
Use high-level representation for field merging validation
goto-bus-stop Jan 26, 2024
1f5a2e0
Merge branch 'main' into fix-nested-fragment-validation
goto-bus-stop Jan 30, 2024
ee6c8ff
Bail out of field merging validation if selection set contains fragme…
goto-bus-stop Jan 30, 2024
a3b9bff
Make same response shape less mega quadratic recursive
goto-bus-stop Jan 30, 2024
0895bc0
Make same field selection check less mega quadratic recursive
goto-bus-stop Jan 31, 2024
b59b3f1
Port subscription validation that uses field selection expansion
goto-bus-stop Jan 31, 2024
c1a558f
Migrate subscription validation errors to use BuildError
goto-bus-stop Jan 31, 2024
8db8671
clippy
goto-bus-stop Jan 31, 2024
91f10db
Skip some unnecessary arc clones
goto-bus-stop Jan 31, 2024
763878d
deref
goto-bus-stop Jan 31, 2024
ddcc806
The individual checks can now both be implemented linearly
goto-bus-stop Jan 31, 2024
6b9b778
Add many repeated fields validation benchmark
goto-bus-stop Jan 31, 2024
7d9c58b
field(a:1, b:2) and field(b:2, a:1) should compare equal
goto-bus-stop Feb 1, 2024
29d15db
Remove now-invalid assertion
goto-bus-stop Feb 1, 2024
03c2eb7
Port field merging tests from graphql-js
goto-bus-stop Feb 1, 2024
fb50b0d
Reduce duplicate validation errors from field merging
goto-bus-stop Feb 1, 2024
4828dcb
doc comments
goto-bus-stop Feb 1, 2024
ee69e97
Take iterator as input for expand_selections
goto-bus-stop Feb 2, 2024
862255e
Add a cache for merged selection sets
goto-bus-stop Feb 5, 2024
82081de
changelog
goto-bus-stop Feb 5, 2024
5809146
Merge branch 'main' into fix-nested-fragment-validation
goto-bus-stop Feb 5, 2024
9fe6e38
Rework the ConflictingFieldNames diagnostic
goto-bus-stop Feb 6, 2024
aac0192
mention fragment definitions validation change
goto-bus-stop Feb 6, 2024
f3e808d
Tweak error reports for conflicting types and arguments
goto-bus-stop Feb 6, 2024
3832078
Fix field name conflict tests
goto-bus-stop Feb 6, 2024
930d43e
Ensure consistent ordering of errors by using indexmap
goto-bus-stop Feb 6, 2024
2214452
Push field merging errors directly into DiagnosticList
goto-bus-stop Feb 8, 2024
90357cb
Remove unnecessary fragment recursion check
goto-bus-stop Feb 8, 2024
9d35fc8
Use a map to optimize comparing large argument lists
goto-bus-stop Feb 9, 2024
850d9b5
Benchmark checking a field with very many arguments
goto-bus-stop Feb 9, 2024
7df98fb
Merge branch 'main' into fix-nested-fragment-validation
goto-bus-stop Feb 13, 2024
689e851
update diagnostic message: multiple -> different
goto-bus-stop Feb 13, 2024
4d8ee98
remove outdated comment
goto-bus-stop Feb 13, 2024
9be0f6e
useless zip
goto-bus-stop Feb 13, 2024
83a4428
Use Entry::or_default
goto-bus-stop Feb 13, 2024
453de79
make clippy happy with the benchmarking code
goto-bus-stop Feb 13, 2024
f5f0380
Add a recursion limit while merging fields
goto-bus-stop Feb 13, 2024
a56fcca
check -> already_done
goto-bus-stop Feb 13, 2024
53db962
Move ArgumentLookup out of the function
goto-bus-stop Feb 14, 2024
acdd464
Emit an error when the new recursion limit is reached; add test
goto-bus-stop Feb 14, 2024
28f8fbf
ref archived article
goto-bus-stop Feb 14, 2024
24949da
Merge branch 'main' into fix-nested-fragment-validation
goto-bus-stop Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove now-invalid assertion
This function can take one field from an object type, and another field
from an interface type--then their parent types are not equal.
  • Loading branch information
goto-bus-stop committed Feb 1, 2024
commit 29d15db656d3f346bf07c2267a90a1daee2d28f4
2 changes: 0 additions & 2 deletions crates/apollo-compiler/src/validation/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,6 @@ pub(crate) fn fields_in_set_can_merge(
field_a: FieldSelection<'_>,
field_b: FieldSelection<'_>,
) -> Result<(), ValidationError> {
debug_assert_eq!(field_a.parent_type, field_b.parent_type);

// 2bi. fieldA and fieldB must have identical field names.
if field_a.field.name != field_b.field.name {
return Err(ValidationError::new(
Expand Down