Version
adcp==8.0.0b9
Reproduction
from adcp.types import PostalArea
from pydantic import TypeAdapter
adapter = TypeAdapter(PostalArea)
value = adapter.validate_python({"system": "us_zip", "values": ["10001"]})
wire = adapter.dump_python(value, mode="json")
print(wire)
adapter.validate_python(wire)
The dump is:
{"country": "US", "system": "us_zip", "values": ["10001"]}
Re-validating that output fails because country US expects native systems zip or zip_plus_four, while the parsed legacy arm retained us_zip.
This also breaks ordinary Pydantic model dump/reconstruct cycles for TargetingOverlay.geo_postal_areas and geo_postal_areas_exclude.
Expected
TypeAdapter(PostalArea) output should validate through the same adapter. Either the legacy fused system should remain countryless on serialization, or it should normalize to the matching native system when adding country.
Context
This surfaced while applying the beta.9 object-union migration from #1084.
Version
adcp==8.0.0b9Reproduction
The dump is:
{"country": "US", "system": "us_zip", "values": ["10001"]}Re-validating that output fails because country
USexpects native systemsziporzip_plus_four, while the parsed legacy arm retainedus_zip.This also breaks ordinary Pydantic model dump/reconstruct cycles for
TargetingOverlay.geo_postal_areasandgeo_postal_areas_exclude.Expected
TypeAdapter(PostalArea)output should validate through the same adapter. Either the legacy fused system should remain countryless on serialization, or it should normalize to the matching native system when addingcountry.Context
This surfaced while applying the beta.9 object-union migration from #1084.