Skip to content

Commit f6419cc

Browse files
feat: add top-level description field to OAS (#268)
#### Description of changes Added a description field to `RuntimeConfig` with a default of `""`, and set a kwarg in the `FastAPI()` constructor called in `runtime.serve.create_restapi()` of `description=config.description`. This inserts the Tesseract description from `tesseract_config.yaml`, already present as an environment variable `TESSERACT_DESCRIPTION` in built Tesseract containers, into the top-level of the OpenAPI Specification. #### To do - [x] Investigate why newline characters appear to have their backslashes escaped in the description field #### Testing done Manually tested. <img width="1920" height="511" alt="image" src="https://github.com/user-attachments/assets/984e2d7f-d030-4ce8-8725-91995b4b8fad" /> <img width="1898" height="519" alt="image" src="https://github.com/user-attachments/assets/8b55356e-c591-4504-9a0d-42d697a55ae1" />
1 parent cdadc25 commit f6419cc

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

tesseract_core/runtime/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class RuntimeConfig(BaseModel):
1313

1414
api_path: FilePath = Path("tesseract_api.py")
1515
name: str = "Tesseract"
16+
description: str = ""
1617
version: str = "0+unknown"
1718
debug: bool = False
1819
input_path: str = "."

tesseract_core/runtime/serve.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def create_rest_api(api_module: ModuleType) -> FastAPI:
3838
app = FastAPI(
3939
title=config.name,
4040
version=config.version,
41+
description=config.description.replace("\\n", "\n"),
4142
docs_url=None,
4243
redoc_url="/docs",
4344
debug=config.debug,

0 commit comments

Comments
 (0)