This standalone model stores a Smithy union in an @sqlJson column. A custom
query decodes the JSON column to a mapping and constructs the generated SQL row
dataclass. Serializing that generated row through Pydantic emits
PydanticSerializationUnexpectedValue for every union variant, even though the
mapping has the correct Smithy wire shape.
Requirements: Java, the Smithy CLI 1.71.0, and Python 3.12 or newer.
smithy build
python -m venv .venv
.venv/bin/pip install -r requirements.txt
PYTHONPATH=build/smithy/source/smithplates/src .venv/bin/python reproduce.pyTested with Smithplates 0.3.2 and Pydantic 2.13.4.
The script also demonstrates the warning-free workaround: validate the decoded
mapping with TypeAdapter(models.Action).validate_python(...) before placing it
in the generated row dataclass.