Zhuoxi2000 opened a new issue, #1445:
URL: https://github.com/apache/flink-agents/issues/1445

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   The YAML reference says `parameter_types` is "Required for Java / Forbidden 
for Python" for tools, and the schema description says it "is forbidden 
otherwise". #774 / #804 added this check to the Python loader only.
   
   The Java loader still accepts it. `YamlLoader.buildTool` 
(`api/src/main/java/org/apache/flink/agents/api/yaml/YamlLoader.java:152`) only 
rejects a Java tool without `parameter_types`. A Python tool (`type: python` or 
no `type`) with `parameter_types` loads, and `resolveFunction` drops the list 
when it builds the `PythonFunction`.
   
   Expected: `IllegalArgumentException` with "'parameter_types' is only valid 
for Java tools.", as the Python loader raises.
   Actual: the tool loads and `parameter_types` is silently ignored.
   
   ### How to reproduce
   
   ```java
   ToolSpec spec = new ObjectMapper(new YAMLFactory())
           .readValue("name: t\nfunction: pkg:fn\ntype: 
python\nparameter_types: [int]\n", ToolSpec.class);
   YamlLoader.buildTool(spec); // no exception
   ```
   
   The same YAML in Python's `load_yaml` raises `ValueError`.
   
   ### Version and environment
   
   main at 337d9550, Java 17, macOS.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to