Skip to content

Commit d49ea64

Browse files
Copilotbaywet
andcommitted
ci: switches to public API analyzer
* Initial plan * Convert PublicApi.approved.txt to PublicApiAnalyzers format - Converted test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt (2152 lines) to src/Microsoft.OpenApi/PublicAPI.Shipped.txt (1844 entries) - Generated PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt files for both Microsoft.OpenApi and Microsoft.OpenApi.YamlReader projects - Added Microsoft.CodeAnalysis.PublicApiAnalyzers package reference in Directory.Build.props The conversion extracted 1843 public API declarations from the PublicApiGenerator format and converted them to the Microsoft.CodeAnalysis.PublicApiAnalyzers format: - Types (classes, interfaces, structs, enums, delegates) - Constructors - Methods - Properties (with get/set accessors) - Fields (including const fields) - Events - Enum values with their numeric assignments Note: Build validation and potential missing API entries will need to be addressed in follow-up work as the PublicApiAnalyzers may identify additional public APIs not captured in the original PublicApiGenerator output. * Populate PublicAPI.Shipped.txt for Microsoft.OpenApi project Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Remove backup files * Fix PublicAPI.Unshipped.txt for Microsoft.OpenApi.YamlReader - Generated public API using PublicApiGenerator for Microsoft.OpenApi.YamlReader assembly - Converted to PublicApiAnalyzers format and added to PublicAPI.Unshipped.txt - Made static ReadFragment<T>(JsonNode...) method internal to resolve RS0016 and RS0026 analyzer errors - Resolved RS0016/RS0017 analyzer errors for YamlReader project - Note: RS0036 nullability annotation warnings remain but are separate from PublicAPI format issues Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * chore: removes old unit test based public API validation Signed-off-by: Vincent Biret <vibiret@microsoft.com> * chore: reverts copilot hallucination Signed-off-by: Vincent Biret <vibiret@microsoft.com> * chore: moves the analyzer to library projects only * chore: refreshes API export Signed-off-by: Vincent Biret <vibiret@microsoft.com> --------- Signed-off-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com>
1 parent 24deed8 commit d49ea64

File tree

9 files changed

+1920
-2084
lines changed

9 files changed

+1920
-2084
lines changed

src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828

2929
<ItemGroup>
3030

31+
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4">
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
<PrivateAssets>all</PrivateAssets>
34+
</PackageReference>
35+
3136
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15">
3237
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3338
<PrivateAssets>all</PrivateAssets>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#nullable enable
2+
Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions
3+
Microsoft.OpenApi.YamlReader.OpenApiYamlReader
4+
Microsoft.OpenApi.YamlReader.OpenApiYamlReader.OpenApiYamlReader() -> void
5+
Microsoft.OpenApi.YamlReader.OpenApiYamlReader.Read(System.IO.MemoryStream! input, System.Uri! location, Microsoft.OpenApi.Reader.OpenApiReaderSettings! settings) -> Microsoft.OpenApi.Reader.ReadResult!
6+
Microsoft.OpenApi.YamlReader.OpenApiYamlReader.ReadAsync(System.IO.Stream! input, System.Uri! location, Microsoft.OpenApi.Reader.OpenApiReaderSettings! settings, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<Microsoft.OpenApi.Reader.ReadResult!>!
7+
Microsoft.OpenApi.YamlReader.OpenApiYamlReader.ReadFragment<T>(System.IO.MemoryStream! input, Microsoft.OpenApi.OpenApiSpecVersion version, Microsoft.OpenApi.OpenApiDocument! openApiDocument, out Microsoft.OpenApi.Reader.OpenApiDiagnostic! diagnostic, Microsoft.OpenApi.Reader.OpenApiReaderSettings? settings = null) -> T?
8+
Microsoft.OpenApi.YamlReader.YamlConverter
9+
static Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions.AddYamlReader(this Microsoft.OpenApi.Reader.OpenApiReaderSettings! settings) -> void
10+
static Microsoft.OpenApi.YamlReader.OpenApiYamlReader.Read(System.Text.Json.Nodes.JsonNode! jsonNode, System.Uri! location, Microsoft.OpenApi.Reader.OpenApiReaderSettings! settings) -> Microsoft.OpenApi.Reader.ReadResult!
11+
static Microsoft.OpenApi.YamlReader.OpenApiYamlReader.ReadFragment<T>(System.Text.Json.Nodes.JsonNode! input, Microsoft.OpenApi.OpenApiSpecVersion version, Microsoft.OpenApi.OpenApiDocument! openApiDocument, out Microsoft.OpenApi.Reader.OpenApiDiagnostic! diagnostic, Microsoft.OpenApi.Reader.OpenApiReaderSettings? settings = null) -> T?
12+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToJsonArray(this SharpYaml.Serialization.YamlSequenceNode! yaml) -> System.Text.Json.Nodes.JsonArray!
13+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToJsonNode(this SharpYaml.Serialization.YamlDocument! yaml) -> System.Text.Json.Nodes.JsonNode!
14+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToJsonNode(this SharpYaml.Serialization.YamlNode! yaml) -> System.Text.Json.Nodes.JsonNode!
15+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToJsonNode(this SharpYaml.Serialization.YamlStream! yaml) -> System.Collections.Generic.IEnumerable<System.Text.Json.Nodes.JsonNode!>!
16+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToJsonObject(this SharpYaml.Serialization.YamlMappingNode! yaml) -> System.Text.Json.Nodes.JsonObject!
17+
static Microsoft.OpenApi.YamlReader.YamlConverter.ToYamlNode(this System.Text.Json.Nodes.JsonNode! json) -> SharpYaml.Serialization.YamlNode!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#nullable enable

src/Microsoft.OpenApi/Microsoft.OpenApi.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2525
</PropertyGroup>
2626
<ItemGroup>
27+
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4">
28+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
29+
<PrivateAssets>all</PrivateAssets>
30+
</PackageReference>
2731
<PackageReference Include="System.Text.Json" Version="[8.0.5,)" />
2832
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-hh2w-p6rv-4g7w" />
2933
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-8g4q-xg66-9fp4" />

src/Microsoft.OpenApi/PublicAPI.Shipped.txt

Lines changed: 1892 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#nullable enable

test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<PackageReference Include="xunit" Version="2.9.3" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" PrivateAssets="all" />
2020
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
21-
<PackageReference Include="PublicApiGenerator" Version="11.5.0" />
2221
</ItemGroup>
2322

2423
<ItemGroup>

test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt

Lines changed: 0 additions & 2027 deletions
This file was deleted.

test/Microsoft.OpenApi.Tests/PublicApi/PublicApiTests.cs

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)