File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
spring-ai-model/src/test/java/org/springframework/ai/util/json Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,29 @@ void generateSchemaForMethodWithOpenApiSchemaAnnotations() throws Exception {
161161 assertThat (schema ).isEqualToIgnoringWhitespace (expectedJsonSchema );
162162 }
163163
164+ @ Test
165+ void generateSchemaForMethodWithObjectParam () throws Exception {
166+ Method method = TestMethods .class .getDeclaredMethod ("objectParamMethod" , Object .class );
167+
168+ String schema = JsonSchemaGenerator .generateForMethodInput (method );
169+ String expectedJsonSchema = """
170+ {
171+ "$schema": "https://json-schema.org/draft/2020-12/schema",
172+ "type": "object",
173+ "properties": {
174+ "object": {
175+ }
176+ },
177+ "required": [
178+ "object"
179+ ],
180+ "additionalProperties": false
181+ }
182+ """ ;
183+
184+ assertThat (schema ).isEqualToIgnoringWhitespace (expectedJsonSchema );
185+ }
186+
164187 @ Test
165188 void generateSchemaForMethodWithJacksonAnnotations () throws Exception {
166189 Method method = TestMethods .class .getDeclaredMethod ("jacksonMethod" , String .class , String .class );
@@ -662,6 +685,9 @@ static class TestMethods {
662685 public void simpleMethod (String name , int age ) {
663686 }
664687
688+ public void objectParamMethod (Object object ) {
689+ }
690+
665691 public void annotatedMethod (
666692 @ ToolParam (required = false , description = "The username of the customer" ) String username ,
667693 @ ToolParam (required = true ) String password ) {
You can’t perform that action at this time.
0 commit comments