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

feat(Pydantic): Add validate_strict option to Pydantic plugin to support Pydantic 2's strict model_validate mode #3573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

provinzkraut
Copy link
Member

@provinzkraut provinzkraut commented Jun 15, 2024

Add a new validate_strict parameter to PydanticInitPlugin, which will be passed as the value of the strict parameter of Pydantic's BaseModel.model_validate.

app = Litestar(
    plugins=[PydanticInitPlugin(validate_strict=True)]
)

Closes #3572.

Copy link

codecov bot commented Jun 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.28%. Comparing base (65f01ea) to head (fcc76ab).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3573   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files         328      328           
  Lines       14841    14843    +2     
  Branches     2362     2362           
=======================================
+ Hits        14586    14588    +2     
  Misses        116      116           
  Partials      139      139           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Jun 15, 2024

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Support configuring Pydantic's .model_validate(..., strict=True)
1 participant