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
The unknown JSON schema key headerTemplate is not present when StreamPubSub is nested inside other models and we call .schema() on the outer most model.
In order to get headerTemplate into the schema we had to move the schema modification into the model's schema method as:
The outer most model ignores the schema() implementation / override of all contained models. To work around this behavior we use the following function after calling schema() on the outer most model:
This is similar, but not identical to #1287 (Model.json() not called recursively).
Is there a reason the FooModel methods are not called when FooModel is nested within a BarModel?
Schema edits seem to be a PITA right now (in our code base) with the current code implementation.
See issues like: #1358 where it could be made much more simple.
As it stands it seems we often need a schema_extra and then that schema_extra doesn't work as expected.
I'd be happy to work on the code to correct all these things. I just want to know if the idea / propositions will be accepted before I start work.
PS: we love what pydantic has brought to our code base. Thanks for the many hours that have gone into this amazing library. Shout out to FastAPI too; we love you too!
The text was updated successfully, but these errors were encountered:
Scenario / Use Case
The unknown JSON schema key
headerTemplate
is not present when StreamPubSub is nested inside other models and we call.schema()
on the outer most model.In order to get
headerTemplate
into the schema we had to move the schema modification into the model's schema method as:The outer most model ignores the schema() implementation / override of all contained models. To work around this behavior we use the following function after calling schema() on the outer most model:
This is similar, but not identical to #1287 (Model.json() not called recursively).
Is there a reason the FooModel methods are not called when FooModel is nested within a BarModel?
Schema edits seem to be a PITA right now (in our code base) with the current code implementation.
See issues like: #1358 where it could be made much more simple.
As it stands it seems we often need a
schema_extra
and then thatschema_extra
doesn't work as expected.I'd be happy to work on the code to correct all these things. I just want to know if the idea / propositions will be accepted before I start work.
PS: we love what pydantic has brought to our code base. Thanks for the many hours that have gone into this amazing library. Shout out to FastAPI too; we love you too!
The text was updated successfully, but these errors were encountered: