mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 22:30:47 +01: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:
|
||||
return
|
||||
if data["type"] == "object" and "properties" in data:
|
||||
for v in data["properties"].values():
|
||||
set_non_nullable(v)
|
||||
if "required" in data:
|
||||
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":
|
||||
for v in data["items"]:
|
||||
set_non_nullable(v)
|
||||
|
||||
Reference in New Issue
Block a user