Skip to content

Commit 7b0f5b1

Browse files
committed
Merge branch 'main' into marc/revert-pinvoke
2 parents ea10940 + 8adff2c commit 7b0f5b1

19 files changed

+265
-64
lines changed

.github/policies/resourceManagement.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ configuration:
670670
then:
671671
- removeMilestone
672672
- addMilestone:
673-
milestone: 6.0.31
673+
milestone: 6.0.32
674674
description: '[Milestone Assignments] Assign Milestone to PRs merged to release/6.0 branch'
675675
- if:
676676
- payloadType: Pull_Request
@@ -681,7 +681,7 @@ configuration:
681681
then:
682682
- removeMilestone
683683
- addMilestone:
684-
milestone: 8.0.6
684+
milestone: 8.0.7
685685
description: '[Milestone Assignments] Assign Milestone to PRs merged to release/8.0 branch'
686686
- if:
687687
- payloadType: Issues

.github/workflows/update-sdk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: martincostello/update-dotnet-sdk@9d42ad9bcbd97a74394c7273c9c616b4bf136b53 # v3.1.3
23+
- uses: martincostello/update-dotnet-sdk@67d6e2b14939c06978a7f80444157296c3defe14 # v3.2.3
2424
with:
2525
quality: 'daily'
2626
repo-token: ${{ secrets.GITHUB_TOKEN }}

eng/Version.Details.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,19 +325,19 @@
325325
<Uri>https://github.com/dotnet/runtime</Uri>
326326
<Sha>745230568e52639e229dcc24c98fe0dbb4c1641d</Sha>
327327
</Dependency>
328-
<Dependency Name="Microsoft.Web.Xdt" Version="9.0.0-preview.24277.2">
328+
<Dependency Name="Microsoft.Web.Xdt" Version="9.0.0-preview.24303.1">
329329
<Uri>https://github.com/dotnet/xdt</Uri>
330-
<Sha>7e5dc8069868619c4d90b96f4e57bdef9b16c8e0</Sha>
330+
<Sha>b1d534fe8831bbf62dc4356a7e611befee6ece33</Sha>
331331
</Dependency>
332332
<!-- Intermediate is necessary for source build. -->
333-
<Dependency Name="Microsoft.SourceBuild.Intermediate.xdt" Version="9.0.0-preview.24277.2">
333+
<Dependency Name="Microsoft.SourceBuild.Intermediate.xdt" Version="9.0.0-preview.24303.1">
334334
<Uri>https://github.com/dotnet/xdt</Uri>
335-
<Sha>7e5dc8069868619c4d90b96f4e57bdef9b16c8e0</Sha>
335+
<Sha>b1d534fe8831bbf62dc4356a7e611befee6ece33</Sha>
336336
<SourceBuild RepoName="xdt" ManagedOnly="true" />
337337
</Dependency>
338-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24278.2">
338+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24303.1">
339339
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
340-
<Sha>87ebd07371adfe1d8140889c33da692eb2134f1a</Sha>
340+
<Sha>92f050c4768a6a8da3f79eba6dca60effd9c20fa</Sha>
341341
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
342342
</Dependency>
343343
<!-- Not updated automatically -->
@@ -410,13 +410,13 @@
410410
<Uri>https://github.com/dotnet/arcade</Uri>
411411
<Sha>2001d73c8ff942331a73300ba61fa6164805b231</Sha>
412412
</Dependency>
413-
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.0.0-preview.5.24273.3">
413+
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.0.0-preview.5.24301.1">
414414
<Uri>https://github.com/dotnet/extensions</Uri>
415-
<Sha>5dfd054e528f38926ad2c137896bd86036ad07b0</Sha>
415+
<Sha>74a55056def261bb3b433ceb040dc4134a35f63e</Sha>
416416
</Dependency>
417-
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.0.0-preview.5.24273.3">
417+
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.0.0-preview.5.24301.1">
418418
<Uri>https://github.com/dotnet/extensions</Uri>
419-
<Sha>5dfd054e528f38926ad2c137896bd86036ad07b0</Sha>
419+
<Sha>74a55056def261bb3b433ceb040dc4134a35f63e</Sha>
420420
</Dependency>
421421
<Dependency Name="NuGet.Frameworks" Version="6.2.4">
422422
<Uri>https://github.com/nuget/nuget.client</Uri>

eng/Versions.props

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@
137137
<SystemIOHashingVersion>9.0.0-preview.5.24272.1</SystemIOHashingVersion>
138138
<SystemRuntimeCachingVersion>9.0.0-preview.5.24272.1</SystemRuntimeCachingVersion>
139139
<!-- Packages from dotnet/extensions -->
140-
<MicrosoftExtensionsDiagnosticsTestingVersion>9.0.0-preview.5.24273.3</MicrosoftExtensionsDiagnosticsTestingVersion>
141-
<MicrosoftExtensionsTimeProviderTestingVersion>9.0.0-preview.5.24273.3</MicrosoftExtensionsTimeProviderTestingVersion>
140+
<MicrosoftExtensionsDiagnosticsTestingVersion>9.0.0-preview.5.24301.1</MicrosoftExtensionsDiagnosticsTestingVersion>
141+
<MicrosoftExtensionsTimeProviderTestingVersion>9.0.0-preview.5.24301.1</MicrosoftExtensionsTimeProviderTestingVersion>
142142
<!-- Packages from dotnet/efcore -->
143143
<dotnetefVersion>9.0.0-preview.5.24271.1</dotnetefVersion>
144144
<MicrosoftEntityFrameworkCoreInMemoryVersion>9.0.0-preview.5.24271.1</MicrosoftEntityFrameworkCoreInMemoryVersion>
@@ -167,14 +167,14 @@
167167
<!-- Packages from dotnet/source-build-externals -->
168168
<MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>9.0.0-alpha.1.24278.2</MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>
169169
<!-- Packages from dotnet/source-build-reference-packages -->
170-
<MicrosoftSourceBuildIntermediatesourcebuildreferencepackagesVersion>9.0.0-alpha.1.24278.2</MicrosoftSourceBuildIntermediatesourcebuildreferencepackagesVersion>
170+
<MicrosoftSourceBuildIntermediatesourcebuildreferencepackagesVersion>9.0.0-alpha.1.24303.1</MicrosoftSourceBuildIntermediatesourcebuildreferencepackagesVersion>
171171
<!-- Packages from dotnet/symreader -->
172172
<MicrosoftSourceBuildIntermediatesymreaderVersion>2.1.0-beta.24208.1</MicrosoftSourceBuildIntermediatesymreaderVersion>
173173
<!-- Packages from dotnet/winforms -->
174174
<SystemDrawingCommonVersion>9.0.0-preview.6.24302.1</SystemDrawingCommonVersion>
175175
<!-- Packages from dotnet/xdt -->
176-
<MicrosoftWebXdtVersion>9.0.0-preview.24277.2</MicrosoftWebXdtVersion>
177-
<MicrosoftSourceBuildIntermediatexdtVersion>9.0.0-preview.24277.2</MicrosoftSourceBuildIntermediatexdtVersion>
176+
<MicrosoftWebXdtVersion>9.0.0-preview.24303.1</MicrosoftWebXdtVersion>
177+
<MicrosoftSourceBuildIntermediatexdtVersion>9.0.0-preview.24303.1</MicrosoftSourceBuildIntermediatexdtVersion>
178178
</PropertyGroup>
179179
<!--
180180
@@ -318,8 +318,8 @@
318318
<MicrosoftPlaywrightVersion>1.28.0</MicrosoftPlaywrightVersion>
319319
<PollyExtensionsHttpVersion>3.0.0</PollyExtensionsHttpVersion>
320320
<PollyVersion>7.2.4</PollyVersion>
321-
<SeleniumSupportVersion>4.20.0</SeleniumSupportVersion>
322-
<SeleniumWebDriverVersion>4.20.0</SeleniumWebDriverVersion>
321+
<SeleniumSupportVersion>4.21.0</SeleniumSupportVersion>
322+
<SeleniumWebDriverVersion>4.21.0</SeleniumWebDriverVersion>
323323
<SerilogExtensionsLoggingVersion>1.4.0</SerilogExtensionsLoggingVersion>
324324
<SerilogSinksFileVersion>4.0.0</SerilogSinksFileVersion>
325325
<StackExchangeRedisVersion>2.7.27</StackExchangeRedisVersion>

src/Identity/Extensions.Core/src/UserManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,11 +1735,11 @@ public virtual async Task<bool> IsLockedOutAsync(TUser user)
17351735
}
17361736

17371737
/// <summary>
1738-
/// Sets a flag indicating whether the specified <paramref name="user"/> is locked out,
1738+
/// Sets a flag indicating whether the specified <paramref name="user"/> can be locked out,
17391739
/// as an asynchronous operation.
17401740
/// </summary>
17411741
/// <param name="user">The user whose locked out status should be set.</param>
1742-
/// <param name="enabled">Flag indicating whether the user is locked out or not.</param>
1742+
/// <param name="enabled">Flag indicating whether the user can be locked out or not.</param>
17431743
/// <returns>
17441744
/// The <see cref="Task"/> that represents the asynchronous operation, the <see cref="IdentityResult"/> of the operation
17451745
/// </returns>

src/OpenApi/src/Extensions/OpenApiServiceCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public static IServiceCollection AddOpenApi(this IServiceCollection services)
6464
private static IServiceCollection AddOpenApiCore(this IServiceCollection services, string documentName)
6565
{
6666
services.AddEndpointsApiExplorer();
67-
services.AddKeyedSingleton<OpenApiComponentService>(documentName);
67+
services.AddKeyedSingleton<OpenApiSchemaService>(documentName);
68+
services.AddKeyedSingleton<OpenApiSchemaStore>(documentName);
6869
services.AddKeyedSingleton<OpenApiDocumentService>(documentName);
6970
// Required for build-time generation
7071
services.AddSingleton<IDocumentProvider, OpenApiDocumentProvider>();

src/OpenApi/src/Schemas/OpenApiJsonSchema.Helpers.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ public static void ReadProperty(ref Utf8JsonReader reader, string propertyName,
265265
var props = ReadDictionary<OpenApiJsonSchema>(ref reader);
266266
schema.Properties = props?.ToDictionary(p => p.Key, p => p.Value.Schema);
267267
break;
268+
case OpenApiSchemaKeywords.AdditionalPropertiesKeyword:
269+
reader.Read();
270+
var additionalPropsConverter = (JsonConverter<OpenApiJsonSchema>)options.GetTypeInfo(typeof(OpenApiJsonSchema)).Converter;
271+
schema.AdditionalProperties = additionalPropsConverter.Read(ref reader, typeof(OpenApiJsonSchema), options)?.Schema;
272+
break;
268273
case OpenApiSchemaKeywords.AnyOfKeyword:
269274
reader.Read();
270275
schema.Type = "object";
@@ -284,6 +289,9 @@ public static void ReadProperty(ref Utf8JsonReader reader, string propertyName,
284289
var mappings = ReadDictionary<string>(ref reader);
285290
schema.Discriminator.Mapping = mappings;
286291
break;
292+
default:
293+
reader.Skip();
294+
break;
287295
}
288296
}
289297
}

src/OpenApi/src/Schemas/OpenApiSchemaKeywords.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal class OpenApiSchemaKeywords
77
public const string FormatKeyword = "format";
88
public const string ItemsKeyword = "items";
99
public const string PropertiesKeyword = "properties";
10+
public const string AdditionalPropertiesKeyword = "additionalProperties";
1011
public const string RequiredKeyword = "required";
1112
public const string AnyOfKeyword = "anyOf";
1213
public const string EnumKeyword = "enum";

src/OpenApi/src/Services/OpenApiDocumentService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal sealed class OpenApiDocumentService(
3030
IServiceProvider serviceProvider)
3131
{
3232
private readonly OpenApiOptions _options = optionsMonitor.Get(documentName);
33-
private readonly OpenApiComponentService _componentService = serviceProvider.GetRequiredKeyedService<OpenApiComponentService>(documentName);
33+
private readonly OpenApiSchemaService _componentService = serviceProvider.GetRequiredKeyedService<OpenApiSchemaService>(documentName);
3434
private readonly IOpenApiDocumentTransformer _scrubExtensionsTransformer = new ScrubExtensionsTransformer();
3535

3636
private static readonly OpenApiEncoding _defaultFormEncoding = new OpenApiEncoding { Style = ParameterStyle.Form, Explode = true };
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Reflection;
5+
6+
namespace Microsoft.AspNetCore.OpenApi;
7+
8+
/// <summary>
9+
/// Represents a unique identifier that is used to store and retrieve
10+
/// JSON schemas associated with a given property.
11+
/// </summary>
12+
internal record struct OpenApiSchemaKey(Type Type, ParameterInfo? ParameterInfo);

src/OpenApi/src/Services/OpenApiComponentService.cs renamed to src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Collections.Concurrent;
54
using System.ComponentModel.DataAnnotations;
65
using System.IO.Pipelines;
7-
using System.Reflection;
86
using System.Text.Json;
97
using System.Text.Json.Nodes;
108
using JsonSchemaMapper;
119
using Microsoft.AspNetCore.Http;
1210
using Microsoft.AspNetCore.Http.Json;
1311
using Microsoft.AspNetCore.Mvc.ApiExplorer;
1412
using Microsoft.AspNetCore.Mvc.Infrastructure;
13+
using Microsoft.Extensions.DependencyInjection;
1514
using Microsoft.Extensions.Options;
1615
using Microsoft.OpenApi.Models;
1716

@@ -22,21 +21,9 @@ namespace Microsoft.AspNetCore.OpenApi;
2221
/// an OpenAPI document. In particular, this is the API that is used to
2322
/// interact with the JSON schemas that are managed by a given OpenAPI document.
2423
/// </summary>
25-
internal sealed class OpenApiComponentService(IOptions<JsonOptions> jsonOptions)
24+
internal sealed class OpenApiSchemaService([ServiceKey] string documentName, IOptions<JsonOptions> jsonOptions, IServiceProvider serviceProvider)
2625
{
27-
private readonly ConcurrentDictionary<(Type, ParameterInfo?), JsonObject> _schemas = new()
28-
{
29-
// Pre-populate OpenAPI schemas for well-defined types in ASP.NET Core.
30-
[(typeof(IFormFile), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
31-
[(typeof(IFormFileCollection), null)] = new JsonObject
32-
{
33-
["type"] = "array",
34-
["items"] = new JsonObject { ["type"] = "string", ["format"] = "binary" }
35-
},
36-
[(typeof(Stream), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
37-
[(typeof(PipeReader), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
38-
};
39-
26+
private readonly OpenApiSchemaStore _schemaStore = serviceProvider.GetRequiredKeyedService<OpenApiSchemaStore>(documentName);
4027
private readonly JsonSerializerOptions _jsonSerializerOptions = jsonOptions.Value.SerializerOptions;
4128
private readonly JsonSchemaMapperConfiguration _configuration = new()
4229
{
@@ -74,8 +61,8 @@ internal OpenApiSchema GetOrCreateSchema(Type type, ApiParameterDescription? par
7461
{
7562
var key = parameterDescription?.ParameterDescriptor is IParameterInfoParameterDescriptor parameterInfoDescription
7663
&& parameterDescription.ModelMetadata.PropertyName is null
77-
? (type, parameterInfoDescription.ParameterInfo) : (type, null);
78-
var schemaAsJsonObject = _schemas.GetOrAdd(key, CreateSchema);
64+
? new OpenApiSchemaKey(type, parameterInfoDescription.ParameterInfo) : new OpenApiSchemaKey(type, null);
65+
var schemaAsJsonObject = _schemaStore.GetOrAdd(key, CreateSchema);
7966
if (parameterDescription is not null)
8067
{
8168
schemaAsJsonObject.ApplyParameterInfo(parameterDescription);
@@ -84,7 +71,7 @@ internal OpenApiSchema GetOrCreateSchema(Type type, ApiParameterDescription? par
8471
return deserializedSchema != null ? deserializedSchema.Schema : new OpenApiSchema();
8572
}
8673

87-
private JsonObject CreateSchema((Type Type, ParameterInfo? ParameterInfo) key)
74+
private JsonObject CreateSchema(OpenApiSchemaKey key)
8875
=> key.ParameterInfo is not null
8976
? JsonSchemaMapper.JsonSchemaMapper.GetJsonSchema(_jsonSerializerOptions, key.ParameterInfo, _configuration)
9077
: JsonSchemaMapper.JsonSchemaMapper.GetJsonSchema(_jsonSerializerOptions, key.Type, _configuration);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Collections.Concurrent;
5+
using System.IO.Pipelines;
6+
using System.Text.Json.Nodes;
7+
using Microsoft.AspNetCore.Http;
8+
9+
namespace Microsoft.AspNetCore.OpenApi;
10+
11+
/// <summary>
12+
/// Stores schemas generated by the JsonSchemaMapper for a
13+
/// given OpenAPI document for later resolution.
14+
/// </summary>
15+
internal sealed class OpenApiSchemaStore
16+
{
17+
private readonly ConcurrentDictionary<OpenApiSchemaKey, JsonObject> _schemas = new()
18+
{
19+
// Pre-populate OpenAPI schemas for well-defined types in ASP.NET Core.
20+
[new OpenApiSchemaKey(typeof(IFormFile), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
21+
[new OpenApiSchemaKey(typeof(IFormFileCollection), null)] = new JsonObject
22+
{
23+
["type"] = "array",
24+
["items"] = new JsonObject { ["type"] = "string", ["format"] = "binary" }
25+
},
26+
[new OpenApiSchemaKey(typeof(Stream), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
27+
[new OpenApiSchemaKey(typeof(PipeReader), null)] = new JsonObject { ["type"] = "string", ["format"] = "binary" },
28+
};
29+
30+
/// <summary>
31+
/// Resolves the JSON schema for the given type and parameter description.
32+
/// </summary>
33+
/// <param name="key">The key associated with the generated schema.</param>
34+
/// <param name="valueFactory">A function used to generated the JSON object representing the schema.</param>
35+
/// <returns>A <see cref="JsonObject" /> representing the JSON schema associated with the key.</returns>
36+
public JsonObject GetOrAdd(OpenApiSchemaKey key, Func<OpenApiSchemaKey, JsonObject> valueFactory)
37+
{
38+
return _schemas.GetOrAdd(key, valueFactory);
39+
}
40+
}

0 commit comments

Comments
 (0)