fix(openapi): remove auto-generated Python-like titles from union sch…#4684
fix(openapi): remove auto-generated Python-like titles from union sch…#4684r-bit-rry wants to merge 3 commits intollamastack:mainfrom
Conversation
|
This pull request has merge conflicts that must be resolved before it can be merged. @r-bit-rry please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
leseb
left a comment
There was a problem hiding this comment.
I suspect that we do get proper titles for anyOf and oneOf thanks to the migration to FastAPI routers.
So we should remove this function once we are done with the migration.
Can you hold until that happens?
|
This pull request has merge conflicts that must be resolved before it can be merged. @r-bit-rry please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
|
This pull request has been automatically marked as stale because it has not had activity within 60 days. It will be automatically closed if no further activity occurs within 30 days. |
Draft Status
This PR is a draft pending Stainless SDK preview validation. We need to verify that removing these titles doesn't cause regressions in generated SDK type names.
Explores the removal of auto-generated Python-like titles (e.g.,
title: list[string],title: string | list[string]) from inline union schemas in OpenAPI specs.Problem
The
_add_titles_to_unions()function was generating titles that look like Python type hints rather than human-readable labels. These titles:titleis used by the generators. Someone reading title: string | list[string] needs to know Python syntax to understand it.Introduced in PR #3944. The intent was good, help Stainless generate better type names instead of ugly ones like UnionMember4. But the implementation produces Python-like syntax (list[string]) which was identified as "off".
Solution
Made
_add_titles_to_unions()a no-op. Named schemas retain their proper titles via@json_schema_typeandregister_schema().Fixes #4670
BREAKING CHANGE: Changes to schema generations