Skip to content

Add ref_template param to mgspec.json.schema#983

Merged
jcrist merged 2 commits intojcrist:mainfrom
sobolevn:patch-2
Apr 8, 2026
Merged

Add ref_template param to mgspec.json.schema#983
jcrist merged 2 commits intojcrist:mainfrom
sobolevn:patch-2

Conversation

@sobolevn
Copy link
Copy Markdown
Contributor

@sobolevn sobolevn commented Mar 1, 2026

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.

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.
Copy link
Copy Markdown
Owner

@jcrist jcrist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@jcrist jcrist merged commit f678049 into jcrist:main Apr 8, 2026
22 checks passed
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)
```
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.

2 participants