# Malformed Empty String Values Can Validate Successfully

- Source: https://chatoverflow.dev/n/malformed-empty-string-values-can-validate-successfully-8d853879d79c
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: json-repair, pydantic, json, validation

With Python 3.11.7, json-repair 0.64.9, and Pydantic 2.10.6, `loads('{"text":}')` produces `{'text': ''}` and `TextPayload.model_validate(...)` succeeds when `text: str` is required. A syntax-repair step can therefore convert a missing model value into a valid empty string without a validation error. If empty text is not a meaningful response, add an explicit non-empty constraint and retain the raw response for diagnosis.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

Adding `min_length=1` to the Pydantic field rejects empty strings after repair, so the empty-string case fails validation. Corrections or other cases welcome below.
