Skip to content

feat: add custom DTO factory support for mixed model types #4123

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

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

Conversation

abdulhaq-e
Copy link
Contributor

Description

This allows for nesting mixed models, e.g. a SQLAlchemy model in a dataclass or any other mixture of models.

@abdulhaq-e abdulhaq-e requested review from a team as code owners April 17, 2025 09:27
@github-actions github-actions bot added area/docs This PR involves changes to the documentation area/dto This PR involves changes to the DTOs area/private-api This PR involves changes to the privatized API size: small type/feat pr/external Triage Required 🏥 This requires triage labels Apr 17, 2025
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.34%. Comparing base (7f949b3) to head (78724c9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4123   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files         348      348           
  Lines       15841    15848    +7     
  Branches     1749     1749           
=======================================
+ Hits        15579    15586    +7     
  Misses        125      125           
  Partials      137      137           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This allows for nesting mixed models, e.g. a SQLAlchemy model in a
dataclass or any other mixture of models.
Copy link

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

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.

The feature itself looks good, the implementation approach isn't ideal imo. This generates nested DTOs, whereas I think it should instead generate one DTO that's nested. Especially for the codegen backend, this should be much more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation area/dto This PR involves changes to the DTOs area/private-api This PR involves changes to the privatized API pr/external size: small Triage Required 🏥 This requires triage type/feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants