msgspec icon indicating copy to clipboard operation
msgspec copied to clipboard

custom class name for `array_like=True`

Open idatsy opened this issue 5 months ago • 0 comments

Description

Currently array_like encodes like [MyClassName,field0,field1,...]

For small structs (with descriptive names) this can be a large part of the message. Irrespectively encoding a string as a message identifier for fixed schemas is inefficient.

An option like u8 for schemas where possible union members <256 would be 👌

If you want to be extreme about it, optionally dropping the [] would save even more space

idatsy avatar Jun 02 '25 14:06 idatsy