Skip to content

Commit 2da3a72

Browse files
Merge pull request #2373 from Eneuman/master
Resolves a null pointer exception when returning a Dictionary containing known keys
2 parents a6d3386 + 0c548a1 commit 2da3a72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/SchemaGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private OpenApiSchema GenerateSchemaForMember(
9090
}
9191

9292
// NullableAttribute behaves diffrently for Dictionaries
93-
if (modelType.IsGenericType && modelType.GetGenericTypeDefinition() == typeof(Dictionary<,>))
93+
if (schema.AdditionalPropertiesAllowed && modelType.IsGenericType && modelType.GetGenericTypeDefinition() == typeof(Dictionary<,>))
9494
{
9595
schema.AdditionalProperties.Nullable = !memberInfo.IsDictionaryValueNonNullable();
9696
}

0 commit comments

Comments
 (0)