Skip to content

Commit

Permalink
empty servers - list instead of null (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalik committed Aug 28, 2023
1 parent 4c14167 commit 0fbec02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ninja/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from ninja.parser import Parser
from ninja.renderers import BaseRenderer, JSONRenderer
from ninja.router import Router
from ninja.types import TCallable
from ninja.types import DictStrAny, TCallable
from ninja.utils import is_debug_server, normalize_path

if TYPE_CHECKING:
Expand Down Expand Up @@ -54,7 +54,7 @@ def __init__(
docs: DocsBase = Swagger(),
docs_url: Optional[str] = "/docs",
docs_decorator: Optional[Callable[[TCallable], TCallable]] = None,
servers: Optional[List[Dict[str, Union[str, Any]]]] = None,
servers: Optional[List[DictStrAny]] = None,
urls_namespace: Optional[str] = None,
csrf: bool = False,
auth: Optional[Union[Sequence[Callable], Callable, NOT_SET_TYPE]] = NOT_SET,
Expand Down Expand Up @@ -85,7 +85,7 @@ def __init__(
self.docs = docs
self.docs_url = docs_url
self.docs_decorator = docs_decorator
self.servers = servers
self.servers = servers or []
self.urls_namespace = urls_namespace or f"api-{self.version}"
self.csrf = csrf # TODO: Check if used or at least throw Deprecation warning
if self.csrf:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_openapi_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_openapi_extra():
"info": {"title": "NinjaAPI", "version": "1.0.0", "description": ""},
"paths": {},
"components": {"schemas": {}},
"servers": None,
"servers": [],
"externalDocs": {
"description": "Find more info here",
"url": "https://example.com",
Expand Down

0 comments on commit 0fbec02

Please sign in to comment.