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) {