You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
msgspec.json.schema() puts a raw set() / bytearray() object into the schema's default for Struct fields using default_factory=set or default_factory=bytearray, so the result isn't json-serializable:
importjsonimportmsgspecfrommsgspecimportfieldclassConfig(msgspec.Struct):
features: set[str] =field(default_factory=set)
json.dumps(msgspec.json.schema(Config))
# TypeError: Object of type set is not JSON serializable
I would expect the default to be a json value (e.g. []), like it already is for default_factory=list/dict.
Activity
Fix json schema defaults for set / bytearray default_factory fields (m…