pydantic-core icon indicating copy to clipboard operation
pydantic-core copied to clipboard

Optimistically close string values in from_json if allow_partial is set to true

Open mwildehahn opened this issue 1 year ago • 3 comments

Right now if you're trying to parse a partial object, pydantic won't return the key until the string value is complete:

In [4]: pydantic_core.from_json('{"test": "this', allow_partial=True)
Out[4]: {}

I'd expect this to result in:

In [5]: pydantic_core.from_json('{"test": "this', allow_partial=True)
Out[5]: {'test': 'this'}

similarly to how objects and lists are optimistically closed during partial rendering.

mwildehahn avatar Apr 04 '24 21:04 mwildehahn