feat/path conversions by baywet · Pull Request #2827 · microsoft/OpenAPI.NET · GitHub
Skip to content
Draft
138 changes: 138 additions & 0 deletions docs/experimental-apis.md
46 changes: 46 additions & 0 deletions src/Microsoft.OpenApi/Attributes/ExperimentalAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

// 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
{
/// <summary>
/// Indicates that an API is experimental and it may change in the future.
/// </summary>
/// <remarks>
/// This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental
/// feature is used. Authors can use this attribute to ship preview features in their assemblies.
/// </remarks>
[AttributeUsage(
AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property |
AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate,
Inherited = false)]
internal sealed class ExperimentalAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class,
/// specifying the ID that the compiler will use when reporting a use of the API.
/// </summary>
/// <param name="diagnosticId">The ID that the compiler will use when reporting a use of the API.</param>
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}

/// <summary>
/// Gets the ID that the compiler will use when reporting a use of the API.
/// </summary>
public string DiagnosticId { get; }

/// <summary>
/// Gets or sets the URL for corresponding documentation.
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
/// </summary>
public string? UrlFormat { get; set; }
}
}
#endif
3 changes: 3 additions & 0 deletions src/Microsoft.OpenApi/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#nullable enable
Microsoft.OpenApi.OpenApiPathHelper
static Microsoft.OpenApi.OpenApiPathHelper.GetVersionedPath(string! path, Microsoft.OpenApi.OpenApiSpecVersion targetVersion) -> string?
Microsoft.OpenApi.OpenApiValidatorError.GetVersionedPointer(Microsoft.OpenApi.OpenApiSpecVersion targetVersion) -> string?
Loading
Loading