Document overridden serializer methods - #54
Merged
Conversation
Add concise docstrings to the overridden validate/create/update methods and their private helpers across the app serializers, so each customization states what it does and how it differs from the default DRF behavior. Trivial computed-field getters are left as is.
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.
Motivation
Mentor feedback (blocking): overridden serializer methods (e.g.
create,update, and the detail helpers in the offers serializer) lacked docstrings. Once a method overrides DRF's default behavior, it should state what it does and why it differs from the built-in implementation.Changes
Add concise, single-line docstrings to the overridden lifecycle methods and their private helpers across all app serializers:
validate,validate_details,_validate_update_details,create,update,_create_details,_update_detailsvalidate_username,validate(registration + login),createupdatevalidate,create,_get_offer_detailvalidate,create,_validate_business_user,_validate_unique_reviewTrivial computed-field getters (
get_price,get_min_price,get_url, …) are intentionally left undocumented, as the mentor considers such one-liners redundant. Existing class docstrings are kept because the project's ruff config enforcesD101.Docstrings are kept to one line so functions stay within the project's 14-line limit (
test_code_style).Verification