Skip to content

Commit 90eb4b5

Browse files
committed
📝 [maykinmedia/open-api-framework#115] Regenerate schema
1 parent 56b66b2 commit 90eb4b5

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

bin/generate_schema.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export SCHEMA_PATH=src/objects/api/v2/openapi.yaml
99

1010
OUTPUT_FILE=$1
1111

12-
src/manage.py spectacular --file ${OUTPUT_FILE:-$SCHEMA_PATH} --validate
12+
src/manage.py spectacular --file ${OUTPUT_FILE:-$SCHEMA_PATH} --validate --lang="en"

src/objects/api/v2/openapi.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ paths:
800800
components:
801801
schemas:
802802
GeoJSONGeometry:
803+
title: GeoJSONGeometry
804+
type: object
803805
oneOf:
804806
- $ref: '#/components/schemas/Point'
805807
- $ref: '#/components/schemas/MultiPoint'
@@ -810,14 +812,6 @@ components:
810812
- $ref: '#/components/schemas/GeometryCollection'
811813
discriminator:
812814
propertyName: type
813-
mapping:
814-
Point: '#/components/schemas/Point'
815-
MultiPoint: '#/components/schemas/MultiPoint'
816-
LineString: '#/components/schemas/LineString'
817-
MultiLineString: '#/components/schemas/MultiLineString'
818-
Polygon: '#/components/schemas/Polygon'
819-
MultiPolygon: '#/components/schemas/MultiPolygon'
820-
GeometryCollection: '#/components/schemas/GeometryCollection'
821815
GeoWithin:
822816
type: object
823817
properties:
@@ -833,7 +827,8 @@ components:
833827
url: https://tools.ietf.org/html/rfc7946#section-3.1
834828
properties:
835829
type:
836-
type: string
830+
allOf:
831+
- $ref: '#/components/schemas/TypeEnum'
837832
description: The geometry type
838833
GeometryCollection:
839834
type: object
@@ -986,11 +981,11 @@ components:
986981
url:
987982
type: string
988983
format: uri
984+
readOnly: true
989985
minLength: 1
990986
maxLength: 1000
991987
description: URL reference to this object. This is the unique identification
992988
and location of this object.
993-
readOnly: true
994989
uuid:
995990
type: string
996991
format: uuid
@@ -1143,11 +1138,11 @@ components:
11431138
url:
11441139
type: string
11451140
format: uri
1141+
readOnly: true
11461142
minLength: 1
11471143
maxLength: 1000
11481144
description: URL reference to this object. This is the unique identification
11491145
and location of this object.
1150-
readOnly: true
11511146
uuid:
11521147
type: string
11531148
format: uuid
@@ -1228,6 +1223,18 @@ components:
12281223
type: array
12291224
items:
12301225
$ref: '#/components/schemas/Point2D'
1226+
TypeEnum:
1227+
type: string
1228+
enum:
1229+
- Point
1230+
- MultiPoint
1231+
- LineString
1232+
- MultiLineString
1233+
- Polygon
1234+
- MultiPolygon
1235+
- Feature
1236+
- FeatureCollection
1237+
- GeometryCollection
12311238
securitySchemes:
12321239
tokenAuth:
12331240
type: apiKey

src/objects/utils/apps.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
from django.apps import AppConfig
22

3+
from drf_spectacular.extensions import OpenApiFilterExtension
4+
5+
6+
def unregister_camelize_filter_extension():
7+
"""
8+
CamelizeFilterExtension from vng_api_common is loaded automatically
9+
and cannot be removed using SPECTACULAR_SETTINGS.
10+
"""
11+
OpenApiFilterExtension._registry = [
12+
ext
13+
for ext in OpenApiFilterExtension._registry
14+
if ext.__name__ != "CamelizeFilterExtension"
15+
]
16+
317

418
class UtilsConfig(AppConfig):
519
name = "objects.utils"
620

721
def ready(self):
822
from . import checks # noqa
923
from . import oas_extensions # noqa
24+
25+
unregister_camelize_filter_extension()

0 commit comments

Comments
 (0)