Skip to content

Commit

Permalink
[#38] replacing anyOf for type with type as string in schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdash committed Sep 26, 2023
1 parent ccb107e commit c68dd11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/models/management/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def main(output_name: str = "api/models/schemas/schema.json"):
f'"$ref": "#/$defs/{definition}"',
json.dumps(class_definition)[1:-1]
)
# replace anyOf with type string or null to type string - needed for the UI to work
json_schema = json_schema.replace(
'"anyOf": [{"type": "string"}, {"type": "null"}]', '"type": "string"'
)
embedded_schema = json.loads(json_schema)
current_directory = absolute_directory(output_name)
with open(current_directory, "w") as f:
Expand Down

0 comments on commit c68dd11

Please sign in to comment.