-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Allow to disable field suggestions #3537
Conversation
Reviewer's Guide by SourceryThis pull request introduces a new configuration option to disable field suggestions in Strawberry's GraphQL schema. The changes include updates to the documentation, new tests to verify the functionality, and modifications to the core schema processing logic to respect the new configuration. File-Level Changes
Tips
|
RELEASE.md
Outdated
name: str | ||
|
||
|
||
schema = strawberry.Schema(query=Query, config=StrawberryConfig(suggest_field=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schema = strawberry.Schema(query=Query, config=StrawberryConfig(suggest_field=False)) | |
schema = strawberry.Schema(query=Query, config=StrawberryConfig(suggest_fields=False)) |
not sure about this name though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that is usually referred as "command not found suggestion"
Maybe field_not_found_suggestions
? But not sure either =P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe disable_field_suggestions
would work better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @patrick91 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 5 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
strawberry/schema/base.py
Outdated
if not self.config.suggest_field: | ||
for error in errors: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (performance): Potential performance impact in _process_errors
.
Iterating over all errors to remove field suggestions could have a performance impact if the error list is large. Consider evaluating the performance implications or adding a note about this.
Thanks for adding the Here's a preview of the changelog: This release adds a new configuration to disable field suggestions in the error @strawberry.type
class Query:
name: str
schema = strawberry.Schema(
query=Query, config=StrawberryConfig(disable_field_suggestions=True)
) Trying to query Here's the tweet text:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3537 +/- ##
========================================
Coverage 96.56% 96.57%
========================================
Files 523 523
Lines 33485 33591 +106
Branches 5554 5573 +19
========================================
+ Hits 32336 32440 +104
- Misses 914 915 +1
- Partials 235 236 +1 |
CodSpeed Performance ReportMerging #3537 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Left one suggestion regarding the config name, but not sure about that either :)
RELEASE.md
Outdated
name: str | ||
|
||
|
||
schema = strawberry.Schema(query=Query, config=StrawberryConfig(suggest_field=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that is usually referred as "command not found suggestion"
Maybe field_not_found_suggestions
? But not sure either =P
:)
Summary by Sourcery
This pull request introduces a new configuration option
suggest_field
inStrawberryConfig
to allow disabling field suggestions in error responses. Documentation and tests have been updated to reflect this new feature.suggest_field
inStrawberryConfig
to disable field suggestions in error responses.suggest_field
option and other available configurations.suggest_field
configuration.