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: allow customization of Pydantic integration #2404

Merged
merged 6 commits into from
Oct 6, 2023

Conversation

cofin
Copy link
Member

@cofin cofin commented Oct 5, 2023

Pull Request Checklist

  • New code has 100% test coverage
  • (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
  • (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR
  • Pre-Commit Checks were ran and passed
  • Tests were ran and passed

Description

  • This PR adds a new PydanticPlugin that allows for customization of the Pydantic integration. Currently, the only feature is to let a user export a model by alias. When setting this, it applies to OpenAPI and responses.

Close Issue(s)

@cofin cofin requested review from a team as code owners October 5, 2023 23:49
@cofin cofin changed the title feat: Custom Pydantic integration feat: allow customization of Pydantic integration Oct 6, 2023
@cofin
Copy link
Member Author

cofin commented Oct 6, 2023

Addresses regression in #2150

Resolves #2373

@cofin cofin linked an issue Oct 6, 2023 that may be closed by this pull request
4 tasks
litestar/contrib/pydantic/__init__.py Outdated Show resolved Hide resolved
litestar/app.py Show resolved Hide resolved
Copy link
Contributor

@Alc-Alc Alc-Alc left a comment

Choose a reason for hiding this comment

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

Existing and new tests are passing, LGTM

litestar/app.py Outdated Show resolved Hide resolved
Copy link
Member

@provinzkraut provinzkraut left a comment

Choose a reason for hiding this comment

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

This seems to be the (more) correct way to address these. Good work Mr. @cofin!

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

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

@cofin cofin merged commit 2222d2d into litestar-org:main Oct 6, 2023
16 checks passed
@cofin cofin deleted the pydantic-type-encoder branch October 6, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: schema not respecting alias generator or alias on field
5 participants