Skip to content

Add more specific type for non-callable json_schema_extra#7803

Merged
sydney-runkle merged 11 commits intopydantic:mainfrom
alexmojaki:bug/modify-json-schema-extra-type
Oct 12, 2023
Merged

Add more specific type for non-callable json_schema_extra#7803
sydney-runkle merged 11 commits intopydantic:mainfrom
alexmojaki:bug/modify-json-schema-extra-type

Conversation

@alexmojaki
Copy link
Copy Markdown
Contributor

@alexmojaki alexmojaki commented Oct 11, 2023

Change Summary

Adds these types:

JsonValue: TypeAlias = int | float | str | bool | None | List['JsonValue'] | 'JsonDict'
JsonDict: TypeAlias = Dict[str, JsonValue]

and replaces dict[str, object] with JsonDict on annotations of json_schema_extra.

Related issue number

Closes #6348

Replaces #7475 which seems to have died and implements the suggestions.

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @lig

@alexmojaki
Copy link
Copy Markdown
Contributor Author

please review

@dmontagu dmontagu added the relnotes-fix Used for bugfixes. label Oct 12, 2023
@sydney-runkle
Copy link
Copy Markdown
Contributor

@alexmojaki looks great, thanks for the contribution ⭐

@sydney-runkle sydney-runkle merged commit b2e7ee3 into pydantic:main Oct 12, 2023
@alexmojaki alexmojaki mentioned this pull request Oct 12, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConfigDict.json_schema_extra has type Dict[str, object]

6 participants