summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Knoblich <kai@FreeBSD.org>2023-06-02 17:49:48 +0200
committerKai Knoblich <kai@FreeBSD.org>2023-06-02 18:19:21 +0200
commitfb7fd0b40f7e953086a9aa54b167da7c2a677c2d (patch)
tree11c2109662b24bf8086c8932ab5639fbe009c750
parentdevel/git: Update to 2.41.0 (diff)
www/py-dj41-drf-spectacular: New port
Note: Copied from www/py-drf-spectacular, required for NetBox 3.5. 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
-rw-r--r--www/Makefile1
-rw-r--r--www/py-dj41-drf-spectacular/Makefile34
-rw-r--r--www/py-dj41-drf-spectacular/distinfo3
-rw-r--r--www/py-dj41-drf-spectacular/pkg-descr24
4 files changed, 62 insertions, 0 deletions
diff --git a/www/Makefile b/www/Makefile
index 658769bfdbcf..d825eaa42de3 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -1475,6 +1475,7 @@
SUBDIR += py-dj41-django-taggit
SUBDIR += py-dj41-django-timezone-field
SUBDIR += py-dj41-djangorestframework
+ SUBDIR += py-dj41-drf-spectacular
SUBDIR += py-dj41-drf-yasg
SUBDIR += py-django-admin-rangefilter
SUBDIR += py-django-advanced-filters
diff --git a/www/py-dj41-drf-spectacular/Makefile b/www/py-dj41-drf-spectacular/Makefile
new file mode 100644
index 000000000000..63d92c8d0f5d
--- /dev/null
+++ b/www/py-dj41-drf-spectacular/Makefile
@@ -0,0 +1,34 @@
+PORTNAME= drf-spectacular
+DISTVERSION= 0.26.2
+CATEGORIES= www python
+MASTER_SITES= PYPI
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}dj41-
+
+MAINTAINER= kai@FreeBSD.org
+COMMENT= Sane/flexible OpenAPI 3 schema generation for Django REST framework
+WWW= https://github.com/tfranzel/drf-spectacular
+
+LICENSE= BSD3CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}django41>=2.2:www/py-django41@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}dj41-djangorestframework>=3.10.3:www/py-dj41-djangorestframework@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}inflection>=0.3.1:devel/py-inflection@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}jsonschema>=2.6.0:devel/py-jsonschema@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}uritemplate>=2.0.0:net/py-uritemplate@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}yaml>=5.1:devel/py-yaml@${PY_FLAVOR}
+
+USES= python:3.8+
+USE_PYTHON= autoplist distutils
+
+CONFLICTS_INSTALL= ${PYTHON_PKGNAMEPREFIX}*${PORTNAME}
+
+NO_ARCH= yes
+
+OPTIONS_DEFINE= SIDECAR
+OPTIONS_DEFAULT= SIDECAR
+
+SIDECAR_DESC= Enable self-contained Swagger/Redoc UI installation
+SIDECAR_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}dj41-drf-spectacular-sidecar>0:www/py-dj41-drf-spectacular-sidecar@${PY_FLAVOR}
+
+.include <bsd.port.mk>
diff --git a/www/py-dj41-drf-spectacular/distinfo b/www/py-dj41-drf-spectacular/distinfo
new file mode 100644
index 000000000000..a186bafeb897
--- /dev/null
+++ b/www/py-dj41-drf-spectacular/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1681883936
+SHA256 (drf-spectacular-0.26.2.tar.gz) = 005623d6bb9de37d2d0ec24ccd59c636e4a42f9af252f1470129ac32ccab38cb
+SIZE (drf-spectacular-0.26.2.tar.gz) = 216281
diff --git a/www/py-dj41-drf-spectacular/pkg-descr b/www/py-dj41-drf-spectacular/pkg-descr
new file mode 100644
index 000000000000..7f053d6244dc
--- /dev/null
+++ b/www/py-dj41-drf-spectacular/pkg-descr
@@ -0,0 +1,24 @@
+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