msgspec icon indicating copy to clipboard operation
msgspec copied to clipboard

Ability to add an example to a Struct as output to the JSON schema

Open pgjones opened this issue 1 year ago • 0 comments

Description

Looking at https://github.com/jcrist/msgspec/blob/main/msgspec/_json_schema.py I think there is no way to give an example for the Struct to be included in the json schema. In pydantic, for example, there is a json_schema_extra meta addition https://docs.pydantic.dev/latest/concepts/json_schema/#using-json_schema_extra-with-a-dict.

I'd like to give fixed examples and see them in the generated schema.

pgjones avatar May 16 '24 21:05 pgjones