Py-drf-spectacular

Jul 20, 2023

Sane/flexible OpenAPI 3 schema generation for Django REST framework

This project has 3 goals

  • Extract as much schema information from DRF as possible.
  • Provide flexibility to make the schema usable in the real world not only toy examples.
  • Generate a schema that works well with the most popular client generators.

The code is a heavily modified fork of the DRF OpenAPI generator, which is/was lacking all of the below listed features

  • Serializers modelled as components. arbitrary nesting + recursion supported
  • @extend_schema decorator for customization of APIView, Viewsets, function-based views, and @action
  • Authentication support DRF natives included, easily extendable
  • Custom serializer class support easily extendable
  • SerializerMethodField type via type hinting or @extend_schema_field
  • i18n support, Tags extraction, Description extraction from docstrings
  • Request/response/parameter examples, Callback operations
  • Vendor specification extensions x-* in info, operations, parameters, components, and security schemes
  • Sane fallbacks and sane operation_id naming based on path
  • Schema serving with SpectacularAPIView Redoc and Swagger-UI views are also available
  • Optional input/output serializer component split


Checkout these related ports:
  • Zope213 - Object-based web application platform Version 2.13
  • Zola - Fast static site generator
  • Zgrab2 - Fast Go application scanner
  • Zerowait-httpd - Lightweight and fast http server
  • Zenphoto - Simpler web photo gallery
  • Zend-framework - Framework for developing PHP web applications
  • Yuicompressor - The Yahoo! JavaScript and CSS Compressor
  • Ytdl - YouTube downloader written in Go
  • Yt-dlp - Command-line program for downloading videos from various platforms
  • Youtube_dl - Program for downloading videos from various services
  • Yourls - Your Own URL Shortener
  • You-get - Dumb downloader that scrapes the web
  • Yaws - Web server for dynamic content written in Erlang
  • Yarr - Yet another rss reader
  • Yarn - Package manager for node, alternative to npm (meta port)