Skip to content

Commit da5da7f

Browse files
committed
Support for metadata
1 parent 7fd7029 commit da5da7f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/generate_openapi_schema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ def read_version_from_pyproject():
6767
# retrieve OpenAPI schema via initialized app
6868
open_api = get_openapi(
6969
title=app.title,
70+
summary=app.summary,
7071
version=app.version,
7172
openapi_version=app.openapi_version,
7273
description=app.description,
7374
routes=app.routes,
7475
license_info=app.license_info,
76+
servers=app.servers,
77+
contact=app.contact,
7578
)
7679

7780
# dump the schema into file

src/app/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@
2323

2424
app = FastAPI(
2525
title=f"{service_name} service - OpenAPI",
26+
summary=f"{service_name} service API specification.",
2627
description=f"{service_name} service API specification.",
2728
version=version.__version__,
29+
contact={
30+
"name": "Pavel Tisnovsky",
31+
"url": "https://github.com/tisnik/",
32+
"email": "ptisnovs@redhat.com",
33+
},
2834
license_info={
2935
"name": "Apache 2.0",
3036
"url": "https://www.apache.org/licenses/LICENSE-2.0.html",
3137
},
38+
servers=[
39+
{"url": "http://localhost:8080/", "description": "Locally running service"}
40+
],
3241
)
3342

3443
app.add_middleware(

0 commit comments

Comments
 (0)