Swagger for Django api

This page summarizes the projects mentioned and recommended in the original post on /r/django

Our great sponsors
  • Sonar - Write Clean Python Code. Always.
  • Mergify - Tired of breaking your main and manually rebasing outdated pull requests?
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • drf-yasg

    Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.

    I believe drf-yasg what you need. You can create a schema manually and define request and response types for your small API.

  • I did this in one of my projects: https://gitlab.com/mrswats/config-server/-/commit/b5dac490bc3e12a6d4f2090b11b3616b82aaf300

  • Sonar

    Write Clean Python Code. Always.. Sonar helps you commit clean code every time. With over 225 unique rules to find Python bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.

  • drf-spectacular

    Sane and flexible OpenAPI 3 schema generation for Django REST framework.

    I would suggest drf-spectacular instead because https://github.com/axnsan12/drf-yasg#openapi-30-note

  • swagger-ui

    Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

    Then you need a html file that loads swagger-ui and points towards your openapi.json file from the previous step. Look at the unpkg example here for the easiest way to set one up. Either hard code the url in the file or serve it as a django template that fills in the correct value.

  • swagger-editor

    Swagger Editor

    Sure. You can use the editor from here for instance to define your endpoints and the data received and returned. By looking at the preloaded example you can figure out most of what you need to know about openapi. But if you need more info, the official documentation is pretty good.

  • Mergify

    Tired of breaking your main and manually rebasing outdated pull requests?. Managing outdated pull requests is time-consuming. Mergify's Merge Queue automates your pull request management & merging. It's fully integrated to GitHub & coordinated with any CI. Start focusing on code. Try Mergify for free.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts