diff --git a/CHANGELOG.md b/CHANGELOG.md index 79da33b..dbca8a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.45 + +* **Add `/check` as the plugin connection-check route**: generated plugin apps now expose `/check` alongside `/precheck` for the v3 plugin contract. + ## 0.0.44 * **Ignore SIGTERM in plugin uvicorn Servers**: plugin webservers now keep diff --git a/test/api/test_api.py b/test/api/test_api.py index f8bca3c..43338db 100644 --- a/test/api/test_api.py +++ b/test/api/test_api.py @@ -44,6 +44,15 @@ def generic_validation(self): ] +def test_check_alias_matches_precheck_noop_response(): + from test.assets.empty_input_and_response import SampleClass as TestClass + + test_class = TestClass() + client = TestClient(wrap_in_fastapi(func=test_class.do_nothing, plugin_id="mock_plugin")) + + assert client.get("/check").json() == client.get("/precheck").json() + + @pytest.mark.parametrize( "file_data", mock_file_data, ids=[type(fd).__name__ for fd in mock_file_data] ) diff --git a/unstructured_platform_plugins/__version__.py b/unstructured_platform_plugins/__version__.py index 3fbbe28..d8f2458 100644 --- a/unstructured_platform_plugins/__version__.py +++ b/unstructured_platform_plugins/__version__.py @@ -1 +1 @@ -__version__ = "0.0.44" # pragma: no cover +__version__ = "0.0.45" # pragma: no cover diff --git a/unstructured_platform_plugins/etl_uvicorn/api_generator.py b/unstructured_platform_plugins/etl_uvicorn/api_generator.py index 06e0074..51afd32 100644 --- a/unstructured_platform_plugins/etl_uvicorn/api_generator.py +++ b/unstructured_platform_plugins/etl_uvicorn/api_generator.py @@ -299,7 +299,6 @@ async def get_schema() -> SchemaOutputResponse: resp = SchemaOutputResponse(inputs=schema["inputs"], outputs=schema["outputs"]) return resp - @fastapi_app.get("/precheck") async def run_precheck() -> InvokePrecheckResponse: if precheck_func: fn_response = await wrap_fn(func=precheck_func) @@ -311,6 +310,9 @@ async def run_precheck() -> InvokePrecheckResponse: else: return InvokePrecheckResponse(status_code=status.HTTP_200_OK, usage=[]) + fastapi_app.get("/check")(run_precheck) + fastapi_app.get("/precheck")(run_precheck) + @fastapi_app.get("/id") async def get_id() -> str: return plugin_id