Closed jessemyers-lettuce closed 1 year ago
OpenAPI type null is converted to Python type Any, most likely here:
null
Any
elif schema.type is None or schema.type == "null": converted_type = pre_type + "Any" + post_type
In Fast API (probably among other sources), Foo | None is expressed as:
Foo | None
"anyOf": [ { "$ref": "#/components/schemas/Foo" }, { "type": "null" } ]
because of this issue, we end up with a generated type that uses Union[Foo | Any] instead of Union[Foo | None]
Union[Foo | Any]
Union[Foo | None]
If this is intentional, I'd love to understand why so I can create a fix that doesn't break some implicit, non-obvious behavior.
For my usage, the fix in #53 works.
Fixed in #53
OpenAPI type
null
is converted to Python typeAny
, most likely here:In Fast API (probably among other sources),
Foo | None
is expressed as:because of this issue, we end up with a generated type that uses
Union[Foo | Any]
instead ofUnion[Foo | None]
If this is intentional, I'd love to understand why so I can create a fix that doesn't break some implicit, non-obvious behavior.