added 4 commits
July 27, 2023 23:17This adds support for decoding UUIDs from 16-byte binary inputs if `strict=False`. The inputs are interpreted as big-endian 128-bit integers. This is supported for `msgspec.convert` and `msgspec.msgpack.decode` alone, since other protocols don't have native binary input support.
This adds a new `uuid_format` to the json and msgpack encoders, configuring how msgspec will handle uuids. This may be one of: - 'canonical': encoded as canonical strings (same as `str(uuid)`). - 'hex': encoded as strings without hyphens (same as `uuid.hex`). - 'bytes': encoded as binary values representing big-endian 128-bit integers (same as `uuid.bytes`). Note that only msgpack supports the `'bytes'` value, as JSON lacks a native binary type. Defaults to `'canonical'`.