Closed mwildehahn closed 3 months ago
I'm not sure I agree. Lists are heterogenous: if a full list is valid, half a list should be as well. Objects are not. Cutting an object in half does not guarantee you can validate it.
Hm, I'm specifically talking about closing strings. I mentioned objects because they are optimistically closed already:
In [4]: pydantic_core.from_json('{"test": "this", "something": {', allow_partial=True)
Out[4]: {'test': 'this', 'something': {}}
If a value of a key is a string, it will always be a string, optimistically closing that string just lets us serve a partial string faster.
Ah sorry, misunderstood. That makes sense.
Just noticed this is a duplicate of #82.
Right now if you're trying to parse a partial object, pydantic won't return the key until the string value is complete:
I'd expect this to result in:
similarly to how objects and lists are optimistically closed during partial rendering.