Skip to content

Project.model_dump() produces a big warning #90

@alexhroom

Description

@alexhroom
from RATapi import Project
p = Project()
p.model_dump()

produces the UserWarning

/home/rec93639/Code/RasCAL-2/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings:
  Expected `list[definition-ref]` but got `ClassList` with value `[ProtectedParameter(name=...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[Parameter(name='SLD Air'...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[Parameter(name='SLD D2O'...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[Parameter(name='Scalefac...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[Parameter(name='Backgrou...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[Background]` but got `ClassList` with value `[Background(name='Backgro...value_4='', value_5='')]` - serialized value may not be as expected
  Expected `list[definition-ref]` but got `ClassList` with value `[Parameter(name='Resoluti...rm', mu=0.0, sigma=inf)]` - serialized value may not be as expected
  Expected `list[Resolution]` but got `ClassList` with value `[Resolution(name='Resolut...value_4='', value_5='')]` - serialized value may not be as expected
  Expected `list[CustomFile]` but got `ClassList` with value `[]` - serialized value may not be as expected
  Expected `list[Data]` but got `ClassList` with value `[Data(name='Simulation', ...ion_range=[0.005, 0.7])]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `list[Layer]` but got `ClassList` with value `[]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `list[AbsorptionLayer]` but got `ClassList` with value `[]` - serialized value may not be as expected
  Expected `list[DomainContrast]` but got `ClassList` with value `[]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `list[Contrast]` but got `ClassList` with value `[]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `list[ContrastWithRatio]` but got `ClassList` with value `[]` - serialized value may not be as expected
  return self.__pydantic_serializer__.to_python(

Investigate this and hopefully solve it.

Metadata

Metadata

Assignees

No one assigned

    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