Upgrade to new visitor traits in validation#5812
Merged
dylan-apollo merged 2 commits intonextfrom Aug 15, 2024
Merged
Conversation
|
CI performance tests
|
nicholascioli
approved these changes
Aug 15, 2024
Contributor
nicholascioli
left a comment
There was a problem hiding this comment.
This is great! I'm glad that the visitor allowed for better validation handling.
| Err(Message { | ||
| code: Code::GroupSelectionIsNotObject, | ||
| message: format!( | ||
| "{coordinate} selects a group `{field_name}{{}}`, but `{parent_type}.{field_name}` is of type `{type_name}` which is not an object.", |
Contributor
There was a problem hiding this comment.
Is the extra {{}} needed here?
Contributor
Author
There was a problem hiding this comment.
I want to have the braces to better indicate to users what we mean by "group", since that's not a term they'll necessarily be familiar with. So the message would be like "selections a group user {}", evoking the selection syntax.
Comment on lines
-61
to
-71
| fn get_group_fields( | ||
| &self, | ||
| group: InputObjectTypeDefinitionPosition, | ||
| ) -> Result< | ||
| Vec<InputObjectFieldDefinitionPosition>, | ||
| <Self as FieldVisitor<InputObjectFieldDefinitionPosition>>::Error, | ||
| > { | ||
| let def = group.get(self.original_schema.schema())?; | ||
| Ok(def.fields.keys().cloned().map(|f| group.field(f)).collect()) | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
Good call removing this. I originally had it to make it slightly more modular but then only used it in one spot that needed to be implemented anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also now detects when a scalar field is selected which isn't defined.