Skip to content

Issue with Transition and from_ field during pydantic validation #111

@realdognose

Description

@realdognose

for the OMBC Type, a Transition has the property from_

This causes Validation errors, it is reported as missing:from and excess: from_

 (<class 's2python.common.transition.Transition'>, (), 'from\n  Field required (type=missing)\nfrom_\n  Extra inputs are not permitted (type=extra_forbidden)', 2 validation errors for Transition
from
  Field required [type=missing, input_value={'id': UUID('d1b8b344-473...transition_costs': None}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
from_
  Extra inputs are not permitted [type=extra_forbidden, input_value=UUID('8d87c450-d96d-42cf-81b0-76bd5c816f95'), input_type=UUID]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden)

changing the model config of transition like follows (populate_by_name) fixes this, but not sure if that has side-effects.

class Transition(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
        populate_by_name=True
    )

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