Skip to content

Generate JSON schema from pydantic - #90

Merged
dcbaker merged 8 commits into
mainfrom
submit/json-schema-from-pydantic
Sep 6, 2026
Merged

Generate JSON schema from pydantic#90
dcbaker merged 8 commits into
mainfrom
submit/json-schema-from-pydantic

Conversation

@dcbaker

@dcbaker dcbaker commented Sep 6, 2026

Copy link
Copy Markdown
Owner

This allows us to generate the schema from the pydantic model, which means the model and the schema stay in sync. the result is that there's always a valid schema, and updates are effectively free.

Fixes: #72
Fixes: #88

We need to rely on mypy for this, as pylance doesn't have the necessary
information to correctly analyze pydantic Models.
The generated schema is not yet on par with the handwritten one, but
doing it in this order allows me to compare the output as I work.
This means the schema always matches the pydantic model. This has nice
advantages for staying in sync.
@dcbaker
dcbaker merged commit b28193c into main Sep 6, 2026
1 check passed
@dcbaker
dcbaker deleted the submit/json-schema-from-pydantic branch September 6, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schema is invalid generate json schema from pydantic definitions

1 participant