Skip to content

Conversation

@MoeSalah1999
Copy link

Note: Before submitting a code change, please review our contributing guidelines.

Description

Summary

This PR adds missing docstrings to two internal helper functions in serializers.py that are central to serializer validation and error handling.

The changes are documentation-only and do not alter runtime behavior.

Details

The following docstrings were added:

as_serializer_error

Documents the function’s role in normalizing Django and DRF ValidationError instances into the serializer .errors format.

Clarifies the expected structure of field and non-field errors returned by the function.

raise_errors_on_nested_writes

Replaces inline explanatory comments with a formal docstring.

Explains why writable nested and dotted-source fields are intentionally unsupported by default.

Documents when the helper is invoked and what is expected of developers when overriding create() / update().

These helpers are frequently encountered when extending or debugging serializers, but previously lacked API-level documentation.

Motivation

Serializer error handling and nested write behavior are common sources of confusion for contributors and advanced users. Providing clear docstrings improves:

Code readability and maintainability

IDE introspection and contributor onboarding

Alignment between implementation and documented behavior

Scope

Documentation-only change

No functional or behavioral modifications

No test changes required

Checklist

  • Documentation-only change
  • No behavior changes
  • Code style follows existing conventions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant