fastapi-swagger 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fastapi-swagger might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastapi-swagger
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: This plugin updates the FastAPI app to host latest Swagger UI distribution.
5
5
  Home-page: https://github.com/dantetemplar/fastapi-swagger
6
6
  License: MIT
@@ -1,3 +1,4 @@
1
+ import warnings
1
2
  from importlib import resources
2
3
  from typing import Optional, Dict, Any
3
4
 
@@ -34,6 +35,18 @@ def patch_fastapi(
34
35
  :param init_oauth: OAuth2 configuration
35
36
  :param oauth2_redirect_url: OAuth2 redirect URL
36
37
  """
38
+ # docs_url=None, swagger_ui_oauth2_redirect_url=None should be set in FastAPI app definition
39
+ if getattr(app, "docs_url", None) is not None:
40
+ warnings.warn(
41
+ "`docs_url` is set in FastAPI app definition, please, set it to None",
42
+ UserWarning,
43
+ )
44
+ if getattr(app, "swagger_ui_oauth2_redirect_url", None) is not None:
45
+ warnings.warn(
46
+ "`swagger_ui_oauth2_redirect_url` is set in FastAPI app definition, please, set it to None",
47
+ UserWarning,
48
+ )
49
+
37
50
  if redirect_from_root_to_docs:
38
51
 
39
52
  @app.get("/", include_in_schema=False)