Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Support @Schema annotation for Object parameters in FunctionTool

未关闭
#611 2 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@hemasekhar-p 已经在做这个了。

开始于 2026年1月14日。

评估

这个 Issue 还没有评估数据。

描述

needs review

Is your feature request related to a problem? Please describe.
Currently, adk-java relies on Jackson's @JsonProperty for defining schema names and required fields for pojos used as FunctionTool parameters. This creates several friction points:

  1. Naming Conflicts: We may want the LLM-facing parameter name (e.g., snake_case) to differ from the Java field name (e.g., camelCase) without affecting internal JSON serialization used for other purposes.
  2. Missing Metadata: Standard Jackson annotations do not support a description field, which is critical for FunctionTool schemas.
  3. Ambiguous Optionality: Controlling whether a field is "required" or "optional" in the generated schema is difficult to decouple from Jackson's strict deserialization rules.

Describe the solution you'd like
I would like to extend the com.google.adk.tools.Annotations.Schema annotation to act as the highest source of truth for generating the FunctionTool schema in regards to pojo parameters, and deserialization. This includes:

  1. Name: @Schema(name="...") should control the property name in the generated schema and during deserialization of the LLM response.
  2. Description: @Schema(description="...") should populate the schema description.
  3. Optionality: @Schema(optional=true/false) should explicitly control whether a field is marked as required, overriding Jackson's default behavior if necessary.

Describe alternatives you've considered

  1. Jackson Mixins: We could use Jackson Mixins to separate the LLM view from the internal view, but this adds significant boilerplate and complexity for developers.
  2. Custom Annotations: I considered creating a new set of annotations, but extending the existing @Schema annotation seems more idiomatic for the ADK.

Additional context
The Object FunctionTool parameter doesn't seem to have a direct 1-1 equivalent in adk-python, other than an issue requesting for pydantic models to be supported as FunctionTool parameters.

The precedence rules I believe align best with the rest of the library would be :

Name: @Schema(name) > @JsonProperty(value) > Field Name
Description: @Schema(description) > None
Required: @Schema(optional) > @JsonProperty(required) > Default (Optional)

These rules should not affect the way prior objects that have been passed without the @Schema annotation are treated.

主要语言
Java
星标
1.7k
派生
431
平均合并
2 天 22 小时
30 天内合并 PR
28

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/adk-java 的其他 Issue

查看 google/adk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。