FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

🗑️ Deprecate `const` and `unique_items` in `Field` by YuriiMotov · Pull Request #1732 · fastapi/sqlmodel · GitHub

Repository navigation

🗑️ Deprecate const and unique_items in Field - #1732

Open
YuriiMotov wants to merge 8 commits into
mainfrom
deprecate-const-and-unique_items-in-field
Open

YuriiMotov wants to merge 8 commits into
mainfrom
deprecate-const-and-unique_items-in-field

Conversation

YuriiMotov commented Jan 29, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

const and unique_items parameters in Field are deprecated in Pydantic V2 (const, unique_items):

    const = extra.pop('const', None)  # type: ignore
    if const is not None:
        raise PydanticUserError('`const` is removed, use `Literal` instead', code='removed-kwargs')
...

    unique_items = extra.pop('unique_items', None)  # type: ignore
    if unique_items is not None:
        raise PydanticUserError(
            (
                '`unique_items` is removed, use `Set` instead'
                '(this feature is discussed in https://github.com/pydantic/pydantic-core/issues/296)'
            ),
            code='removed-kwargs',
        )

This PR reflects this change.


These parameters don't work (just ignored) on current SQLModel version. And they never worked with SQLMOdel + Pydantic V2.
So, not sure we need to mark this PR as breaking, but I did it it worked in some previous versions with Pydantic V1

YuriiMotov marked this pull request as ready for review January 29, 2026 13:30
github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Feb 20, 2026

This comment was marked as resolved.

github-actions Bot removed the conflicts Automatically generated when a PR has a merge conflict label Feb 20, 2026
github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Apr 3, 2026

This comment was marked as resolved.

github-actions Bot removed the conflicts Automatically generated when a PR has a merge conflict label Apr 3, 2026

tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you! 🙌

Yes, I think it's a good idea to just raise the error, if this has never worked with Pydantic v2, better to not have it around and just show the error.

github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Aug 28, 2026

This comment was marked as resolved.

github-actions Bot removed the conflicts Automatically generated when a PR has a merge conflict label Aug 28, 2026

This branch has not been deployed

No deployments
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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL