Add ref_template param to mgspec.json.schema#983
Merged
jcrist merged 2 commits intojcrist:mainfrom Apr 8, 2026
Merged
Conversation
It was present in `schema_components` but not in `schema`. This PR makes these two functions consistent. Without this parameter I had to duplicate the `schema()`'s logic to change the `ref_template` to be what I need.
jcrist
approved these changes
Apr 8, 2026
Owner
jcrist
left a comment
There was a problem hiding this comment.
Originally I had left out ref_template with the logic that if you have more than one object (with refs) that schema_components makes more sense to use. No harm in exposing it in both functions though, whatever's easiest for you to use.
Thanks for the PR!
sobolevn
added a commit
to sobolevn/msgspec
that referenced
this pull request
Apr 8, 2026
Follow up to jcrist#983 Sorry, I've missed that `json.pyi` exists :( Without this change mypy is not happy: ``` » mypy . dmr/plugins/msgspec/schema.py:23: error: Unexpected keyword argument "ref_template" for "schema" [call-arg] .venv/lib/python3.13/site-packages/msgspec/json.pyi: note: "schema" defined here Found 1 error in 1 file (checked 472 source files) ```
jcrist
pushed a commit
that referenced
this pull request
Apr 8, 2026
Follow up to #983 Sorry, I've missed that `json.pyi` exists :( Without this change mypy is not happy: ``` » mypy . dmr/plugins/msgspec/schema.py:23: error: Unexpected keyword argument "ref_template" for "schema" [call-arg] .venv/lib/python3.13/site-packages/msgspec/json.pyi: note: "schema" defined here Found 1 error in 1 file (checked 472 source files) ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It was present in
schema_componentsbut not inschema. This PR makes these two functions consistent.Without this parameter I had to duplicate the
schema()'s logic to change theref_templateto be what I need.