We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 78be86c commit c69484bCopy full SHA for c69484b
optimade/server/config.py
@@ -240,7 +240,7 @@ class ServerConfig(BaseSettings):
240
] = "localhost:27017"
241
242
license: Annotated[
243
- str | AnyHttpUrl | None,
+ AnyHttpUrl | str | None,
244
Field(
245
description="""Either an SPDX license identifier or a URL to a human-readable license, used to populate the `license` field in the info response.
246
@@ -480,7 +480,9 @@ def check_license_info(cls, value: Any) -> AnyHttpUrl | None:
480
if not value:
481
return None
482
483
- if not isinstance(value, AnyHttpUrl):
+ try:
484
+ value = AnyHttpUrl(value)
485
+ except ValueError:
486
value = f"https://spdx.org/licenses/{value}"
487
488
# Check if license URL is accessible
0 commit comments