diff --git a/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs b/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs index c3edebe1b..c3cb9b256 100644 --- a/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs +++ b/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.ComponentModel; using System.IO; using System.Threading.Tasks; using Microsoft.OpenApi.Models; @@ -20,14 +19,5 @@ public interface IStreamLoader /// Identifier of some source of an OpenAPI Description /// A data object that can be processed by a reader to generate an Task LoadAsync(Uri uri); - - /// - /// Use Uri to locate data and convert into an input object. - /// - /// - /// - [Obsolete("Use the Async overload")] - [EditorBrowsable(EditorBrowsableState.Never)] - Stream Load(Uri uri); } } diff --git a/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs b/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs index 746ca0c96..bb230c4a9 100644 --- a/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs +++ b/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.ComponentModel; using System.IO; using System.Net.Http; using System.Threading.Tasks; @@ -17,7 +16,7 @@ namespace Microsoft.OpenApi.Reader.Services public class DefaultStreamLoader : IStreamLoader { private readonly Uri baseUrl; - private HttpClient _httpClient = new(); + private readonly HttpClient _httpClient = new(); /// /// The default stream loader @@ -27,16 +26,6 @@ public DefaultStreamLoader(Uri baseUrl) { this.baseUrl = baseUrl; } -/// - - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public Stream Load(Uri uri) - { -#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits - return LoadAsync(uri).GetAwaiter().GetResult(); -#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits - } /// /// Use Uri to locate data and convert into an input object. diff --git a/src/Microsoft.OpenApi/Validations/ValidationRule.cs b/src/Microsoft.OpenApi/Validations/ValidationRule.cs index bccb28be6..35503606f 100644 --- a/src/Microsoft.OpenApi/Validations/ValidationRule.cs +++ b/src/Microsoft.OpenApi/Validations/ValidationRule.cs @@ -44,16 +44,6 @@ public class ValidationRule : ValidationRule { private readonly Action _validate; - /// - /// Initializes a new instance of the class. - /// - /// Action to perform the validation. - [Obsolete("Please use the other constructor and specify a name")] - public ValidationRule(Action validate) - : this (Guid.NewGuid().ToString("D"), validate) - { - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index c647436ea..f05fd13a7 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -5,63 +5,13 @@ namespace Microsoft.OpenApi.Writers { - /// - /// Indicates if and when the writer should convert references into complete object renderings - /// - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public enum ReferenceInlineSetting - { - /// - /// Render all references as $ref. - /// - DoNotInlineReferences, - /// - /// Render all local references as inline objects - /// - InlineLocalReferences, - /// - /// Render all references as inline objects. - /// - InlineAllReferences - } - /// /// Configuration settings to control how OpenAPI documents are written /// public class OpenApiWriterSettings { - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - private ReferenceInlineSetting referenceInline = ReferenceInlineSetting.DoNotInlineReferences; - internal LoopDetector LoopDetector { get; } = new(); /// - /// Indicates how references in the source document should be handled. - /// - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public ReferenceInlineSetting ReferenceInline - { - get { return referenceInline; } - set - { - referenceInline = value; - switch (referenceInline) - { - case ReferenceInlineSetting.DoNotInlineReferences: - InlineLocalReferences = false; - InlineExternalReferences = false; - break; - case ReferenceInlineSetting.InlineLocalReferences: - InlineLocalReferences = true; - InlineExternalReferences = false; - break; - case ReferenceInlineSetting.InlineAllReferences: - InlineLocalReferences = true; - InlineExternalReferences = true; - break; - } - } - } - /// /// Indicates if local references should be rendered as an inline object /// public bool InlineLocalReferences { get; set; } diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 642dd0b82..1b8857c0f 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -237,8 +237,6 @@ namespace Microsoft.OpenApi.Interfaces } public interface IStreamLoader { - [System.Obsolete("Use the Async overload")] - System.IO.Stream Load(System.Uri uri); System.Threading.Tasks.Task LoadAsync(System.Uri uri); } } @@ -1401,8 +1399,6 @@ namespace Microsoft.OpenApi.Reader.Services public class DefaultStreamLoader : Microsoft.OpenApi.Interfaces.IStreamLoader { public DefaultStreamLoader(System.Uri baseUrl) { } - [System.Obsolete] - public System.IO.Stream Load(System.Uri uri) { } public System.Threading.Tasks.Task LoadAsync(System.Uri uri) { } } } @@ -1653,8 +1649,6 @@ namespace Microsoft.OpenApi.Validations } public class ValidationRule : Microsoft.OpenApi.Validations.ValidationRule { - [System.Obsolete("Please use the other constructor and specify a name")] - public ValidationRule(System.Action validate) { } public ValidationRule(string name, System.Action validate) { } } } @@ -1876,8 +1870,6 @@ namespace Microsoft.OpenApi.Writers public OpenApiWriterSettings() { } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } - [System.Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public Microsoft.OpenApi.Writers.ReferenceInlineSetting ReferenceInline { get; set; } } public class OpenApiYamlWriter : Microsoft.OpenApi.Writers.OpenApiWriterBase { @@ -1895,13 +1887,6 @@ namespace Microsoft.OpenApi.Writers public override void WriteValue(string value) { } protected override void WriteValueSeparator() { } } - [System.Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public enum ReferenceInlineSetting - { - DoNotInlineReferences = 0, - InlineLocalReferences = 1, - InlineAllReferences = 2, - } public sealed class Scope { public Scope(Microsoft.OpenApi.Writers.ScopeType type) { }