Skip to content

Commit

Permalink
Disable CS0618 warnings to ensure backward compatibility with old inh…
Browse files Browse the repository at this point in the history
…eritance attributes
  • Loading branch information
schnerring committed Jun 20, 2024
1 parent f82f591 commit 66cb005
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ private static IEnumerable<Type> AnnotationsSubTypesSelector(Type type)
}
#endif

#pragma warning disable CS0618 // Type or member is obsolete
var subTypeAttributes = type.GetCustomAttributes(false)
.OfType<SwaggerSubTypeAttribute>()
.ToArray();
#pragma warning restore CS0618 // Type or member is obsolete

if (subTypeAttributes.Any())
{
Expand Down Expand Up @@ -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<SwaggerDiscriminatorAttribute>()
.FirstOrDefault();
#pragma warning restore CS0618 // Type or member is obsolete

if (discriminatorAttribute != null)
{
Expand Down Expand Up @@ -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<SwaggerSubTypeAttribute>()
.FirstOrDefault(attr => attr.SubType == subType);
#pragma warning restore CS0618 // Type or member is obsolete

if (subTypeAttribute != null)
{
Expand Down

0 comments on commit 66cb005

Please sign in to comment.