From 629f363d2a7a627bf2cd1ea2ab683d6958af1ec4 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Tue, 8 Nov 2022 03:14:56 -0800 Subject: [PATCH] fix: types Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- src/bentoml/_internal/service/openapi/specification.py | 2 +- tests/unit/_internal/io/test_numpy.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bentoml/_internal/service/openapi/specification.py b/src/bentoml/_internal/service/openapi/specification.py index 843d298e221..f3e86b274bf 100644 --- a/src/bentoml/_internal/service/openapi/specification.py +++ b/src/bentoml/_internal/service/openapi/specification.py @@ -104,7 +104,7 @@ class Schema: anyOf: t.Optional[t.List[Schema]] = None not_: t.Optional[Schema] = None items: t.Optional[t.Union[Schema, t.List[Schema]]] = None - properties: t.Optional[t.Dict[str, Schema | Reference]] = None + properties: t.Optional[t.Dict[str, t.Union[Schema, Reference]]] = None additionalProperties: t.Optional[t.Union[Schema, Reference, bool]] = None description: t.Optional[str] = None format: t.Optional[str] = None diff --git a/tests/unit/_internal/io/test_numpy.py b/tests/unit/_internal/io/test_numpy.py index 5aab59e484c..2c9b4477c3f 100644 --- a/tests/unit/_internal/io/test_numpy.py +++ b/tests/unit/_internal/io/test_numpy.py @@ -85,6 +85,8 @@ def test_numpy_openapi_request_body(): nparray = NumpyNdarray(dtype="float") nparray.sample_input = ExampleGeneric("asdf") # type: ignore (test exception) + with pytest.raises(BadInput): + nparray.openapi_example() def test_numpy_openapi_responses():