Skip to content

Commit 2fb1ad2

Browse files
committed
feat: Make documentation page titles optional
1 parent 7f3189d commit 2fb1ad2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/stopments/elements.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RouterOptions(Enum):
2323
def get_stoplight_elements_html( # noqa: PLR0913 many arguments in function definition
2424
*,
2525
openapi_url: str,
26-
title: str,
26+
title: str = "API Documentation",
2727
stoplight_elements_js_url: str = "https://cdn.jsdelivr.net/npm/@stoplight/elements/web-components.min.js",
2828
stoplight_elements_css_url: str = "https://cdn.jsdelivr.net/npm/@stoplight/elements/styles.min.css",
2929
stoplight_elements_favicon_url: str = "https://docs.stoplight.io/favicons/favicon.ico",
@@ -71,6 +71,7 @@ def get_stoplight_elements_html( # noqa: PLR0913 many arguments in function def
7171
The HTML document as a string.
7272
"""
7373

74+
title = title or "API Documentation"
7475
return f"""
7576
<!doctype html>
7677
<html lang="en">

src/stopments/scalar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def dump(key: str, data: object) -> str:
8383
def get_scalar_html( # noqa: PLR0913
8484
*,
8585
openapi_url: str,
86-
title: str,
86+
title: str = "API Documentation",
8787
scalar_js_url: str = "https://cdn.jsdelivr.net/npm/@scalar/api-reference",
8888
scalar_proxy_url: str = "",
8989
scalar_favicon_url: str = "https://docs.scalar.com/favicon.svg",
@@ -127,6 +127,7 @@ def get_scalar_html( # noqa: PLR0913
127127
"""
128128
servers = servers or []
129129
authentication = authentication or {}
130+
title = title or "API Documentation"
130131

131132
return f"""<!doctype html>
132133
<html>

0 commit comments

Comments
 (0)