mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-09 21:44:27 +00:00
simple enough fix - handle typing.UnionType
in additional dtype
metadata in json schema
This commit is contained in:
parent
a02d9b2d9c
commit
47d8039819
1 changed files with 9 additions and 3 deletions
|
@ -204,9 +204,15 @@ class NDArray(NPTypingType, metaclass=NDArrayMeta):
|
|||
json_schema = handler(schema["metadata"])
|
||||
json_schema = handler.resolve_ref_schema(json_schema)
|
||||
|
||||
if not isinstance(dtype, tuple) and dtype.__module__ not in (
|
||||
"builtins",
|
||||
"typing",
|
||||
if (
|
||||
not isinstance(dtype, tuple)
|
||||
and dtype.__module__
|
||||
not in (
|
||||
"builtins",
|
||||
"typing",
|
||||
"types",
|
||||
)
|
||||
and hasattr(dtype, "__name__")
|
||||
):
|
||||
json_schema["dtype"] = ".".join([dtype.__module__, dtype.__name__])
|
||||
|
||||
|
|
Loading…
Reference in a new issue