You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
The json schema produced by inheriting from a dataclass containing an inner class, and modifying the inner class in the inherited class is incorrect.
In the example below, there is a dataclass Top with an inner dataclass called Inner. If you inherit a new class from Top and add a new element to it's inner class, then the json schema produced doesn't include the new element in the new Inner:
(in relation to #137 (comment))
The json schema produced by inheriting from a dataclass containing an inner class, and modifying the inner class in the inherited class is incorrect.
In the example below, there is a dataclass
Top
with an inner dataclass calledInner
. If you inherit a new class fromTop
and add a new element to it's inner class, then the json schema produced doesn't include the new element in the new Inner:typing's get_type_hints correctly identifies that Inner in the derived class is defined in the derived class, and has
c: int
:Attempting to instantiate a
TopDerived
without ac
also throws expected exception:Problem
The schema produced by the above fails to use the new defintion of
Inner
defined inTopDerived
:Note* - workaround
Changing the inner class name in the derived class does fix the problem, as the naming isn't then confused:
produces a schema of:
The text was updated successfully, but these errors were encountered: