commonground-api-common 1.12.2__py3-none-any.whl → 2.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. commonground_api_common-1.12.2.data/scripts/patch_content_types → commonground_api_common-2.4.1.data/scripts/generate_schema +2 -4
  2. {commonground_api_common-1.12.2.dist-info → commonground_api_common-2.4.1.dist-info}/METADATA +47 -40
  3. {commonground_api_common-1.12.2.dist-info → commonground_api_common-2.4.1.dist-info}/RECORD +47 -52
  4. {commonground_api_common-1.12.2.dist-info → commonground_api_common-2.4.1.dist-info}/WHEEL +1 -1
  5. vng_api_common/__init__.py +1 -1
  6. vng_api_common/admin.py +1 -20
  7. vng_api_common/api/views.py +1 -0
  8. vng_api_common/apps.py +44 -26
  9. vng_api_common/audittrails/utils.py +44 -0
  10. vng_api_common/authorizations/admin.py +1 -1
  11. vng_api_common/authorizations/middleware.py +244 -0
  12. vng_api_common/authorizations/migrations/0016_remove_authorizationsconfig_api_root_and_more.py +76 -0
  13. vng_api_common/authorizations/models.py +62 -3
  14. vng_api_common/authorizations/utils.py +17 -0
  15. vng_api_common/authorizations/validators.py +5 -11
  16. vng_api_common/caching/etags.py +2 -1
  17. vng_api_common/client.py +61 -29
  18. vng_api_common/conf/api.py +33 -48
  19. vng_api_common/contrib/setup_configuration/models.py +32 -0
  20. vng_api_common/contrib/setup_configuration/steps.py +46 -0
  21. vng_api_common/extensions/file.py +26 -0
  22. vng_api_common/extensions/gegevensgroep.py +16 -0
  23. vng_api_common/extensions/geojson.py +270 -0
  24. vng_api_common/extensions/hyperlink.py +37 -0
  25. vng_api_common/extensions/polymorphic.py +68 -0
  26. vng_api_common/extensions/query.py +20 -0
  27. vng_api_common/filters.py +0 -1
  28. vng_api_common/generators.py +12 -113
  29. vng_api_common/middleware.py +1 -227
  30. vng_api_common/migrations/0006_delete_apicredential.py +120 -0
  31. vng_api_common/mocks.py +4 -1
  32. vng_api_common/models.py +10 -111
  33. vng_api_common/notifications/api/views.py +8 -8
  34. vng_api_common/notifications/handlers.py +8 -3
  35. vng_api_common/notifications/migrations/0011_remove_subscription_config_and_more.py +23 -0
  36. vng_api_common/oas.py +6 -10
  37. vng_api_common/pagination.py +10 -0
  38. vng_api_common/routers.py +3 -3
  39. vng_api_common/schema.py +414 -158
  40. vng_api_common/tests/schema.py +13 -0
  41. vng_api_common/utils.py +0 -22
  42. vng_api_common/validators.py +111 -113
  43. vng_api_common/views.py +35 -20
  44. commonground_api_common-1.12.2.data/scripts/generate_schema +0 -39
  45. commonground_api_common-1.12.2.data/scripts/use_external_components +0 -16
  46. vng_api_common/inspectors/cache.py +0 -57
  47. vng_api_common/inspectors/fields.py +0 -126
  48. vng_api_common/inspectors/files.py +0 -121
  49. vng_api_common/inspectors/geojson.py +0 -360
  50. vng_api_common/inspectors/polymorphic.py +0 -72
  51. vng_api_common/inspectors/query.py +0 -96
  52. vng_api_common/inspectors/utils.py +0 -40
  53. vng_api_common/inspectors/view.py +0 -547
  54. vng_api_common/management/commands/generate_autorisaties.py +0 -43
  55. vng_api_common/management/commands/generate_notificaties.py +0 -40
  56. vng_api_common/management/commands/generate_swagger.py +0 -197
  57. vng_api_common/management/commands/patch_error_contenttypes.py +0 -61
  58. vng_api_common/management/commands/use_external_components.py +0 -94
  59. vng_api_common/notifications/constants.py +0 -3
  60. vng_api_common/notifications/models.py +0 -97
  61. vng_api_common/templates/vng_api_common/api_schema_to_markdown_table.md +0 -16
  62. vng_api_common/templates/vng_api_common/autorisaties.md +0 -15
  63. vng_api_common/templates/vng_api_common/notificaties.md +0 -24
  64. {commonground_api_common-1.12.2.dist-info → commonground_api_common-2.4.1.dist-info}/top_level.txt +0 -0
  65. /vng_api_common/{inspectors → contrib}/__init__.py +0 -0
  66. /vng_api_common/{management → contrib/setup_configuration}/__init__.py +0 -0
  67. /vng_api_common/{management/commands → extensions}/__init__.py +0 -0
@@ -1,8 +1,9 @@
1
1
  from django.conf import settings
2
2
  from django.utils.module_loading import import_string
3
3
 
4
- from drf_yasg.utils import swagger_auto_schema
4
+ from drf_spectacular.utils import extend_schema
5
5
  from notifications_api_common.api.serializers import NotificatieSerializer
6
+ from notifications_api_common.constants import SCOPE_NOTIFICATIES_PUBLICEREN_LABEL
6
7
  from rest_framework import status
7
8
  from rest_framework.response import Response
8
9
  from rest_framework.views import APIView
@@ -10,7 +11,6 @@ from rest_framework.views import APIView
10
11
  from ...permissions import AuthScopesRequired
11
12
  from ...scopes import Scope
12
13
  from ...serializers import FoutSerializer, ValidatieFoutSerializer
13
- from ..constants import SCOPE_NOTIFICATIES_PUBLICEREN_LABEL
14
14
 
15
15
 
16
16
  class NotificationBaseView(APIView):
@@ -18,17 +18,15 @@ class NotificationBaseView(APIView):
18
18
  Abstract view to receive webhooks
19
19
  """
20
20
 
21
- swagger_schema = None
21
+ schema = None
22
22
 
23
23
  permission_classes = (AuthScopesRequired,)
24
- required_scopes = Scope(
25
- SCOPE_NOTIFICATIES_PUBLICEREN_LABEL
26
- ) # FIXME: this should be standalone!
24
+ required_scopes = Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL, private=True)
27
25
 
28
26
  def get_serializer(self, *args, **kwargs):
29
27
  return NotificatieSerializer(*args, **kwargs)
30
28
 
31
- @swagger_auto_schema(
29
+ @extend_schema(
32
30
  responses={
33
31
  204: "",
34
32
  400: ValidatieFoutSerializer,
@@ -55,7 +53,9 @@ class NotificationBaseView(APIView):
55
53
  class NotificationView(NotificationBaseView):
56
54
  action = "create"
57
55
  permission_classes = (AuthScopesRequired,)
58
- required_scopes = {"create": Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL)}
56
+ required_scopes = {
57
+ "create": Scope(SCOPE_NOTIFICATIES_PUBLICEREN_LABEL, private=True)
58
+ }
59
59
 
60
60
  def create(self, request, *args, **kwargs):
61
61
  return self.post(request, *args, **kwargs)
@@ -4,7 +4,7 @@ from djangorestframework_camel_case.util import underscoreize
4
4
 
5
5
  from ..authorizations.models import Applicatie
6
6
  from ..authorizations.serializers import ApplicatieUuidSerializer
7
- from ..client import get_client
7
+ from ..client import get_client, to_internal_data
8
8
  from ..constants import CommonResourceAction
9
9
  from ..utils import get_uuid_from_path
10
10
 
@@ -20,8 +20,13 @@ class LoggingHandler:
20
20
  class AuthHandler:
21
21
  def _request_auth(self, url: str) -> dict:
22
22
  client = get_client(url)
23
- response = client.retrieve("applicatie", url)
24
- return underscoreize(response)
23
+
24
+ if not client:
25
+ return {}
26
+
27
+ response = client.get(url)
28
+ data = to_internal_data(response)
29
+ return underscoreize(data)
25
30
 
26
31
  def handle(self, message: dict) -> None:
27
32
  uuid = get_uuid_from_path(message["resource_url"])
@@ -0,0 +1,23 @@
1
+ # Generated by Django 5.1.2 on 2024-10-25 14:07
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("notifications", "0010_auto_20220704_1419"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RemoveField(
14
+ model_name="subscription",
15
+ name="config",
16
+ ),
17
+ migrations.DeleteModel(
18
+ name="NotificationsConfig",
19
+ ),
20
+ migrations.DeleteModel(
21
+ name="Subscription",
22
+ ),
23
+ ]
vng_api_common/oas.py CHANGED
@@ -1,23 +1,19 @@
1
1
  """
2
2
  Utility module for Open API Specification 3.0.x.
3
-
4
- This should get merged into gemma-zds-client, but some heavy refactoring is
5
- needed for that.
6
3
  """
7
4
 
8
5
  from typing import Union
9
6
 
10
7
  import requests
11
8
  import yaml
12
- from drf_yasg import openapi
13
9
 
14
10
  TYPE_MAP = {
15
- openapi.TYPE_OBJECT: dict,
16
- openapi.TYPE_STRING: str,
17
- openapi.TYPE_NUMBER: (float, int),
18
- openapi.TYPE_INTEGER: int,
19
- openapi.TYPE_BOOLEAN: bool,
20
- openapi.TYPE_ARRAY: list,
11
+ "object": dict,
12
+ "string": str,
13
+ "number": (float, int),
14
+ "integer": int,
15
+ "boolean": bool,
16
+ "array": list,
21
17
  }
22
18
 
23
19
 
@@ -0,0 +1,10 @@
1
+ from rest_framework.pagination import PageNumberPagination
2
+
3
+
4
+ class DynamicPageSizeMixin:
5
+ page_size = 100
6
+ page_size_query_param = "pageSize"
7
+ max_page_size = 500
8
+
9
+
10
+ class DynamicPageSizePagination(DynamicPageSizeMixin, PageNumberPagination): ...
vng_api_common/routers.py CHANGED
@@ -8,7 +8,7 @@ class APIRootView(_APIRootView):
8
8
  permission_classes = ()
9
9
 
10
10
 
11
- class ZDSNestedRegisteringMixin:
11
+ class NestedRegisteringMixin:
12
12
  _nested_router = None
13
13
 
14
14
  def __init__(self, *args, **kwargs):
@@ -47,11 +47,11 @@ class ZDSNestedRegisteringMixin:
47
47
  )
48
48
 
49
49
 
50
- class NestedSimpleRouter(ZDSNestedRegisteringMixin, routers.NestedSimpleRouter):
50
+ class NestedSimpleRouter(NestedRegisteringMixin, routers.NestedSimpleRouter):
51
51
  pass
52
52
 
53
53
 
54
- class DefaultRouter(ZDSNestedRegisteringMixin, routers.DefaultRouter):
54
+ class DefaultRouter(NestedRegisteringMixin, routers.DefaultRouter):
55
55
  APIRootView = APIRootView
56
56
 
57
57