I'm hoping you can tell me whether I'm doing something wrong here when trying to use the JsonSchemaMixin.
I have the following MeasuredTide class which inherits from JsonSchemaMixin and Record. It gets passed a coerce keyword argument intended for the Record subclass.
When running the script containing the MeasuredTide class definition I get the following error.
If my understanding is correct I believe this is because the JsonSchemaMixin.__init_subclass__ method doesn't currently accept **kwargs as a parameter and pass these through to the next class in the MRO using super.
e.g. super.__init_subclass__(**kwargs)
Implementing this would allow the Record subclass to receive the keyword arguments it expects. I believe this behaviour would also fit the general behaviour of a mixin and what I see documented elsewhere in my reading.
I'm open to hearing any mistakes or drawbacks with the bug fix I'm suggesting. Also happy to hear alternative approaches, keeping in mind I don't maintain the JsonSchemaMixin or Record class. I'm also happy to submit a pull request if helpful.
Hi,
I'm hoping you can tell me whether I'm doing something wrong here when trying to use the
JsonSchemaMixin
.I have the following
MeasuredTide
class which inherits fromJsonSchemaMixin
andRecord
. It gets passed a coerce keyword argument intended for theRecord
subclass.The following is what would be the resultant MRO.
When running the script containing the MeasuredTide class definition I get the following error.
If my understanding is correct I believe this is because the
JsonSchemaMixin.__init_subclass__
method doesn't currently accept**kwargs
as a parameter and pass these through to the next class in the MRO using super.e.g.
super.__init_subclass__(**kwargs)
Implementing this would allow the
Record
subclass to receive the keyword arguments it expects. I believe this behaviour would also fit the general behaviour of a mixin and what I see documented elsewhere in my reading.I'm open to hearing any mistakes or drawbacks with the bug fix I'm suggesting. Also happy to hear alternative approaches, keeping in mind I don't maintain the
JsonSchemaMixin
orRecord
class. I'm also happy to submit a pull request if helpful.