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
Copy file name to clipboardExpand all lines: src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions/OpenApiEndpointRouteBuilderExtensionsTests.cs
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -181,12 +181,14 @@ public async Task MapOpenApi_ShouldRetrieveOptionsInACaseInsensitiveManner()
// When we receive an OpenAPI document, we use an OptionsMonitor to retrieve named options that equal the requested document name.
185
-
// This is case-sensitive. If the document doesn't exist, the options monitor return a default instance, in which the OpenAPI version is set to v3.
184
+
// When we receive an OpenAPI document, we use an OptionsMonitor to retrieve OpenAPI options which are stored with a key equal the requested document name.
185
+
// This key is case-sensitive. If the document doesn't exist, the options monitor return a default instance, in which the OpenAPI version is set to v3.
186
+
// This could cause bugs! You'd get your document, but depending on the casing you used in the document name you passed to the function, you'll receive different OpenAPI document versions.
187
+
// We want to prevent this from happening. Therefore:
186
188
// By setting up a v2 document on the "casesensitive" route and requesting it on "CaseSensitive",
187
189
// we can test that the we've configured the options monitor to retrieve the options in a case-insensitive manner.
188
190
// If it is case-sensitive, it would return a default instance with OpenAPI version v3, which would cause this test to fail!
189
-
// However, if it would return the v2 instance, the test would pass!
191
+
// However, if it would return the v2 instance, which was configured on the lowercase - case-insensitive - documentname, the test would pass!
190
192
// For more info, see OpenApiEndpointRouteBuilderExtensions.cs
0 commit comments