Skip to content

Commit c0f2f25

Browse files
Duplicate response processing causes schema corruption
1 parent 26a2ef1 commit c0f2f25

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
using System;
54
using System.Collections.Generic;
65
using System.Linq;
76
using Microsoft.OpenApi.Extensions;
@@ -132,11 +131,6 @@ internal static OpenApiOperation LoadOperation(ParseNode node)
132131
}
133132
}
134133

135-
foreach (var response in operation.Responses.Values)
136-
{
137-
ProcessProduces(response, node.Context);
138-
}
139-
140134
return operation;
141135
}
142136

@@ -168,10 +162,10 @@ private static OpenApiRequestBody CreateFormBody(ParsingContext context, List<Op
168162
Required = new HashSet<string>(formParameters.Where(p => p.Required).Select(p => p.Name))
169163
}
170164
};
171-
165+
172166
var consumes = context.GetFromTempStorage<List<string>>(TempStorageKeys.OperationConsumes) ??
173167
context.GetFromTempStorage<List<string>>(TempStorageKeys.GlobalConsumes) ??
174-
new List<string> {"application/x-www-form-urlencoded"};
168+
new List<string> { "application/x-www-form-urlencoded" };
175169

176170
var formBody = new OpenApiRequestBody
177171
{
@@ -189,7 +183,7 @@ internal static OpenApiRequestBody CreateRequestBody(
189183
{
190184
var consumes = context.GetFromTempStorage<List<string>>(TempStorageKeys.OperationConsumes) ??
191185
context.GetFromTempStorage<List<string>>(TempStorageKeys.GlobalConsumes) ??
192-
new List<string> {"application/json"};
186+
new List<string> { "application/json" };
193187

194188
var requestBody = new OpenApiRequestBody
195189
{

0 commit comments

Comments
 (0)