Skip to content

Incorrect use of ClassUtils.isAssignable #3729

Closed
@TheEterna

Description

@TheEterna

Incorrect Usage of ClassUtils.isAssignable: incorrect reversing the Parameters Causes the Method to Always Return true When an Object is Passed


You can refer to issue #3355 and the pr #3479

The bug code is as follows:

String parameterName = method.getParameters()[i].getName();
			Type parameterType = method.getGenericParameterTypes()[i];
			if (parameterType instanceof Class<?> parameterClass
					&&  **ClassUtils.isAssignable(parameterClass, ToolContext.class**) ) {
				// A ToolContext method parameter is not included in the JSON Schema
				// generation.
				// It's a special type used by Spring AI to pass contextual data to tools
				// outside the model interaction flow.
				continue;
			}

Code Location:org.springframework.ai.util.json.schema.JsonSchemaGenerator.generateForMethodInput(Method method, SchemaOption... schemaOptions)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions