marshmallow-code/marshmallow

fields.Nested Type Warning Since Version 3.15.0

Fares-Abubaker opened this issue · 0 comments

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!