Skip to content

Commit 3a41a1d

Browse files
committed
Resolve the comments
1 parent 685ef5b commit 3a41a1d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Microsoft.OpenApi.Readers/ParseNodes/OpenApiAnyConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public static IOpenApiAny GetSpecificOpenApiAny(IOpenApiAny openApiAny, OpenApiS
200200
{
201201
return new OpenApiByte(Convert.FromBase64String(value));
202202
}
203-
catch(Exception)
203+
catch(FormatException)
204204
{ }
205205
}
206206

@@ -211,7 +211,7 @@ public static IOpenApiAny GetSpecificOpenApiAny(IOpenApiAny openApiAny, OpenApiS
211211
{
212212
return new OpenApiBinary(Encoding.UTF8.GetBytes(value));
213213
}
214-
catch(Exception)
214+
catch(EncoderFallbackException)
215215
{ }
216216
}
217217

test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Globalization;
55
using System.IO;
6+
using System.Text;
67
using FluentAssertions;
78
using Microsoft.OpenApi.Any;
89
using Microsoft.OpenApi.Models;
@@ -32,7 +33,7 @@ public class OpenApiExampleTests
3233
["href"] = new OpenApiString("http://example.com/1"),
3334
["rel"] = new OpenApiString("sampleRel1"),
3435
["bytes"] = new OpenApiByte(new byte[] { 1, 2, 3 }),
35-
["binary"] = new OpenApiBinary(new byte[] { 41, 42, 43 })
36+
["binary"] = new OpenApiBinary(Encoding.UTF8.GetBytes("Ñ😻😑♮Í☛oƞ♑😲☇éNjžŁ♻😟¥a´Ī♃ƠąøƩ"))
3637
}
3738
}
3839
},
@@ -121,7 +122,7 @@ public void SerializeAdvancedExampleAsV3JsonWorks()
121122
""href"": ""http://example.com/1"",
122123
""rel"": ""sampleRel1"",
123124
""bytes"": ""AQID"",
124-
""binary"": "")*+""
125+
""binary"": ""Ñ😻😑♮Í☛oƞ♑😲☇éNjžŁ♻😟¥a´Ī♃ƠąøƩ""
125126
}
126127
]
127128
},

0 commit comments

Comments
 (0)