-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
fix: openapi generation with pydantic examples #3279
Conversation
I am not entirely sure about treating the examples as |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3279 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 320 320
Lines 14448 14449 +1
Branches 2296 2296
=======================================
+ Hits 14193 14194 +1
Misses 114 114
Partials 141 141 ☔ View full report in Codecov by Sentry. |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3279 |
The issue is really in: Line 81 in d2cb891
... where the schema properties such as examples, are unpacked into an instance of Here, the Lines 92 to 95 in d2cb891
Then the list of Lines 96 to 102 in d2cb891
However, Then, that Line 127 in d2cb891
Eventually the dict returned which now contains Line 176 in d2cb891
And that is the problem, We actually spoke about this in #3224 (that is carrying around jsonschema examples in openapi spec example objects. Not ideal but its a legacy thing). This is why that This metadata handling is an absolute labyrinth so no judgement about the fix you applied in this PR, but I think resolving this per above is preferable. |
Superseded by #3281 - copied your test over with attribution and applied the fix @bunny-therapist - cheers! |
Description
Resolves an issue with OpenAPI schema generation when using
Pydantic
examplesCloses