-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
LGTM 👍 |
class TestClassWithFields(BaseModel): | ||
baseId: str = Field(..., description="Some random field") | ||
user_id: str = Field(..., description="Another random field") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
python/composio/tools/base/abs.py
Outdated
if is_camel_case(field_name): | ||
field_properties["title"] = inflection.titleize( | ||
inflection.underscore(field_name).replace("_", " ") | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
.
LGTM 👍 |
LGTM 👍 |
LGTM 👍 |
When schema is generated for requests with fields like
baseId: str = Field(..., description="The ID of the base")
will have titleBaseid
. It should be more human readable likeBase Id