Skip to content

[DOC] fast-api ext demo: "non-annotated attribute was detected" #775

@jseguillon

Description

@jseguillon

Expected Behavior

Open dapr fastapi ext doc, copy paste example and make it work

Actual Behavior

Pydantic refuses example:

== APP == Traceback (most recent call last):
== APP ==   File "/home/jse/python-sdk/test.py", line 9, in <module>
== APP ==     class User(BaseModel):
== APP ==   File "/home/jse/python-sdk/venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 113, in __new__
== APP ==     private_attributes = inspect_namespace(
== APP ==   File "/home/jse/python-sdk/venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 450, in inspect_namespace
== APP ==     raise PydanticUserError(
== APP == pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `name = 'Jane Doe'`. All model fields require a type annotation; if `name` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
== APP == 
== APP == For further information visit https://errors.pydantic.dev/2.10/u/model-field-missing-annotation

Steps to Reproduce the Problem

Copy paste example and run

Release Note

Release note not applicable I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't workingstaleIssue marked as stale by Dapr Bot

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions