mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
fix(swagger): improve non-nullable property handling in Swagger JSON
- Updated set_non_nullable function to ensure required properties are processed correctly. - Added logic to handle cases where 'required' is not present, maintaining existing functionality for non-nullable properties.
This commit is contained in:
@@ -17,8 +17,13 @@ def set_non_nullable(data):
|
|||||||
if "type" not in data:
|
if "type" not in data:
|
||||||
return
|
return
|
||||||
if data["type"] == "object" and "properties" in data:
|
if data["type"] == "object" and "properties" in data:
|
||||||
for v in data["properties"].values():
|
if "required" in data:
|
||||||
set_non_nullable(v)
|
for k, v in data["properties"].items():
|
||||||
|
if k in data["required"]:
|
||||||
|
set_non_nullable(v)
|
||||||
|
else:
|
||||||
|
for v in data["properties"].values():
|
||||||
|
set_non_nullable(v)
|
||||||
if data["type"] == "array":
|
if data["type"] == "array":
|
||||||
for v in data["items"]:
|
for v in data["items"]:
|
||||||
set_non_nullable(v)
|
set_non_nullable(v)
|
||||||
|
|||||||
Reference in New Issue
Block a user