From 66cb0057706bc7a32fd87e2d2e2ab0841ddbed4c Mon Sep 17 00:00:00 2001 From: Michael Schnerring <3743342+schnerring@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:47:49 +0200 Subject: [PATCH] Disable CS0618 warnings to ensure backward compatibility with old inheritance attributes --- .../AnnotationsSwaggerGenOptionsExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Swashbuckle.AspNetCore.Annotations/AnnotationsSwaggerGenOptionsExtensions.cs b/src/Swashbuckle.AspNetCore.Annotations/AnnotationsSwaggerGenOptionsExtensions.cs index e73a195aba..b92bb60726 100644 --- a/src/Swashbuckle.AspNetCore.Annotations/AnnotationsSwaggerGenOptionsExtensions.cs +++ b/src/Swashbuckle.AspNetCore.Annotations/AnnotationsSwaggerGenOptionsExtensions.cs @@ -68,9 +68,11 @@ private static IEnumerable AnnotationsSubTypesSelector(Type type) } #endif +#pragma warning disable CS0618 // Type or member is obsolete var subTypeAttributes = type.GetCustomAttributes(false) .OfType() .ToArray(); +#pragma warning restore CS0618 // Type or member is obsolete if (subTypeAttributes.Any()) { @@ -104,9 +106,11 @@ private static string AnnotationsDiscriminatorNameSelector(Type baseType) } #endif +#pragma warning disable CS0618 // Type or member is obsolete var discriminatorAttribute = baseType.GetCustomAttributes(false) .OfType() .FirstOrDefault(); +#pragma warning restore CS0618 // Type or member is obsolete if (discriminatorAttribute != null) { @@ -143,9 +147,11 @@ private static string AnnotationsDiscriminatorValueSelector(Type subType) } #endif +#pragma warning disable CS0618 // Type or member is obsolete var subTypeAttribute = subType.BaseType.GetCustomAttributes(false) .OfType() .FirstOrDefault(attr => attr.SubType == subType); +#pragma warning restore CS0618 // Type or member is obsolete if (subTypeAttribute != null) {