typeddjango / djangorestframework-stubs

PEP-484 stubs for django-rest-framework
MIT License
431 stars 114 forks source link

Incorrect type hinting for `settings.SERVERS` #648

Open WoosterInitiative opened 1 month ago

WoosterInitiative commented 1 month ago

Bug report

What's wrong

When trying to specify SPECTACULAR_SETTINGS["SERVERS"] per Settings mypy complains Error: List item 0 has incompatible type "dict[str, Any]"; expected "str" [list-item]. Per the docs this setting should be a list of dicts.

How is that should be

SPECTACULAR_SETTINGS["SERVERS"] = [{'url': 'https://example.com/v1', 'description': 'Text'}, ...]

That is example from the docs.

System information

sobolevn commented 1 month ago

PR is welcome