Skip to content

fix: inconsistent visibility of properties in current keys class #2437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Microsoft.OpenApi/Services/OpenApiWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
_visitor.Visit(tags);

// Visit tags
if (tags != null)

Check warning on line 69 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
var tagsAsArray = tags.ToArray();
for (var i = 0; i < tagsAsArray.Length; i++)
Expand All @@ -89,7 +89,7 @@
_visitor.Visit(tags);

// Visit tags
if (tags != null)

Check warning on line 92 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
var referencesAsArray = tags.ToArray();
for (var i = 0; i < referencesAsArray.Length; i++)
Expand Down Expand Up @@ -127,7 +127,7 @@
/// <summary>
/// Visits <see cref="OpenApiComponents"/> and child objects
/// </summary>
internal void Walk(OpenApiComponents? components)

Check warning on line 130 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 52 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{
if (components == null)
{
Expand Down Expand Up @@ -262,7 +262,7 @@
_visitor.Visit(paths);

// Visit Paths
if (paths != null)

Check warning on line 265 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var pathItem in paths)
{
Expand All @@ -287,7 +287,7 @@
_visitor.Visit(webhooks);

// Visit Webhooks
if (webhooks != null)

Check warning on line 290 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var pathItem in webhooks)
{
Expand Down Expand Up @@ -459,7 +459,7 @@
return;
}

if (tag is IOpenApiReferenceHolder openApiReferenceHolder)

Check warning on line 462 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
Walk(openApiReferenceHolder);
}
Expand Down Expand Up @@ -492,7 +492,7 @@

_visitor.Visit(serverVariables);

if (serverVariables != null)

Check warning on line 495 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var variable in serverVariables)
{
Expand Down Expand Up @@ -568,7 +568,7 @@
}

_visitor.Visit(operations);
if (operations != null)

Check warning on line 571 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var operation in operations)
{
Expand Down Expand Up @@ -679,7 +679,7 @@

_visitor.Visit(responses);

if (responses != null)

Check warning on line 682 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var response in responses)
{
Expand Down Expand Up @@ -750,7 +750,7 @@
}

_visitor.Visit(headers);
if (headers != null)

Check warning on line 753 in src/Microsoft.OpenApi/Services/OpenApiWalker.cs

View workflow job for this annotation

GitHub Actions / Build

Change this condition so that it does not always evaluate to 'True'. (https://rules.sonarsource.com/csharp/RSPEC-2589)
{
foreach (var header in headers)
{
Expand Down Expand Up @@ -1279,32 +1279,32 @@
/// <summary>
/// Current Path key
/// </summary>
public string? Path { get; set; }
public string? Path { get; internal set; }

/// <summary>
/// Current Operation Type
/// </summary>
public HttpMethod? Operation { get; set; }
public HttpMethod? Operation { get; internal set; }

/// <summary>
/// Current Response Status Code
/// </summary>
public string? Response { get; set; }
public string? Response { get; internal set; }

/// <summary>
/// Current Content Media Type
/// </summary>
public string? Content { get; set; }
public string? Content { get; internal set; }

/// <summary>
/// Current Callback Key
/// </summary>
public string? Callback { get; set; }
public string? Callback { get; internal set; }

/// <summary>
/// Current Link Key
/// </summary>
public string? Link { get; set; }
public string? Link { get; internal set; }

/// <summary>
/// Current Header Key
Expand Down
12 changes: 6 additions & 6 deletions test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ namespace Microsoft.OpenApi
public class CurrentKeys
{
public CurrentKeys() { }
public string? Callback { get; set; }
public string? Content { get; set; }
public string? Callback { get; }
public string? Content { get; }
public string? Encoding { get; }
public string? Example { get; }
public string? Extension { get; }
public string? Header { get; }
public string? Link { get; set; }
public System.Net.Http.HttpMethod? Operation { get; set; }
public string? Path { get; set; }
public string? Response { get; set; }
public string? Link { get; }
public System.Net.Http.HttpMethod? Operation { get; }
public string? Path { get; }
public string? Response { get; }
public string? ServerVariable { get; }
}
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)]
Expand Down
Loading