Skip to content

Commit 9ae7d61

Browse files
authored
Merge pull request #545 from maykinmedia/issue/fix-oas-check
👷 [maykinmedia/open-api-framework#115] Always run OAS check
2 parents 3261425 + 90eb4b5 commit 9ae7d61

File tree

7 files changed

+40
-21
lines changed

7 files changed

+40
-21
lines changed

.github/workflows/oas-check.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ name: check-oas
22

33
on:
44
push:
5-
paths:
6-
- "src/objects/api/*/openapi.yaml"
7-
- .github/workflows/oas-check.yml
8-
branches:
9-
- '**'
105
workflow_dispatch:
116

127
jobs:
138
open-api-workflow-check-oas:
14-
uses: maykinmedia/open-api-workflows/.github/workflows/oas-check.yml@v1
9+
uses: maykinmedia/open-api-workflows/.github/workflows/oas-check.yml@v5.0.0
1510
with:
1611
schema-path: 'src/objects/api/v2/openapi.yaml'
12+
schema-options: 'src/objects/api/v2/openapi.yaml'
1713
python-version: '3.11'
1814
django-settings-module: 'objects.conf.ci'
1915
apt-packages: 'libgdal-dev gdal-bin'

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"

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ click-plugins==1.1.1
5757
# via celery
5858
click-repl==0.3.0
5959
# via celery
60-
commonground-api-common==2.5.1
60+
commonground-api-common==2.5.2
6161
# via open-api-framework
6262
coreapi==2.3.3
6363
# via commonground-api-common

requirements/ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ click-repl==0.3.0
115115
# celery
116116
codecov==2.1.13
117117
# via -r requirements/test-tools.in
118-
commonground-api-common==2.5.1
118+
commonground-api-common==2.5.2
119119
# via
120120
# -c requirements/base.txt
121121
# -r requirements/base.txt

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ codecov==2.1.13
143143
# via
144144
# -c requirements/ci.txt
145145
# -r requirements/ci.txt
146-
commonground-api-common==2.5.1
146+
commonground-api-common==2.5.2
147147
# via
148148
# -c requirements/ci.txt
149149
# -r requirements/ci.txt

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)