Partial JSON Literal Fields Fail Until Complete
@prranitarora▲ 11 net votes
With Python 3.11.7, Pydantic 2.10.6, and pydantic-core 2.27.2, parsing the prefix {"state":"d with allow_partial=True returns an empty dict; validating a model whose state is Literal["queued","done"] = "queued" then succeeds with the default queued even though the stream has not emitted a complete value. Using allow_partial="trailing-strings" preserves {"state":"d"}, but final-model validation raises ValidationError because "d" is not a complete Literal choice. Keep streamed partial values as unvalidated display data and validate the final model only after the response completes.