diff --git a/src/blueapi/core/context.py b/src/blueapi/core/context.py index 8689c167b..1bd8e482e 100644 --- a/src/blueapi/core/context.py +++ b/src/blueapi/core/context.py @@ -202,7 +202,9 @@ def __modify_schema__( cls, field_schema: dict[str, Any], field: ModelField | None ): if field: - field_schema.update({"type": repr(target)}) + field_schema.update( + {"type": f"{target.__module__}.{target.__qualname__}"} + ) self._reference_cache[target] = Reference diff --git a/tests/core/test_context.py b/tests/core/test_context.py index 2a01663e3..a1f6bdb1a 100644 --- a/tests/core/test_context.py +++ b/tests/core/test_context.py @@ -131,7 +131,7 @@ def demo_plan(foo: int, mov: Movable) -> MsgGenerator: # type: ignore schema = empty_context.plans["demo_plan"].model.schema() assert schema["properties"] == { "foo": {"title": "Foo", "type": "integer"}, - "mov": {"title": "Mov", "type": repr(Movable)}, + "mov": {"title": "Mov", "type": "bluesky.protocols.Movable"}, } diff --git a/tests/service/test_rest_api.py b/tests/service/test_rest_api.py index eda62b8b3..238a93e41 100644 --- a/tests/service/test_rest_api.py +++ b/tests/service/test_rest_api.py @@ -110,7 +110,7 @@ def test_get_plan_with_device_reference(handler: Handler, client: TestClient) -> "title": "Delay", }, "detectors": { - "items": {"type": ""}, + "items": {"type": "bluesky.protocols.Readable"}, "title": "Detectors", "type": "array", }, @@ -133,7 +133,7 @@ def test_get_plan_with_device_reference(handler: Handler, client: TestClient) -> "title": "Delay", }, "detectors": { - "items": {"type": ""}, + "items": {"type": "bluesky.protocols.Readable"}, "title": "Detectors", "type": "array", },