Handling with complicated data & nested resources
Mateusz-Slisz opened this issue · comments
Mateusz Slisz commented
Hello, first of all, I think you have been doing a great job with styles for Django. However, I'm curious what do you think about the below concepts:
- Large serialization, exactly creating/updating objects from complicated data. As I can see there is an example of very simple cases. I would like to know how you handle complicated services with many arguments (maybe you use domain entities to simplify it?) and how communication between these services looks.
- Nested resources, e.g.
/courses/1/comments/create
for creating.
Do you allow to use it in your company? If so, how would it look like from the serializer/validation/service side?
Adding a special section for the above concepts and similar would be helpful for me and I hope for others too.
Radoslav Georgiev commented
@Mateusz-Slisz Thanks for the question.
Few points:
- If you use non-plain serializer for
InputSerializer
, this sounds like you plan to use that serializer to create the object. This is something that we don't do & rather use the service layer for object creation. That said - I see no reason to useModelSerializer
for that. - If you have a service with many arguments, you might take the approach that's discussed here - #57
- URL patterns are always up to the developers to decide. It's important to be consistent there. We usually follow this pattern - https://github.com/HackSoftware/Django-Styleguide#urls - but again - it can vary from project to project.
My answers are a bit vague and generic. If you need more detailed answers - please - provide more context in the questions / code examples 🖖
Radoslav Georgiev commented
Closing this for now 🙌