Shopping for a REST API stack, what do you guys use?

Hello everyone!

I have a bunch of ReST APIs in production under my belt, but most of them are documented manually. I must say it is absolutely tiring writing api documentation for each release. Having a new project at hand, I want to utilize the OpenAPI schema and possibly have an autogenerated Swagger documentation.

I built two prototypes in the past week:

  1. DRF with drf-yasg
  2. Django Ninja

For #1, I managed to setup the initial endpoints with some medium effort. The endpoint level customization is nice. But my @swagger_auto_schema decorator lines were balooning in LOCs to the point that the decorator eclipses the logic inside the view (which might not be a bad thing if following “dumb views” pattern).

For #2, the setup is pretty minimal and I’m writing expressive code ala-Flask. But then I came to the point of realizing that I’m repeating logic with my Schema objects and my DRF Serializers. And any complex validation requires me to stoop down to the pydantic level, which is just too much for my taste as compared to the simple definition of a Serializer class.

For the meantime, I’m considering going back to #1 since it’s pretty much “vanilla” DRF with a little bit of cruft here and there. I’m curious what the Django community’s tool-set of choice for these kinds of projects.

Thank you and stay safe!

Hi!

Not so much familiar with REST APIs myself but just started working at a company and using DRF with drf-yasg I felt the same about the @swagger_auto_schema decorator.

Yeah, after weighing my options, it seems like drf-yasg is the best way to do things within our setup. I’d happily pay the “verbosity cost”, since django-ninja and drf-spectacular changes our workflow too much.