fix(openapi): remove auto-generated Python-like titles from union sch… #4684
+1,929
−3,563
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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