Skip to content

Commit 1d09b16

Browse files
Merge pull request #1747 from microsoft/vnext
Release libs
2 parents e222e36 + 9406dad commit 1d09b16

37 files changed

+733
-55
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,14 @@ csharp_preserve_single_line_blocks = true
121121
[*.vb]
122122
# Modifier preferences
123123
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
124+
125+
126+
# Verify settings
127+
[*.{received,verified}.{txt,xml,json}]
128+
charset = "utf-8-bom"
129+
end_of_line = lf
130+
indent_size = unset
131+
indent_style = unset
132+
insert_final_newline = false
133+
tab_width = unset
134+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
*.PDF diff=astextplain
1616
*.rtf diff=astextplain
1717
*.RTF diff=astextplain
18+
19+
# VerifyTests
20+
*.verified.txt text eol=lf working-tree-encoding=UTF-8

.github/workflows/auto-merge-dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Dependabot metadata
2121
id: metadata
22-
uses: dependabot/fetch-metadata@v2.1.0
22+
uses: dependabot/fetch-metadata@v2.2.0
2323
with:
2424
github-token: "${{ secrets.GITHUB_TOKEN }}"
2525

.github/workflows/docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Check out the repo
1818
uses: actions/checkout@v4
1919
- name: Login to GitHub package feed
20-
uses: docker/login-action@v3.2.0
20+
uses: docker/login-action@v3.3.0
2121
with:
2222
username: ${{ secrets.ACR_USERNAME }}
2323
password: ${{ secrets.ACR_PASSWORD }}
@@ -30,13 +30,13 @@ jobs:
3030
id: getversion
3131
- name: Push to GitHub Packages - Nightly
3232
if: ${{ github.ref == 'refs/heads/vnext' }}
33-
uses: docker/build-push-action@v6.1.0
33+
uses: docker/build-push-action@v6.5.0
3434
with:
3535
push: true
3636
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
3737
- name: Push to GitHub Packages - Release
3838
if: ${{ github.ref == 'refs/heads/master' }}
39-
uses: docker/build-push-action@v6.1.0
39+
uses: docker/build-push-action@v6.5.0
4040
with:
4141
push: true
4242
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

Microsoft.OpenApi.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Hidi", "s
3030
EndProject
3131
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{D8F799DD-04AC-4A13-B344-45A5B944450A}"
3232
EndProject
33+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Trimming.Tests", "test\Microsoft.OpenApi.Trimming.Tests\Microsoft.OpenApi.Trimming.Tests.csproj", "{1D2E0C6E-B103-4CB6-912E-D56FA1501296}"
34+
EndProject
3335
Global
3436
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3537
Debug|Any CPU = Debug|Any CPU
@@ -68,6 +70,10 @@ Global
6870
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Debug|Any CPU.Build.0 = Debug|Any CPU
6971
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Release|Any CPU.ActiveCfg = Release|Any CPU
7072
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74+
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.Build.0 = Debug|Any CPU
75+
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Release|Any CPU.Build.0 = Release|Any CPU
7177
EndGlobalSection
7278
GlobalSection(SolutionProperties) = preSolution
7379
HideSolutionNode = FALSE
@@ -81,6 +87,7 @@ Global
8187
{AD79B61D-88CF-497C-9ED5-41AE3867C5AC} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
8288
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1}
8389
{D8F799DD-04AC-4A13-B344-45A5B944450A} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
90+
{1D2E0C6E-B103-4CB6-912E-D56FA1501296} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
8491
EndGlobalSection
8592
GlobalSection(ExtensibilityGlobals) = postSolution
8693
SolutionGuid = {9F171EFC-0DB5-4B10-ABFA-AF48D52CC565}

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ In order to test the validity of an OpenApi document, we avail the following too
113113

114114
5. Copy and paste your OpenAPI descriptions in the **Input Content** window or paste the path to the descriptions file in the **Input File** textbox and click on `Convert` to render the results.
115115

116-
# Build Status
117-
118-
|**master**|
119-
|--|
120-
|[![Build status](https://ci.appveyor.com/api/projects/status/9l6hly3vjeu0tmtx/branch/master?svg=true)](https://ci.appveyor.com/project/MicrosoftOpenAPINETAdmin/openapi-net-54e7i/branch/master)|
121-
122116
# Contributing
123117

124118
This project welcomes contributions and suggestions. Most contributions require you to agree to a

src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>1.6.15</Version>
6+
<Version>1.6.16</Version>
77
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
88
<SignAssembly>true</SignAssembly>
99
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->

src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.IO;
6+
using System.Text;
67
using System.Threading;
78
using System.Threading.Tasks;
89
using Microsoft.OpenApi.Interfaces;
@@ -41,7 +42,7 @@ public OpenApiStreamReader(OpenApiReaderSettings settings = null)
4142
/// <returns>Instance of newly created OpenApiDocument.</returns>
4243
public OpenApiDocument Read(Stream input, out OpenApiDiagnostic diagnostic)
4344
{
44-
using var reader = new StreamReader(input, default, true, -1, _settings.LeaveStreamOpen);
45+
using var reader = new StreamReader(input, Encoding.UTF8, true, 4096, _settings.LeaveStreamOpen);
4546
return new OpenApiTextReaderReader(_settings).Read(reader, out diagnostic);
4647
}
4748

@@ -54,6 +55,7 @@ public OpenApiDocument Read(Stream input, out OpenApiDiagnostic diagnostic)
5455
public async Task<ReadResult> ReadAsync(Stream input, CancellationToken cancellationToken = default)
5556
{
5657
MemoryStream bufferedStream;
58+
int bufferSize = 4096;
5759
if (input is MemoryStream stream)
5860
{
5961
bufferedStream = stream;
@@ -63,11 +65,12 @@ public async Task<ReadResult> ReadAsync(Stream input, CancellationToken cancella
6365
// Buffer stream so that OpenApiTextReaderReader can process it synchronously
6466
// YamlDocument doesn't support async reading.
6567
bufferedStream = new();
66-
await input.CopyToAsync(bufferedStream, 81920, cancellationToken);
68+
bufferSize = 81920;
69+
await input.CopyToAsync(bufferedStream, bufferSize, cancellationToken);
6770
bufferedStream.Position = 0;
6871
}
6972

70-
using var reader = new StreamReader(bufferedStream, default, true, -1, _settings.LeaveStreamOpen);
73+
using var reader = new StreamReader(bufferedStream, Encoding.UTF8, true, bufferSize, _settings.LeaveStreamOpen);
7174
return await new OpenApiTextReaderReader(_settings).ReadAsync(reader, cancellationToken);
7275
}
7376

@@ -80,7 +83,7 @@ public async Task<ReadResult> ReadAsync(Stream input, CancellationToken cancella
8083
/// <returns>Instance of newly created OpenApiDocument</returns>
8184
public T ReadFragment<T>(Stream input, OpenApiSpecVersion version, out OpenApiDiagnostic diagnostic) where T : IOpenApiReferenceable
8285
{
83-
using var reader = new StreamReader(input, default, true, -1, _settings.LeaveStreamOpen);
86+
using var reader = new StreamReader(input, Encoding.UTF8, true, 4096, _settings.LeaveStreamOpen);
8487
return new OpenApiTextReaderReader(_settings).ReadFragment<T>(reader, version, out diagnostic);
8588
}
8689
}

src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.6" />
12+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.7" />
1313
</ItemGroup>
1414
<ItemGroup>
1515
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />

src/Microsoft.OpenApi/Any/OpenApiAnyCloneHelper.cs

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

4-
using System.Reflection;
4+
using System;
5+
using System.Diagnostics.CodeAnalysis;
56

67
namespace Microsoft.OpenApi.Any
78
{
@@ -15,6 +16,8 @@ public class OpenApiAnyCloneHelper
1516
/// </summary>
1617
/// <param name="obj">The object instance.</param>
1718
/// <returns>A clone copy or the object itself.</returns>
19+
[Obsolete("Use native AoT-friendly generic overload of CloneFromCopyConstructor instead.")]
20+
[RequiresUnreferencedCode("CloneFromCopyConstructor is not trim-compatible. Recommended to use native AoT-friendly type-specific overloads of CloneFromCopyConstructor instead.")]
1821
public static IOpenApiAny CloneFromCopyConstructor(IOpenApiAny obj)
1922
{
2023
if (obj != null)
@@ -32,5 +35,27 @@ public static IOpenApiAny CloneFromCopyConstructor(IOpenApiAny obj)
3235

3336
return obj;
3437
}
38+
39+
/// <summary>
40+
/// Clones an instance of <see cref="IOpenApiAny"/> object from the copy constructor
41+
/// </summary>
42+
/// <param name="obj">The object instance.</param>
43+
/// <returns>A clone copy or the object itself.</returns>
44+
public static T CloneFromCopyConstructor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(T obj) where T : IOpenApiAny
45+
{
46+
if (obj != null)
47+
{
48+
foreach (var ci in typeof(T).GetConstructors())
49+
{
50+
var pi = ci.GetParameters();
51+
if (pi.Length == 1 && pi[0].ParameterType == typeof(T))
52+
{
53+
return (T)ci.Invoke([obj]);
54+
}
55+
}
56+
}
57+
58+
return obj;
59+
}
3560
}
3661
}

0 commit comments

Comments
 (0)