Skip to content

Commit 5115f39

Browse files
committed
Fix json schema generation
1 parent ff7603a commit 5115f39

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

django_oapif/collections.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ def get_json_schema(
163163
# from the list of required ones
164164
for field_name, field_props in schema["properties"].items():
165165
if field_name not in required_fields:
166-
if (t := field_props.get("AnyOf")) and len(t) == 2 and t[1] == {"type": "null"}:
167-
field_props["type"] = t[1]["type"]
168-
del field_props["AnyOf"]
166+
if (t := field_props.get("anyOf")) and len(t) == 2 and t[1] == {"type": "null"}:
167+
for k, v in t[0].items():
168+
field_props[k] = v
169+
del field_props["anyOf"]
169170

170171
if geom_field := collection.geometry_field:
171172
schema["properties"][geom_field] = {

0 commit comments

Comments
 (0)