mirror of https://github.com/tiangolo/fastapi.git
Replace asserts with if...raise
This commit is contained in:
parent
c57ac7bdf3
commit
f9cac0f7f3
|
|
@ -908,8 +908,10 @@ class FastAPI(Starlette):
|
|||
] = "3.1.0"
|
||||
self.openapi_schema: Optional[Dict[str, Any]] = None
|
||||
if self.openapi_url:
|
||||
assert self.title, "A title must be provided for OpenAPI, e.g.: 'My API'"
|
||||
assert self.version, "A version must be provided for OpenAPI, e.g.: '2.1.0'"
|
||||
if not self.title:
|
||||
raise ValueError("A title must be provided for OpenAPI, e.g.: 'My API'")
|
||||
if not self.version:
|
||||
raise ValueError("A version must be provided for OpenAPI, e.g.: '2.1.0'")
|
||||
# TODO: remove when discarding the openapi_prefix parameter
|
||||
if openapi_prefix:
|
||||
logger.warning(
|
||||
|
|
|
|||
Loading…
Reference in New Issue