Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fields.Nested Type Warning Since Version 3.15.0 #2268

Open
Fares-Abubaker opened this issue May 15, 2024 · 0 comments
Open

fields.Nested Type Warning Since Version 3.15.0 #2268

Fares-Abubaker opened this issue May 15, 2024 · 0 comments

Comments

@Fares-Abubaker
Copy link

Hi,

I'm encountering a warning from PyCharm related to fields.Nested after upgrading to marshmallow version 3.15.0. The warning states that fields.Nested expects a type SchemaABC, but it gets a type [UserSerializer] instead. This issue did not occur in earlier versions.

Here is a simple example to demonstrate the issue:

from marshmallow import Schema, fields

class A(Schema):
    id = fields.Integer()

class B(Schema):
    a = fields.Nested(A)

Warning:

Expected type 'SchemaABC', got 'Type[A]' instead 

This warning appears when using fields.Nested with a schema class. It seems that the type checking introduced in version 3.15.0 does not recognize schema classes correctly.

Is there a new way to define nested schemas, or is this a bug that needs to be addressed?

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant