Skip to content

Commit

Permalink
fix: make Optional work with spectacular (#1786)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Jul 10, 2024
1 parent 9f55cd5 commit d63f184
Show file tree
Hide file tree
Showing 4 changed files with 1,575 additions and 52 deletions.
1 change: 0 additions & 1 deletion backend/varfish/spectacular_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def pydantic_to_json_schema(schema_arg: typing.Any) -> typing.Dict[str, typing.A
"enum": [e.value for e in schema_arg],
}
elif typing.get_origin(schema_arg) is typing.Union: # is typing.Optional[X]
schema_arg = typing.get_args(schema_arg)[0]
one_ofs = [pydantic_to_json_schema(arg_inner) for arg_inner in typing.get_args(schema_arg)]
defs = {}
for one_of in one_ofs:
Expand Down
Loading

0 comments on commit d63f184

Please sign in to comment.