-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
questionFurther information is requestedFurther information is requested
Description
When registering a lazy deserialiser for a type that extends Protocol, the type can be made not findable by the addition of an unrelated type. The following code correctly finds the deserialiser, unless Bar is registered before Foo- Bar can also be found if baz is removed.
from typing import Protocol, runtime_checkable
from apischema import deserialize, deserializer
from apischema.conversions import Conversion
@runtime_checkable
class Foo(Protocol):
...
@runtime_checkable
class Bar(Protocol):
def baz(self):
...
for protocol in [Foo, Bar]:
deserializer(
lazy=lambda: Conversion(lambda as_str: ..., source=str, target=protocol),
target=protocol,
)
assert deserialize(Bar, "foo") == ...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested