Ability to add an example to a Struct as output to the JSON schema
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 193
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 15
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in msgspec/_json_schema.py and review how Struct definitions are converted into JSON Schema. Compare the requested metadata behavior with Pydantic's json_schema_extra approach; done means fixed examples supplied for a Struct appear in its generated schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100