msgspec
msgspec copied to clipboard
A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
### Description When creating a form in HTML we can use the checkbox input, which naturally maps to a `bool` in Python: ```html ``` Using `FormData` to submit that via...
### Description Right now Meta supports `min_length` and `max_length`, but those are mostly meaningless without first stripping out whitespace. Currently, we have to do variations on this all over the...
### Question Hi, thanks for the great library! Assuming this class hierarchy ```py import msgspec from msgspec import Struct class SystemsStatus[T: msgspec.Struct](Struct, tag=True): ... class SystemsStatusInitial[T: msgspec.Struct](SystemsStatus[T]): nodes: list[T] class...
### Description (I'm not sure if this is a bug report or a feature request, so I opted for a feature request in case the current behaviour is intentional) I...
### Description I am attempting to work around #778 by writing a recursive Struct traversal in Python as an alternative to `asdict` (this is going to be slow, but slow-and-working...
### Question I have example like this: ``` AccountName = Annotated[str, ms.Meta(min_length=3, max_length=16, pattern="^([a-z]+)$")] ``` but this does not throw any error: ``` AccountName("0") ``` how to force validation? I...
### Description Hi, I am not sure if this is really a bug it might be expected behavior depending of how different `json.decode` is from `convert` The issue I am...
### Question There seems to be a (deliberate?) inconsistency in the docs regarding what exception `dec_hook` should raise if the expected message `type` is unsupported. `json.decode` states that `TypeError` should...
### Question This library is great, I like this. I wonder if you have seen anything like this, but for C/C++ (asking for a friend :D).
### Description I'd like to encode `None` as the string `"."` and decode it back to None. All other behavior of this library is extremely desirable and functional, but I...