File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/Libraries/Microsoft.Extensions.AI.Abstractions/Functions
test/Libraries/Microsoft.Extensions.AI.Tests/Functions Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1058,8 +1058,7 @@ private record struct DescriptorKey(
1058
1058
( null # null literal
1059
1059
| false # false literal
1060
1060
| true # true literal
1061
- | \d # positive number
1062
- | -\d # negative number
1061
+ | -?[0-9]# number
1063
1062
| " # string
1064
1063
| \[ # start array
1065
1064
| { # start object
Original file line number Diff line number Diff line change @@ -103,10 +103,13 @@ public async Task Parameters_ToleratesJsonEncodedParameters()
103
103
[ InlineData ( " \" I am a string!\" " ) ]
104
104
[ InlineData ( " {}" ) ]
105
105
[ InlineData ( "[]" ) ]
106
+ [ InlineData ( "// single-line comment\r \n null" ) ]
107
+ [ InlineData ( "/* multi-line\r \n comment */\r \n null" ) ]
106
108
public async Task Parameters_ToleratesJsonStringParameters ( string jsonStringParam )
107
109
{
108
- AIFunction func = AIFunctionFactory . Create ( ( JsonElement param ) => param ) ;
109
- JsonElement expectedResult = JsonDocument . Parse ( jsonStringParam ) . RootElement ;
110
+ JsonSerializerOptions options = new ( AIJsonUtilities . DefaultOptions ) { ReadCommentHandling = JsonCommentHandling . Skip } ;
111
+ AIFunction func = AIFunctionFactory . Create ( ( JsonElement param ) => param , serializerOptions : options ) ;
112
+ JsonElement expectedResult = JsonDocument . Parse ( jsonStringParam , new ( ) { CommentHandling = JsonCommentHandling . Skip } ) . RootElement ;
110
113
111
114
var result = await func . InvokeAsync ( new ( )
112
115
{
You can’t perform that action at this time.
0 commit comments