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

Expose pydantic's Field(validation_alias=...) parameter by rbubley · Pull Request #774 · fastapi/sqlmodel · GitHub

Repository navigation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 4 additions & 0 deletions sqlmodel/main.py
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
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def __init__(self, default: Any = Undefined, **kwargs: Any) -> None:
raise RuntimeError(
"Passing sa_type is not supported when also passing a sa_column"
)
if not hasattr(PydanticFieldInfo, "validation_alias"):
kwargs.pop("validation_alias")
if ondelete is not Undefined:
if foreign_key is Undefined:
raise RuntimeError("ondelete can only be used with foreign_key")
Expand Down Expand Up @@ -349,6 +351,7 @@ def Field(
*,
default_factory: Optional[NoArgAnyCallable] = None,
alias: Optional[str] = None,
validation_alias: Optional[str] = None,
title: Optional[str] = None,
description: Optional[str] = None,
exclude: Union[
Expand Down Expand Up @@ -391,6 +394,7 @@ def Field(
default,
default_factory=default_factory,
alias=alias,
validation_alias=validation_alias,
title=title,
description=description,
exclude=exclude,
Expand Down

Back | FazBrowse Home | New Git URL