Refactor JobValidator to remove inheritance from DRF Serializer class to clarify purpose #9513
Labels
DEV: backend
Python, databases, networking, filesystem...
TAG: developer docs
Technical docs and code comments
TAG: tech update / debt
Change not visible to user
We are currently using the validation and deserialization mechanisms from Django REST framework to process data coming from both API endpoints and internal programmatic sources.
This can cause confusion for developers about the intended role for the JobValidator - is it primarily a deserializer for Job data coming from an API endpoint, or is it primarily intended to perform validation? See e.g. #9493 (comment)
To clean this up, the base JobValidator should minimally inherit from DRF classes to the extent required to perform the validation without vendoring the entire Serializer if possible.
At the very least, we the class would need to inherit from the Serializer metaclass in order to properly handle the way DRF sets fields to be available for validation.
The text was updated successfully, but these errors were encountered: