Skip to content

fix: humanize field titles in req/res schema #1509

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

Merged
merged 5 commits into from
Apr 1, 2025

Conversation

Devanshusisodiya
Copy link

@Devanshusisodiya Devanshusisodiya commented Mar 31, 2025

When schema is generated for requests with fields like baseId: str = Field(..., description="The ID of the base") will have title Baseid. It should be more human readable like Base Id

image

Copy link

vercel bot commented Mar 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 1, 2025 9:21am

Copy link

LGTM 👍

Comment on lines 88 to 90
class TestClassWithFields(BaseModel):
baseId: str = Field(..., description="Some random field")
user_id: str = Field(..., description="Another random field")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add pascal case and nested objects for recursive updates

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the test more extensive. Now it covers PascalCase fields and recursive objects.

Comment on lines 80 to 83
if is_camel_case(field_name):
field_properties["title"] = inflection.titleize(
inflection.underscore(field_name).replace("_", " ")
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply normalisation on all cases, no need for the check

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, normalizing to snake_case.

Copy link

LGTM 👍

Copy link

LGTM 👍

Copy link

LGTM 👍

@angrybayblade angrybayblade merged commit b33e069 into master Apr 1, 2025
17 of 23 checks passed
@angrybayblade angrybayblade deleted the fix/action-req-res-field-titles branch April 1, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants