Skip to content
Prev Previous commit
Next Next commit
style(library): move conditional compilation directives above namespa…
…ce and rename V3_0 to V30

Agent-Logs-Url: https://github.com/microsoft/OpenAPI.NET/sessions/0fac65d3-0bbb-44db-b82e-7648c8fb8f86

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
  • Loading branch information
Copilot and baywet authored Apr 17, 2026
commit c46f13c58bffe75669312565feb808787fc5572c
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Attributes/ExperimentalAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Polyfill for ExperimentalAttribute which is only available in .NET 8+.
// Since the compiler queries for this attribute by name, having it source-included
// is sufficient for the compiler to recognize it.
#if !NET8_0_OR_GREATER
namespace System.Diagnostics.CodeAnalysis
{
#if !NET8_0_OR_GREATER
/// <summary>
/// Indicates that an API is experimental and it may change in the future.
/// </summary>
Expand Down Expand Up @@ -42,5 +42,5 @@ public ExperimentalAttribute(string diagnosticId)
/// </summary>
public string? UrlFormat { get; set; }
}
#endif
}
#endif
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Services/OpenApiPathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
[OpenApiSpecVersion.OpenApi3_0] =
[
new V3_0UnsupportedPathPolicy(),
new V30UnsupportedPathPolicy(),
],
};

Expand Down Expand Up @@ -242,7 +242,7 @@
/// Returns null for paths that have no equivalent in OpenAPI v3.0.
/// Covers: webhooks (added in v3.1).
/// </summary>
internal sealed class V3_0UnsupportedPathPolicy : IOpenApiPathRepresentationPolicy
internal sealed class V30UnsupportedPathPolicy : IOpenApiPathRepresentationPolicy
{
public bool TryGetVersionedPath(string[] segments, out string? result)
{
Expand Down Expand Up @@ -304,7 +304,7 @@
string.Equals(segments[i - 2], OpenApiConstants.Responses, StringComparison.Ordinal) &&
i + 1 < segments.Length)
{
i++; // skip mediaType too

Check warning on line 307 in src/Microsoft.OpenApi/Services/OpenApiPathHelper.cs

View workflow job for this annotation

GitHub Actions / Build

Do not update the stop condition variable 'i' in the body of the for loop.

Check warning on line 307 in src/Microsoft.OpenApi/Services/OpenApiPathHelper.cs

View workflow job for this annotation

GitHub Actions / Build

Do not update the stop condition variable 'i' in the body of the for loop.

Check warning on line 307 in src/Microsoft.OpenApi/Services/OpenApiPathHelper.cs

View workflow job for this annotation

GitHub Actions / Build

Do not update the stop condition variable 'i' in the body of the for loop.

Check warning on line 307 in src/Microsoft.OpenApi/Services/OpenApiPathHelper.cs

View workflow job for this annotation

GitHub Actions / Build

Do not update the stop condition variable 'i' in the body of the for loop.
continue;
}

Expand Down
Loading