commonground-api-common 2.2.0__py3-none-any.whl → 2.3.0__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 (45) hide show
  1. commonground_api_common-2.2.0.data/scripts/patch_content_types → commonground_api_common-2.3.0.data/scripts/generate_schema +2 -4
  2. {commonground_api_common-2.2.0.dist-info → commonground_api_common-2.3.0.dist-info}/METADATA +10 -3
  3. {commonground_api_common-2.2.0.dist-info → commonground_api_common-2.3.0.dist-info}/RECORD +25 -38
  4. {commonground_api_common-2.2.0.dist-info → commonground_api_common-2.3.0.dist-info}/WHEEL +1 -1
  5. vng_api_common/__init__.py +1 -1
  6. vng_api_common/api/views.py +1 -0
  7. vng_api_common/apps.py +43 -26
  8. vng_api_common/audittrails/utils.py +44 -0
  9. vng_api_common/conf/api.py +33 -45
  10. vng_api_common/contrib/setup_configuration/models.py +14 -0
  11. vng_api_common/contrib/setup_configuration/steps.py +24 -1
  12. vng_api_common/extensions/file.py +26 -0
  13. vng_api_common/extensions/gegevensgroep.py +16 -0
  14. vng_api_common/extensions/geojson.py +270 -0
  15. vng_api_common/extensions/hyperlink.py +37 -0
  16. vng_api_common/extensions/polymorphic.py +68 -0
  17. vng_api_common/extensions/query.py +20 -0
  18. vng_api_common/filters.py +0 -1
  19. vng_api_common/generators.py +12 -113
  20. vng_api_common/notifications/api/views.py +3 -3
  21. vng_api_common/oas.py +6 -7
  22. vng_api_common/schema.py +414 -158
  23. vng_api_common/views.py +1 -1
  24. commonground_api_common-2.2.0.data/scripts/generate_schema +0 -39
  25. commonground_api_common-2.2.0.data/scripts/use_external_components +0 -16
  26. vng_api_common/inspectors/cache.py +0 -57
  27. vng_api_common/inspectors/fields.py +0 -126
  28. vng_api_common/inspectors/files.py +0 -121
  29. vng_api_common/inspectors/geojson.py +0 -360
  30. vng_api_common/inspectors/polymorphic.py +0 -72
  31. vng_api_common/inspectors/query.py +0 -91
  32. vng_api_common/inspectors/utils.py +0 -40
  33. vng_api_common/inspectors/view.py +0 -547
  34. vng_api_common/management/__init__.py +0 -0
  35. vng_api_common/management/commands/__init__.py +0 -0
  36. vng_api_common/management/commands/generate_autorisaties.py +0 -43
  37. vng_api_common/management/commands/generate_notificaties.py +0 -40
  38. vng_api_common/management/commands/generate_swagger.py +0 -197
  39. vng_api_common/management/commands/patch_error_contenttypes.py +0 -61
  40. vng_api_common/management/commands/use_external_components.py +0 -94
  41. vng_api_common/templates/vng_api_common/api_schema_to_markdown_table.md +0 -16
  42. vng_api_common/templates/vng_api_common/autorisaties.md +0 -15
  43. vng_api_common/templates/vng_api_common/notificaties.md +0 -24
  44. {commonground_api_common-2.2.0.dist-info → commonground_api_common-2.3.0.dist-info}/top_level.txt +0 -0
  45. /vng_api_common/{inspectors → extensions}/__init__.py +0 -0
@@ -1,57 +0,0 @@
1
- from collections import OrderedDict
2
-
3
- from django.utils.translation import gettext_lazy as _
4
-
5
- from drf_yasg import openapi
6
- from rest_framework.views import APIView
7
-
8
- from ..caching.introspection import has_cache_header
9
-
10
- CACHE_REQUEST_HEADERS = [
11
- openapi.Parameter(
12
- name="If-None-Match",
13
- type=openapi.TYPE_STRING,
14
- in_=openapi.IN_HEADER,
15
- required=False,
16
- description=_(
17
- "Perform conditional requests. This header should contain one or "
18
- "multiple ETag values of resources the client has cached. If the "
19
- "current resource ETag value is in this set, then an HTTP 304 "
20
- "empty body will be returned. See "
21
- "[MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) "
22
- "for details."
23
- ),
24
- examples={
25
- "oneValue": {
26
- "summary": _("One ETag value"),
27
- "value": '"79054025255fb1a26e4bc422aef54eb4"',
28
- },
29
- "multipleValues": {
30
- "summary": _("Multiple ETag values"),
31
- "value": '"79054025255fb1a26e4bc422aef54eb4", "e4d909c290d0fb1ca068ffaddf22cbd0"',
32
- },
33
- },
34
- )
35
- ]
36
-
37
-
38
- def get_cache_headers(view: APIView) -> OrderedDict:
39
- if not has_cache_header(view):
40
- return OrderedDict()
41
-
42
- return OrderedDict(
43
- (
44
- (
45
- "ETag",
46
- openapi.Schema(
47
- type=openapi.TYPE_STRING,
48
- description=_(
49
- "De ETag berekend op de response body JSON. "
50
- "Indien twee resources exact dezelfde ETag hebben, dan zijn "
51
- "deze resources identiek aan elkaar. Je kan de ETag gebruiken "
52
- "om caching te implementeren."
53
- ),
54
- ),
55
- ),
56
- )
57
- )
@@ -1,126 +0,0 @@
1
- import logging
2
-
3
- from drf_yasg import openapi
4
- from drf_yasg.inspectors.base import NotHandled
5
- from drf_yasg.inspectors.field import FieldInspector, InlineSerializerInspector
6
- from rest_framework import serializers
7
-
8
- from ..serializers import GegevensGroepSerializer, LengthHyperlinkedRelatedField
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
-
13
- TYPES_MAP = {
14
- str: openapi.TYPE_STRING,
15
- int: openapi.TYPE_INTEGER,
16
- bool: openapi.TYPE_BOOLEAN,
17
- }
18
-
19
-
20
- class ReadOnlyFieldInspector(FieldInspector):
21
- """
22
- Provides conversion for derived ReadOnlyField from model fields.
23
-
24
- This inspector looks at the type hint to determine the type/format of
25
- a model property.
26
- """
27
-
28
- def field_to_swagger_object(
29
- self, field, swagger_object_type, use_references, **kwargs
30
- ):
31
- SwaggerType, ChildSwaggerType = self._get_partial_types(
32
- field, swagger_object_type, use_references, **kwargs
33
- )
34
-
35
- if (
36
- isinstance(field, serializers.ReadOnlyField)
37
- and swagger_object_type == openapi.Schema
38
- ):
39
- prop = getattr(field.parent.Meta.model, field.source)
40
- if not isinstance(prop, property):
41
- return NotHandled
42
-
43
- return_type = prop.fget.__annotations__.get("return")
44
- if return_type is None: # no type annotation, too bad...
45
- logger.debug(
46
- "Missing return type annotation for prop %s on model %s",
47
- field.source,
48
- field.parent.Meta.model,
49
- )
50
- return NotHandled
51
-
52
- type_ = TYPES_MAP.get(return_type)
53
- if type_ is None:
54
- logger.debug("Missing type mapping for %r", return_type)
55
-
56
- return SwaggerType(type=type_ or openapi.TYPE_STRING)
57
-
58
- return NotHandled
59
-
60
-
61
- class HyperlinkedIdentityFieldInspector(FieldInspector):
62
- def field_to_swagger_object(
63
- self, field, swagger_object_type, use_references, **kwargs
64
- ):
65
- SwaggerType, ChildSwaggerType = self._get_partial_types(
66
- field, swagger_object_type, use_references, **kwargs
67
- )
68
-
69
- if (
70
- isinstance(field, serializers.HyperlinkedIdentityField)
71
- and swagger_object_type == openapi.Schema
72
- ):
73
- return SwaggerType(
74
- type=openapi.TYPE_STRING,
75
- format=openapi.FORMAT_URI,
76
- min_length=1,
77
- max_length=1000,
78
- description="URL-referentie naar dit object. Dit is de unieke identificatie en locatie van dit object.",
79
- )
80
-
81
- return NotHandled
82
-
83
-
84
- class HyperlinkedRelatedFieldInspector(FieldInspector):
85
- def field_to_swagger_object(
86
- self, field, swagger_object_type, use_references, **kwargs
87
- ):
88
- SwaggerType, ChildSwaggerType = self._get_partial_types(
89
- field, swagger_object_type, use_references, **kwargs
90
- )
91
-
92
- if (
93
- isinstance(field, LengthHyperlinkedRelatedField)
94
- and swagger_object_type == openapi.Schema
95
- ):
96
- max_length = field.max_length
97
- min_length = field.min_length
98
- return SwaggerType(
99
- type=openapi.TYPE_STRING,
100
- format=openapi.FORMAT_URI,
101
- min_length=min_length,
102
- max_length=max_length,
103
- description=field.help_text,
104
- )
105
-
106
- return NotHandled
107
-
108
-
109
- class GegevensGroepInspector(InlineSerializerInspector):
110
- def process_result(self, result, method_name, obj, **kwargs):
111
- if not isinstance(result, openapi.Schema.OR_REF):
112
- return result
113
-
114
- if not isinstance(obj, GegevensGroepSerializer):
115
- return result
116
-
117
- if method_name != "field_to_swagger_object":
118
- return result
119
-
120
- if not obj.allow_null:
121
- return result
122
-
123
- schema = openapi.resolve_ref(result, self.components)
124
- schema.x_nullable = True
125
-
126
- return result
@@ -1,121 +0,0 @@
1
- from collections import OrderedDict
2
-
3
- from django.utils.translation import gettext as _
4
-
5
- from drf_extra_fields.fields import Base64FieldMixin
6
- from drf_yasg import openapi
7
- from drf_yasg.inspectors import (
8
- CamelCaseJSONFilter,
9
- FieldInspector,
10
- NotHandled,
11
- ViewInspector,
12
- )
13
- from drf_yasg.utils import filter_none, get_serializer_ref_name
14
- from rest_framework import serializers
15
-
16
-
17
- class FileFieldInspector(CamelCaseJSONFilter):
18
- def get_schema(self, serializer):
19
- if self.method not in ViewInspector.body_methods:
20
- return NotHandled
21
-
22
- # only do this if there are base64 mixin fields
23
- if any(
24
- isinstance(field, Base64FieldMixin) for field in serializer.fields.values()
25
- ):
26
- return self.probe_field_inspectors(serializer, openapi.Schema, True)
27
-
28
- return NotHandled
29
-
30
- def field_to_swagger_object(
31
- self, field, swagger_object_type, use_references, **kwargs
32
- ):
33
- if isinstance(field, serializers.Serializer):
34
- return self._serializer_to_swagger_object(
35
- field, swagger_object_type, use_references, **kwargs
36
- )
37
-
38
- if not isinstance(field, Base64FieldMixin):
39
- return NotHandled
40
-
41
- SwaggerType, ChildSwaggerType = self._get_partial_types(
42
- field, swagger_object_type, use_references, **kwargs
43
- )
44
-
45
- type_b64 = SwaggerType(
46
- type=openapi.TYPE_STRING,
47
- format=openapi.FORMAT_BASE64,
48
- description=_("Base64 encoded binary content."),
49
- )
50
- type_uri = SwaggerType(
51
- type=openapi.TYPE_STRING,
52
- read_only=True,
53
- format=openapi.FORMAT_URI,
54
- description=_("Download URL of the binary content."),
55
- )
56
-
57
- if swagger_object_type == openapi.Schema:
58
- # on writes, it's always b64
59
- if self.method in ViewInspector.body_methods:
60
- return type_b64
61
-
62
- # if not representing in base64, it's a link
63
- return type_uri if not field.represent_in_base64 else type_b64
64
-
65
- return NotHandled
66
-
67
- def _serializer_to_swagger_object(
68
- self, serializer, swagger_object_type, use_references, **kwargs
69
- ):
70
- if self.method not in ViewInspector.body_methods:
71
- return NotHandled
72
-
73
- if not any(
74
- isinstance(field, Base64FieldMixin) for field in serializer.fields.values()
75
- ):
76
- return NotHandled
77
-
78
- SwaggerType, ChildSwaggerType = self._get_partial_types(
79
- serializer, swagger_object_type, use_references, **kwargs
80
- )
81
-
82
- ref_name = get_serializer_ref_name(serializer)
83
- ref_name = f"{ref_name}Data" if ref_name else None
84
-
85
- def make_schema_definition():
86
- properties = OrderedDict()
87
- required = []
88
- for property_name, child in serializer.fields.items():
89
- prop_kwargs = {"read_only": bool(child.read_only) or None}
90
- prop_kwargs = filter_none(prop_kwargs)
91
-
92
- child_schema = self.probe_field_inspectors(
93
- child, ChildSwaggerType, use_references, **prop_kwargs
94
- )
95
- properties[property_name] = child_schema
96
-
97
- if child.required and not getattr(child_schema, "read_only", False):
98
- required.append(property_name)
99
-
100
- result = SwaggerType(
101
- type=openapi.TYPE_OBJECT,
102
- properties=properties,
103
- required=required or None,
104
- )
105
- if not ref_name and "title" in result:
106
- # on an inline model, the title is derived from the field name
107
- # but is visually displayed like the model name, which is confusing
108
- # it is better to just remove title from inline models
109
- del result.title
110
-
111
- # Provide an option to add manual paremeters to a schema
112
- # for example, to add examples
113
- # self.add_manual_fields(serializer, result)
114
- return self.process_result(result, None, None)
115
-
116
- if not ref_name or not use_references:
117
- return make_schema_definition()
118
-
119
- definitions = self.components.with_scope(openapi.SCHEMA_DEFINITIONS)
120
- definitions.setdefault(ref_name, make_schema_definition)
121
- return openapi.SchemaRef(definitions, ref_name)
@@ -1,360 +0,0 @@
1
- from collections import OrderedDict
2
-
3
- from drf_yasg import openapi
4
- from drf_yasg.inspectors import FieldInspector, NotHandled
5
- from rest_framework import serializers
6
- from rest_framework_gis.fields import GeometryField
7
-
8
- from ..geo import DEFAULT_CRS, HEADER_ACCEPT, HEADER_CONTENT
9
-
10
- REF_NAME_GEOJSON_GEOMETRY = "GeoJSONGeometry"
11
-
12
-
13
- def register_geojson(definitions):
14
- Geometry = openapi.Schema(
15
- type=openapi.TYPE_OBJECT,
16
- title="Geometry",
17
- description="GeoJSON geometry",
18
- required=["type"],
19
- externalDocs=OrderedDict(url="https://tools.ietf.org/html/rfc7946#section-3.1"),
20
- properties=OrderedDict(
21
- (
22
- (
23
- "type",
24
- openapi.Schema(
25
- type=openapi.TYPE_STRING,
26
- enum=[
27
- "Point",
28
- "MultiPoint",
29
- "LineString",
30
- "MultiLineString",
31
- "Polygon",
32
- "MultiPolygon",
33
- "Feature",
34
- "FeatureCollection",
35
- "GeometryCollection",
36
- ],
37
- description="The geometry type",
38
- ),
39
- ),
40
- )
41
- ),
42
- )
43
- definitions.set("Geometry", Geometry)
44
-
45
- Point2D = openapi.Schema(
46
- type=openapi.TYPE_ARRAY,
47
- title="Point2D",
48
- description="A 2D point",
49
- items=openapi.Schema(type=openapi.TYPE_NUMBER),
50
- maxItems=2,
51
- minItems=2,
52
- )
53
- definitions.set("Point2D", Point2D)
54
-
55
- Point = openapi.Schema(
56
- type=openapi.TYPE_OBJECT,
57
- description="GeoJSON point geometry",
58
- externalDocs=OrderedDict(
59
- url="https://tools.ietf.org/html/rfc7946#section-3.1.2"
60
- ),
61
- allOf=[
62
- openapi.SchemaRef(definitions, "Geometry"),
63
- openapi.Schema(
64
- type=openapi.TYPE_OBJECT,
65
- required=["coordinates"],
66
- properties=OrderedDict(
67
- (("coordinates", openapi.SchemaRef(definitions, "Point2D")),)
68
- ),
69
- ),
70
- ],
71
- )
72
- definitions.set("Point", Point)
73
-
74
- MultiPoint = openapi.Schema(
75
- type=openapi.TYPE_OBJECT,
76
- description="GeoJSON multi-point geometry",
77
- externalDocs=OrderedDict(
78
- url="https://tools.ietf.org/html/rfc7946#section-3.1.3"
79
- ),
80
- allOf=[
81
- openapi.SchemaRef(definitions, "Geometry"),
82
- openapi.Schema(
83
- type=openapi.TYPE_OBJECT,
84
- required=["coordinates"],
85
- properties=OrderedDict(
86
- (
87
- (
88
- "coordinates",
89
- openapi.Schema(
90
- type=openapi.TYPE_ARRAY,
91
- items=openapi.SchemaRef(definitions, "Point2D"),
92
- ),
93
- ),
94
- )
95
- ),
96
- ),
97
- ],
98
- )
99
- definitions.set("MultiPoint", MultiPoint)
100
-
101
- LineString = openapi.Schema(
102
- type=openapi.TYPE_OBJECT,
103
- description="GeoJSON line-string geometry",
104
- externalDocs=OrderedDict(
105
- url="https://tools.ietf.org/html/rfc7946#section-3.1.4"
106
- ),
107
- allOf=[
108
- openapi.SchemaRef(definitions, "Geometry"),
109
- openapi.Schema(
110
- type=openapi.TYPE_OBJECT,
111
- required=["coordinates"],
112
- properties=OrderedDict(
113
- (
114
- (
115
- "coordinates",
116
- openapi.Schema(
117
- type=openapi.TYPE_ARRAY,
118
- items=openapi.SchemaRef(definitions, "Point2D"),
119
- minItems=2,
120
- ),
121
- ),
122
- )
123
- ),
124
- ),
125
- ],
126
- )
127
- definitions.set("LineString", LineString)
128
-
129
- MultiLineString = openapi.Schema(
130
- type=openapi.TYPE_OBJECT,
131
- description="GeoJSON multi-line-string geometry",
132
- externalDocs=OrderedDict(
133
- url="https://tools.ietf.org/html/rfc7946#section-3.1.5"
134
- ),
135
- allOf=[
136
- openapi.SchemaRef(definitions, "Geometry"),
137
- openapi.Schema(
138
- type=openapi.TYPE_OBJECT,
139
- required=["coordinates"],
140
- properties=OrderedDict(
141
- (
142
- (
143
- "coordinates",
144
- openapi.Schema(
145
- type=openapi.TYPE_ARRAY,
146
- items=openapi.Schema(
147
- type=openapi.TYPE_ARRAY,
148
- items=openapi.SchemaRef(definitions, "Point2D"),
149
- ),
150
- ),
151
- ),
152
- )
153
- ),
154
- ),
155
- ],
156
- )
157
- definitions.set("MultiLineString", MultiLineString)
158
-
159
- Polygon = openapi.Schema(
160
- type=openapi.TYPE_OBJECT,
161
- description="GeoJSON polygon geometry",
162
- externalDocs=OrderedDict(
163
- url="https://tools.ietf.org/html/rfc7946#section-3.1.6"
164
- ),
165
- allOf=[
166
- openapi.SchemaRef(definitions, "Geometry"),
167
- openapi.Schema(
168
- type=openapi.TYPE_OBJECT,
169
- required=["coordinates"],
170
- properties=OrderedDict(
171
- (
172
- (
173
- "coordinates",
174
- openapi.Schema(
175
- type=openapi.TYPE_ARRAY,
176
- items=openapi.Schema(
177
- type=openapi.TYPE_ARRAY,
178
- items=openapi.SchemaRef(definitions, "Point2D"),
179
- ),
180
- ),
181
- ),
182
- )
183
- ),
184
- ),
185
- ],
186
- )
187
- definitions.set("Polygon", Polygon)
188
-
189
- MultiPolygon = openapi.Schema(
190
- type=openapi.TYPE_OBJECT,
191
- description="GeoJSON multi-polygon geometry",
192
- externalDocs=OrderedDict(
193
- url="https://tools.ietf.org/html/rfc7946#section-3.1.7"
194
- ),
195
- allOf=[
196
- openapi.SchemaRef(definitions, "Geometry"),
197
- openapi.Schema(
198
- type=openapi.TYPE_OBJECT,
199
- required=["coordinates"],
200
- properties=OrderedDict(
201
- (
202
- (
203
- "coordinates",
204
- openapi.Schema(
205
- type=openapi.TYPE_ARRAY,
206
- items=openapi.Schema(
207
- type=openapi.TYPE_ARRAY,
208
- items=openapi.Schema(
209
- type=openapi.TYPE_ARRAY,
210
- items=openapi.SchemaRef(definitions, "Point2D"),
211
- ),
212
- ),
213
- ),
214
- ),
215
- )
216
- ),
217
- ),
218
- ],
219
- )
220
- definitions.set("MultiPolygon", MultiPolygon)
221
-
222
- GeometryCollection = openapi.Schema(
223
- type=openapi.TYPE_OBJECT,
224
- description="GeoJSON multi-polygon geometry",
225
- externalDocs=OrderedDict(
226
- url="https://tools.ietf.org/html/rfc7946#section-3.1.8"
227
- ),
228
- allOf=[
229
- openapi.SchemaRef(definitions, "Geometry"),
230
- openapi.Schema(
231
- type=openapi.TYPE_OBJECT,
232
- required=["geometries"],
233
- properties=OrderedDict(
234
- (
235
- (
236
- "geometries",
237
- openapi.Schema(
238
- type=openapi.TYPE_ARRAY,
239
- items=openapi.SchemaRef(definitions, "Geometry"),
240
- ),
241
- ),
242
- )
243
- ),
244
- ),
245
- ],
246
- )
247
- definitions.set("GeometryCollection", GeometryCollection)
248
-
249
- GeoJSONGeometry = openapi.Schema(
250
- title=REF_NAME_GEOJSON_GEOMETRY,
251
- type=openapi.TYPE_OBJECT,
252
- oneOf=[
253
- openapi.SchemaRef(definitions, "Point"),
254
- openapi.SchemaRef(definitions, "MultiPoint"),
255
- openapi.SchemaRef(definitions, "LineString"),
256
- openapi.SchemaRef(definitions, "MultiLineString"),
257
- openapi.SchemaRef(definitions, "Polygon"),
258
- openapi.SchemaRef(definitions, "MultiPolygon"),
259
- openapi.SchemaRef(definitions, "GeometryCollection"),
260
- ],
261
- discriminator="type",
262
- )
263
- definitions.set(REF_NAME_GEOJSON_GEOMETRY, GeoJSONGeometry)
264
-
265
-
266
- class GeometryFieldInspector(FieldInspector):
267
- def field_to_swagger_object(
268
- self, field, swagger_object_type, use_references, **kwargs
269
- ):
270
- if not isinstance(field, GeometryField):
271
- return NotHandled
272
-
273
- definitions = self.components.with_scope(openapi.SCHEMA_DEFINITIONS)
274
-
275
- if not definitions.has("Geometry"):
276
- register_geojson(definitions)
277
-
278
- return openapi.SchemaRef(definitions, REF_NAME_GEOJSON_GEOMETRY)
279
-
280
- def has_geo_fields(self, serializer) -> bool:
281
- """
282
- Check if any of the serializer fields are a GeometryField.
283
-
284
- If the serializer has nested serializers, a depth-first search is done
285
- to check if the nested serializers has `GeometryField`\ s.
286
- """
287
- for field in serializer.fields.values():
288
- if isinstance(field, serializers.Serializer):
289
- has_nested_geo_fields = self.probe_inspectors(
290
- self.field_inspectors,
291
- "has_geo_fields",
292
- field,
293
- {"field_inspectors": self.field_inspectors},
294
- )
295
- if has_nested_geo_fields:
296
- return True
297
-
298
- elif isinstance(field, (serializers.ListSerializer, serializers.ListField)):
299
- field = field.child
300
-
301
- if isinstance(field, GeometryField):
302
- return True
303
-
304
- return False
305
-
306
- def get_request_header_parameters(self, serializer):
307
- if not self.has_geo_fields(serializer):
308
- return []
309
-
310
- if self.method == "DELETE":
311
- return []
312
-
313
- # see also http://lyzidiamond.com/posts/4326-vs-3857 for difference
314
- # between coordinate system and projected coordinate system
315
- return [
316
- openapi.Parameter(
317
- name=HEADER_ACCEPT,
318
- type=openapi.TYPE_STRING,
319
- in_=openapi.IN_HEADER,
320
- required=True,
321
- description="Het gewenste 'Coordinate Reference System' (CRS) van de "
322
- "geometrie in het antwoord (response body). Volgens de "
323
- "GeoJSON spec is WGS84 de default (EPSG:4326 is "
324
- "hetzelfde als WGS84).",
325
- enum=[DEFAULT_CRS],
326
- ),
327
- openapi.Parameter(
328
- name=HEADER_CONTENT,
329
- type=openapi.TYPE_STRING,
330
- in_=openapi.IN_HEADER,
331
- required=True,
332
- description="Het 'Coordinate Reference System' (CRS) van de "
333
- "geometrie in de vraag (request body). Volgens de "
334
- "GeoJSON spec is WGS84 de default (EPSG:4326 is "
335
- "hetzelfde als WGS84).",
336
- enum=[DEFAULT_CRS],
337
- ),
338
- ]
339
-
340
- def get_response_headers(self, serializer, status=None):
341
- if not self.has_geo_fields(serializer):
342
- return None
343
-
344
- if int(status) != 200:
345
- return None
346
-
347
- return OrderedDict(
348
- (
349
- (
350
- HEADER_CONTENT,
351
- openapi.Schema(
352
- type=openapi.TYPE_STRING,
353
- enum=[DEFAULT_CRS],
354
- description="Het 'Coordinate Reference System' (CRS) van de "
355
- "antwoorddata. Volgens de GeoJSON spec is WGS84 de "
356
- "default (EPSG:4326 is hetzelfde als WGS84).",
357
- ),
358
- ),
359
- )
360
- )