You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(csharp): guard array-of-enum deserialization against null JSON values
Without the null check, a JSON null value for an array-of-enum property
caused the reader to advance past the null token and attempt to read the
next property as array content, desynchronizing the Utf8JsonReader.
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -252,16 +252,19 @@
252
252
{{^isDate}}
253
253
{{^isDateTime}}
254
254
{{#items.isEnum}}
255
-
var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Items = new List<{{#items.isInnerEnum}}{{classname}}.{{/items.isInnerEnum}}{{{items.datatypeWithEnum}}}>();
256
-
while (utf8JsonReader.Read())
255
+
if (utf8JsonReader.TokenType != JsonTokenType.Null)
257
256
{
258
-
if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
var {{#lambda.camelcase_sanitize_param}}{{name}}{{/lambda.camelcase_sanitize_param}}Items = new List<{{#items.isInnerEnum}}{{classname}}.{{/items.isInnerEnum}}{{{items.datatypeWithEnum}}}>();
258
+
while (utf8JsonReader.Read())
259
+
{
260
+
if (utf8JsonReader.TokenType == JsonTokenType.EndArray)
0 commit comments