django-ninja icon indicating copy to clipboard operation
django-ninja copied to clipboard

Attribute `description` declared has type `str` but is used as type None

Open luca-digrazia opened this issue 2 years ago • 2 comments

"filename": "docs/src/tutorial/body/code01.py" "warning_type": "Incompatible attribute type [8]" "warning_message": " Attribute description declared in class Item has type str but is used as type None.", "warning_line": 6 "fix": "" instead of None

luca-digrazia avatar Aug 16 '22 12:08 luca-digrazia

@luca-digrazia thank you for PR - but tests are failing... https://github.com/vitalik/django-ninja/runs/7858252406?check_suite_focus=true

and if you read the docs for that page - there is also a reference that None is expected there

so what you probably mean is to mark it as Optional:

description: Optional[str] = None

vitalik avatar Aug 26 '22 09:08 vitalik

@luca-digrazia thank you for PR - but tests are failing... https://github.com/vitalik/django-ninja/runs/7858252406?check_suite_focus=true

and if you read the docs for that page - there is also a reference that None is expected there

so what you probably mean is to mark it as Optional:

description: Optional[str] = None

Yes, updated with optional.

luca-digrazia avatar Aug 30 '22 14:08 luca-digrazia