@@ -56,7 +56,10 @@ def func(a: int, b: str = "ok") -> None:
56
56
57
57
58
58
def 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 :
60
63
"""This is a test function."""
61
64
pass
62
65
@@ -67,10 +70,14 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
67
70
"name" : "func" ,
68
71
"parameters" : {
69
72
"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
+ },
71
78
"b" : {
72
79
"default" : "ok" ,
73
- "description" : "Param b" ,
80
+ "description" : "The description for parameter b" ,
74
81
"title" : "B" ,
75
82
"type" : "string" ,
76
83
},
@@ -86,8 +93,8 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
86
93
87
94
def test_function_to_jsonschema_pydantic_field ():
88
95
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" ),
91
98
) -> None :
92
99
"""This is a test function."""
93
100
pass
@@ -99,10 +106,14 @@ def func(
99
106
"name" : "func" ,
100
107
"parameters" : {
101
108
"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
+ },
103
114
"b" : {
104
115
"default" : "ok" ,
105
- "description" : "Param b" ,
116
+ "description" : "The description for parameter b" ,
106
117
"title" : "B" ,
107
118
"type" : "string" ,
108
119
},
0 commit comments