-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Update mutations.py to include full_clean parameter #701
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request enhances the mutation functions by adding a full_clean parameter to control the invocation of the clean method. The changes involve updating the function signatures and ensuring the new parameter is correctly passed to the underlying mutation calls. Updated Class Diagram for Django Mutation FunctionsclassDiagram
%% The mutation functions now include the new full_clean parameter
class create {
+extensions: list[FieldExtension]
+argument_name: Optional[str]
+handle_django_errors: Optional[bool]
+full_clean: bool | FullCleanOptions = True
}
class update {
+argument_name: Optional[str]
+handle_django_errors: Optional[bool]
+key_attr: Optional[str]
+full_clean: bool | FullCleanOptions = True
}
class delete {
+argument_name: Optional[str]
+handle_django_errors: Optional[bool]
+key_attr: Optional[str]
+full_clean: bool | FullCleanOptions = True
}
%% Notes indicating the enhancement
note for create "Added full_clean parameter to control invocation of clean method"
note for update "Added full_clean parameter to control invocation of clean method"
note for delete "Added full_clean parameter to control invocation of clean method"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 @keithhackbarth - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -257,6 +258,7 @@ | |||
extensions: list[FieldExtension] = (), # type: ignore | |||
argument_name: Optional[str] = None, | |||
handle_django_errors: Optional[bool] = None, | |||
full_clean: bool | FullCleanOptions = True, | |||
) -> Any: | |||
"""Create mutation for django input fields. |
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.
suggestion: Consider documenting the purpose and behavior of the full_clean parameter, particularly the FullCleanOptions variant.
The parameter's ability to accept both boolean and FullCleanOptions suggests important functionality that should be explained in the docstring.
"""Create mutation for django input fields. | |
"""Create mutation for django input fields. | |
Args: | |
full_clean: Controls model validation behavior before saving. | |
When True (default), performs standard Django model validation. | |
When False, skips validation. | |
When FullCleanOptions is provided, allows fine-grained control over validation: | |
- exclude: List of fields to exclude from validation | |
- validate_unique: Whether to validate model uniqueness constraints | |
- validate_constraints: Whether to validate model constraints | |
""" |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #701 +/- ##
==========================================
- Coverage 88.36% 88.08% -0.29%
==========================================
Files 42 42
Lines 3850 3851 +1
==========================================
- Hits 3402 3392 -10
- Misses 448 459 +11 ☔ View full report in Codecov by Sentry. |
Hey @keithhackbarth ,
I think this change is ok! TBH, not sure why we were not exposing those in first place. |
This is a draft PR. Just looking for feedback.
We would like to control if clean is called. Correctly, it looks like the only option on the field but the mutation wrapper is missing the parameter. This change simply adds the parameter.
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by Sourcery
Enhancements: