@@ -56,7 +56,10 @@ def func(a: int, b: str = "ok") -> None:
5656
5757
5858def test_function_to_jsonschema_annotated ():
59- def func (a : Annotated [int , "Param a" ], b : Annotated [str , "Param b" ] = "ok" ) -> None :
59+ def func (
60+ a : Annotated [int , "The description for parameter a" ],
61+ b : Annotated [str , "The description for parameter b" ] = "ok" ,
62+ ) -> None :
6063 """This is a test function."""
6164 pass
6265
@@ -67,10 +70,14 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
6770 "name" : "func" ,
6871 "parameters" : {
6972 "properties" : {
70- "a" : {"description" : "Param a" , "title" : "A" , "type" : "integer" },
73+ "a" : {
74+ "description" : "The description for parameter a" ,
75+ "title" : "A" ,
76+ "type" : "integer" ,
77+ },
7178 "b" : {
7279 "default" : "ok" ,
73- "description" : "Param b" ,
80+ "description" : "The description for parameter b" ,
7481 "title" : "B" ,
7582 "type" : "string" ,
7683 },
@@ -86,8 +93,8 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
8693
8794def test_function_to_jsonschema_pydantic_field ():
8895 def func (
89- a : int = Field (description = "Param a" ),
90- b : str = Field (default = "ok" , description = "Param b" ),
96+ a : int = Field (description = "The description for parameter a" ),
97+ b : str = Field (default = "ok" , description = "The description for parameter b" ),
9198 ) -> None :
9299 """This is a test function."""
93100 pass
@@ -99,10 +106,14 @@ def func(
99106 "name" : "func" ,
100107 "parameters" : {
101108 "properties" : {
102- "a" : {"description" : "Param a" , "title" : "A" , "type" : "integer" },
109+ "a" : {
110+ "description" : "The description for parameter a" ,
111+ "title" : "A" ,
112+ "type" : "integer" ,
113+ },
103114 "b" : {
104115 "default" : "ok" ,
105- "description" : "Param b" ,
116+ "description" : "The description for parameter b" ,
106117 "title" : "B" ,
107118 "type" : "string" ,
108119 },
0 commit comments