Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Dec 10, 2023
1 parent 0ec4d23 commit 4ef322c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 36 deletions.
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ drf-spectacular

|build-status| |codecov| |docs| |pypi-version| |pypi-dl|

Sane and flexible `OpenAPI 3.0`_ schema generation for `Django REST framework`_.
Sane and flexible `OpenAPI`_ (`3.0.3`_ & `3.1`_) schema generation for `Django REST framework`_.

This project has 3 goals:
1. Extract as much schema information from DRF as possible.
Expand Down Expand Up @@ -35,6 +35,7 @@ Features
- Schema serving with ``SpectacularAPIView`` (Redoc and Swagger-UI views are also available)
- Optional input/output serializer component split
- Callback operations
- OpenAPI 3.1 support (via setting ``OAS_VERSION``)
- Included support for:
- `django-polymorphic <https://github.com/django-polymorphic/django-polymorphic>`_ / `django-rest-polymorphic <https://github.com/apirobot/django-rest-polymorphic>`_
- `SimpleJWT <https://github.com/jazzband/djangorestframework-simplejwt>`_
Expand Down Expand Up @@ -290,7 +291,9 @@ globally, and then simply run:
$ tox
.. _Django REST framework: https://www.django-rest-framework.org/
.. _OpenAPI 3.0: https://spec.openapis.org/oas/v3.0.3
.. _OpenAPI: https://swagger.io/
.. _3.0.3: https://spec.openapis.org/oas/v3.0.3
.. _3.1: https://spec.openapis.org/oas/v3.1.0
.. _tox: https://tox.wiki/
.. _drf-spectacular-sidecar: https://github.com/tfranzel/drf-spectacular-sidecar

Expand Down
9 changes: 4 additions & 5 deletions docs/blueprints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,12 @@ translation package `django-parler <https://github.com/django-parler/django-parl
Pydantic
--------

Preliminary support for `Pydantic <https://github.com/pydantic/pydantic>`_ models. This may or may not
end up in the main package. Catches decorated Pydantic classes and integrates their schema.
Preliminary support for `Pydantic <https://github.com/pydantic/pydantic>`_ models.
Catches decorated Pydantic classes and integrates their schema.

Pydantic 2 is now officially supported without any manual steps.

Pydantic 1:

.. literalinclude:: blueprints/pydantic.py

Pydantic 2:

.. literalinclude:: blueprints/pydantic2.py
1 change: 1 addition & 0 deletions docs/blueprints/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class PydanticExtension(OpenApiSerializerExtension):
target_class = "pydantic.BaseModel"
match_subclasses = True
priority = 1

def get_name(self, auto_schema, direction):
return self.target.__name__
Expand Down
29 changes: 0 additions & 29 deletions docs/blueprints/pydantic2.py

This file was deleted.

0 comments on commit 4ef322c

Please sign in to comment.