Skip to content

Look into PydanticSerializationUnexpectedValue #38

@korikuzma

Description

@korikuzma

When running CIViC Transformer in MetaKB (see PR), I was getting a ton of PydanticSerializationUnexpectedValue warnings, specifically for Statement.model_dump.

Example warnings:

metakb/server/.venv/lib/python3.12/site-packages/pydantic/main.py:463: UserWarning: Pydantic serializer warnings:
  PydanticSerializationUnexpectedValue(Expected `ExperimentalVariantFunctionalImpactProposition` - serialized value may not be as expected [input_value=VariantTherapeuticRespons...elation='exactMatch')])), input_type=VariantTherapeuticResponseProposition])
  PydanticSerializationUnexpectedValue(Expected `VariantDiagnosticProposition` - serialized value may not be as expected [input_value=VariantTherapeuticRespons...elation='exactMatch')])), input_type=VariantTherapeuticResponseProposition])
  PydanticSerializationUnexpectedValue(Expected `VariantOncogenicityProposition` - serialized value may not be as expected [input_value=VariantTherapeuticRespons...elation='exactMatch')])), input_type=VariantTherapeuticResponseProposition])
  PydanticSerializationUnexpectedValue(Expected `VariantPathogenicityProposition` - serialized value may not be as expected [input_value=VariantTherapeuticRespons...elation='exactMatch')])), input_type=VariantTherapeuticResponseProposition])
  PydanticSerializationUnexpectedValue(Expected `VariantPrognosticProposition` - serialized value may not be as expected [input_value=VariantTherapeuticRespons...elation='exactMatch')])), input_type=VariantTherapeuticResponseProposition])
  PydanticSerializationUnexpectedValue(PydanticSerializationUnexpectedValue: Unexpected Value
PydanticSerializationUnexpectedValue: Expected `CategoricalVariant` - serialized value may not be as expected [input_value=ProteinSequenceConsequenc...lation='relatedMatch')]), input_type=ProteinSequenceConsequence]
PydanticSerializationUnexpectedValue: Unexpected Value)
  PydanticSerializationUnexpectedValue(Unexpected Value)
  PydanticSerializationUnexpectedValue(Unexpected Value)
  PydanticSerializationUnexpectedValue(Unexpected Value)
  PydanticSerializationUnexpectedValue(Unexpected Value)

We should see if we're able to resolve these? Might need a custom serializer.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions