Skip to content

OpenAPIToolset automatically converts camelCase to snake_case with no option to disable #4166

Closed

Description

@adrianthompson-lh

Is your feature request related to a problem? Please describe.
ADK's OpenAPIToolset automatically converts camelCase to snake_case when generating tool parameters, and there doesn't appear to be a built-in option to disable this. This is a problem when calling APIs which expect camelCase property names in the request body.

For example, an OpenAPI spec with sessionInfo gets converted to session_info in the actual API call, causing the target API to reject the request.

Describe the solution you'd like
It would be good to be able to flag parameters in the OpenAPI spec to preserve their original casing. For example, a vendor extension like:

sessionInfo:
  type: object
  x-adk-preserve-case: true
  properties:
    session:
      type: string

Or a global option in the OpenAPIToolset constructor:

toolset = OpenAPIToolset(
    spec_str=spec_content,
    spec_str_type="yaml",
    preserve_property_names=True,  # Skip snake_case conversion
)

Describe alternatives you've considered

Modifying the target API to accept both session_info and sessionInfo - works but requires changes to every API endpoint
Creating a custom FunctionTool wrapper instead of using OpenAPIToolset - bypasses the conversion but loses the benefits of automatic OpenAPI parsing
Using snake_case in the OpenAPI spec - but this misrepresents the actual API contract
Additional context
The conversion happens in _sanitize_schema_formats_for_gemini in _gemini_schema_util.py at line 154:

field_name = _to_snake_case(field_name)
This converts all OpenAPI schema field names to snake_case before passing them to Gemini. While rest_api_tool.py does store original_name for parameters, the schema transformation happens before this mapping can preserve the original casing in the request body.

Activity

  1. added
    tools[Component] This issue is related to tools
    on Jan 15, 2026
  2. added theissue type on Jan 15, 2026
  3. klateefa commented on Feb 11, 2026

    @klateefa

    @adrianthompson-lh Thanks for the update. The request is currently being reviewed, and I will let you know if anything further is needed. Thank you for your understanding.

  4. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    on Feb 11, 2026
  5. added a commit that references this issue on Feb 16, 2026
    5419b33
  6. yuvrajangadsingh commented on Feb 16, 2026

    @yuvrajangadsingh
    Contributor

    Opened a PR for this: #4505

    Added a preserve_property_names parameter to OpenAPIToolset that keeps original property names from the OpenAPI spec instead of converting them to snake_case. Backward compatible — defaults to False.

  7. added 5 commits that reference this issue on Feb 18, 2026
    072852a
    fb3f7d5
    8c8509f
    94f26ec
    4396695
  8. added 15 commits that reference this issue on Feb 24, 2026
    2b553de
    f5508ee
    e85df08
    170672a
    6663e8b
    93274f7
    ca7091b
    8227851
    fc9e858
    d77e286
    4fd4e34
    ffd73c5
    95ae3eb
    40fca8a
    f12865e
  9. self-assigned this
    on Jun 17, 2026
  10. GWeale commented on Jun 17, 2026

    @GWeale
    Collaborator

    Fixed on main via #4505 (commit 078b516): OpenAPIToolset now has a preserve_property_names option to keep the original spec names instead of forcing snake_case. Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

needs review[Status] The PR/issue is awaiting review from the maintainertools[Component] This issue is related to tools

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions