Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more specific type for non-callable json_schema_extra #7803

Merged

Conversation

alexmojaki
Copy link
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
Contributor Author

please review

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

@alexmojaki looks great, thanks for the contribution ⭐

@sydney-runkle sydney-runkle merged commit b2e7ee3 into pydantic:main Oct 12, 2023
59 of 61 checks passed
@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