diff --git a/bin/generate_schema.sh b/bin/generate_schema.sh index 61907011..7748d781 100755 --- a/bin/generate_schema.sh +++ b/bin/generate_schema.sh @@ -9,4 +9,4 @@ export SCHEMA_PATH=src/objects/api/v2/openapi.yaml OUTPUT_FILE=$1 -src/manage.py spectacular --file ${OUTPUT_FILE:-$SCHEMA_PATH} --validate +src/manage.py spectacular --file ${OUTPUT_FILE:-$SCHEMA_PATH} --validate --lang="en" diff --git a/src/objects/api/v2/openapi.yaml b/src/objects/api/v2/openapi.yaml index 7fa40c26..a7f3efce 100644 --- a/src/objects/api/v2/openapi.yaml +++ b/src/objects/api/v2/openapi.yaml @@ -800,6 +800,8 @@ paths: components: schemas: GeoJSONGeometry: + title: GeoJSONGeometry + type: object oneOf: - $ref: '#/components/schemas/Point' - $ref: '#/components/schemas/MultiPoint' @@ -810,14 +812,6 @@ components: - $ref: '#/components/schemas/GeometryCollection' discriminator: propertyName: type - mapping: - Point: '#/components/schemas/Point' - MultiPoint: '#/components/schemas/MultiPoint' - LineString: '#/components/schemas/LineString' - MultiLineString: '#/components/schemas/MultiLineString' - Polygon: '#/components/schemas/Polygon' - MultiPolygon: '#/components/schemas/MultiPolygon' - GeometryCollection: '#/components/schemas/GeometryCollection' GeoWithin: type: object properties: @@ -833,7 +827,8 @@ components: url: https://tools.ietf.org/html/rfc7946#section-3.1 properties: type: - type: string + allOf: + - $ref: '#/components/schemas/TypeEnum' description: The geometry type GeometryCollection: type: object @@ -986,11 +981,11 @@ components: url: type: string format: uri + readOnly: true minLength: 1 maxLength: 1000 description: URL reference to this object. This is the unique identification and location of this object. - readOnly: true uuid: type: string format: uuid @@ -1143,11 +1138,11 @@ components: url: type: string format: uri + readOnly: true minLength: 1 maxLength: 1000 description: URL reference to this object. This is the unique identification and location of this object. - readOnly: true uuid: type: string format: uuid @@ -1228,6 +1223,18 @@ components: type: array items: $ref: '#/components/schemas/Point2D' + TypeEnum: + type: string + enum: + - Point + - MultiPoint + - LineString + - MultiLineString + - Polygon + - MultiPolygon + - Feature + - FeatureCollection + - GeometryCollection securitySchemes: tokenAuth: type: apiKey diff --git a/src/objects/utils/apps.py b/src/objects/utils/apps.py index b02dd150..5245b233 100644 --- a/src/objects/utils/apps.py +++ b/src/objects/utils/apps.py @@ -1,5 +1,19 @@ from django.apps import AppConfig +from drf_spectacular.extensions import OpenApiFilterExtension + + +def unregister_camelize_filter_extension(): + """ + CamelizeFilterExtension from vng_api_common is loaded automatically + and cannot be removed using SPECTACULAR_SETTINGS. + """ + OpenApiFilterExtension._registry = [ + ext + for ext in OpenApiFilterExtension._registry + if ext.__name__ != "CamelizeFilterExtension" + ] + class UtilsConfig(AppConfig): name = "objects.utils" @@ -7,3 +21,5 @@ class UtilsConfig(AppConfig): def ready(self): from . import checks # noqa from . import oas_extensions # noqa + + unregister_camelize_filter_extension()