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(
10581058 ( null # null literal
10591059 | false # false literal
10601060 | true # true literal
1061- | \d # positive number
1062- | -\d # negative number
1061+ | -?[0-9]# number
10631062 | " # string
10641063 | \[ # start array
10651064 | { # start object
Original file line number Diff line number Diff line change @@ -103,10 +103,13 @@ public async Task Parameters_ToleratesJsonEncodedParameters()
103103 [ InlineData ( " \" I am a string!\" " ) ]
104104 [ InlineData ( " {}" ) ]
105105 [ InlineData ( "[]" ) ]
106+ [ InlineData ( "// single-line comment\r \n null" ) ]
107+ [ InlineData ( "/* multi-line\r \n comment */\r \n null" ) ]
106108 public async Task Parameters_ToleratesJsonStringParameters ( string jsonStringParam )
107109 {
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 ;
110113
111114 var result = await func . InvokeAsync ( new ( )
112115 {
You can’t perform that action at this time.
0 commit comments