skrawcz commented on PR #1042:
URL: https://github.com/apache/burr/pull/1042#issuecomment-7086752433

   I found a Pydantic round-trip case that this still breaks: `Json[T]` fields.
   
   ```python
   from pydantic import BaseModel, Json
   
   from burr.core import state
   
   
   class Payload(BaseModel):
       data: Json[list[int]]
   
   
   obj = Payload(data="[1,2,3]")
   serialized = state.State({"obj": obj}).serialize()
   state.State.deserialize(serialized)
   ```
   
   With this PR, serialization stores `data` as `[1, 2, 3]`, then 
deserialization fails because `Json[T]` expects JSON input as a string, bytes, 
or bytearray:
   
   ```
   ValidationError: JSON input should be string, bytes or bytearray
   ```
   
   Pydantic preserves this round trip when the dump uses:
   
   ```python
   value.model_dump(mode="json", round_trip=True)
   ```
   
   Please add `round_trip=True` and a regression test using `Json[list[int]]` 
alongside the datetime/UUID/Decimal coverage.
   
   AI assistance disclosure: this review finding and reproduction were prepared 
with AI assistance and verified locally against this PR's head.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to