You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are seeing the order of types change in openapi generation, which makes comparing golden versions of the openapi spec problematic. I think the specific problem we are seeing comes from
where we use the set operation to uniquify the list of types. The order doesn't matter to the correctness of the openapi spec, so perhaps the responsibility for ensuring a determistic spec file could also come from the serializer, but either way it would be helpful if we could always render the same openapi spec the same way.
URL to code causing the issue
No response
MCVE
# Your MCVE code here
Steps to reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Having this be consistent makes sense to me. There are 2 ways to fix this: Either sort the items after they have been deduplicated, or remove the usage of a set entirely. Sorting is easier, but not using a set to begin with gives us the opportunity to preserve order, which, while not necessary, could be a bit nicer to work with.
@atom-andrew Since you've already figured out what the issue is, would you be interested in submitting a PR with a fix? :)
@provinzkraut I'm happy to submit a PR but it wasn't obvious to me where this would be tested. Can you give me a tip about where it would make sense to include a test for this? Thanks.
Description
We are seeing the order of types change in openapi generation, which makes comparing golden versions of the openapi spec problematic. I think the specific problem we are seeing comes from
litestar/litestar/_openapi/schema_generation/schema.py
Line 160 in ffaf561
set
operation to uniquify the list of types. The order doesn't matter to the correctness of the openapi spec, so perhaps the responsibility for ensuring a determistic spec file could also come from the serializer, but either way it would be helpful if we could always render the same openapi spec the same way.URL to code causing the issue
No response
MCVE
# Your MCVE code here
Steps to reproduce
Screenshots
No response
Logs
No response
Litestar Version
2.9.1
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: