You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create RESTDanticGenericViewSet (or propose a better name).
It has to inherit from drf GenericViewSet and be compatible with DRF
It uses instead of a DRF serializer a pydantic models
Focus on get_serializer_class method, it is the main method that relays on serializer_class interface.
According to the discussion, our version of "get_Serializer_class" will:
recognize data input (dict, Django model instance, iterable of dicts, iterable of django models/queryset)
based on input use the proper model initialization method
among with data, provide context (as DRF does, it require to use our pydantic BaseModel version, that expects that)
Tech research needed to be done:
how pydantic from_orm method will behave with complex django instances, that have m2m, fields, check whether it would unpack correctly related querysets.
The text was updated successfully, but these errors were encountered:
It will inherit form views.APIView and reimplement GenericAPIView. Then we will compose RESTDanticGenericViewSet by combining our RestdanticGenericAPIView with ViewSetMixin. We do so to keep our names, and drop the "serializer" name.
RESTDanticGenericViewSet will support action - pydantic model mapping. Pydantic is less elastic than DRF, and it would require from user to create more models than DRF does. We will cover that need by implementing mapping mechanism
Main method would be get_pydantic_scheme, that will do pydantic validation and schema wrapping (we can't make that steps separate as DRF does, because pydantic limitations).
Everywhere where Pydantic Models would have names collision with Django models, we will call them Schemas.
Create RESTDanticGenericViewSet (or propose a better name).
According to the discussion, our version of "get_Serializer_class" will:
Tech research needed to be done:
The text was updated successfully, but these errors were encountered: