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
Hi there, new to the library and I'm having trouble getting the logic right for a type needing custom serialization/validation. The goal is to take a complex type from another library and be able to serialize/deserialize it to/from a string so that it can be passed around as json and I'd like to use pydantic. The complex type I'm trying to use is Network from scikit-rf.
The below code seems to work fine (or at least it does not give me an error generating the schema on import).
But I'd like to move to the model_serializer/model_validator for future additions. I've tried a lot of variations, but from what I've read all I should need is the following. Unfortunately, I get a PydanticSchemaGenerationError when I try to import this code.
Can anyone help me understand what I'm missing? I saw #8555 but would like to avoid the annotated type and be able to use model_* decorators. Thanks in advance!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there, new to the library and I'm having trouble getting the logic right for a type needing custom serialization/validation. The goal is to take a complex type from another library and be able to serialize/deserialize it to/from a string so that it can be passed around as json and I'd like to use pydantic. The complex type I'm trying to use is
Network
fromscikit-rf
.The below code seems to work fine (or at least it does not give me an error generating the schema on import).
But I'd like to move to the model_serializer/model_validator for future additions. I've tried a lot of variations, but from what I've read all I should need is the following. Unfortunately, I get a
PydanticSchemaGenerationError
when I try to import this code.Can anyone help me understand what I'm missing? I saw #8555 but would like to avoid the annotated type and be able to use model_* decorators. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions