Add ApiController support

This commit is contained in:
Octokit
2022-06-03 20:12:45 +03:00
committed by Michael Nebel
parent c96b938e7d
commit fc10212e68

View File

@@ -69,11 +69,6 @@ class MicrosoftAspNetCoreMvcNonControllerAttribute extends MicrosoftAspNetCoreMv
}
}
/** A `Microsoft.AspNetCore.Mvc.Controller` attribute. */
class MicrosoftAspNetCoreMvcControllerAttribute extends MicrosoftAspNetCoreMvcAttribute {
MicrosoftAspNetCoreMvcControllerAttribute() { this.getType().hasName("ControllerAttribute") }
}
/** The `Microsoft.AspNetCore.Antiforgery` namespace. */
class MicrosoftAspNetCoreAntiforgeryNamespace extends Namespace {
MicrosoftAspNetCoreAntiforgeryNamespace() {
@@ -196,7 +191,7 @@ class MicrosoftAspNetCoreMvcControllerBaseClass extends Class {
/**
* A valid ASP.NET Core controller according to:
* https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-3.1
* https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-3.1
* https://github.com/dotnet/aspnetcore/blob/b3c93967ba508b8ef139add27132d9483c1a9eb4/src/Mvc/Mvc.Core/src/Controllers/ControllerFeatureProvider.cs#L39-L75
*/
class MicrosoftAspNetCoreMvcController extends Class {
@@ -212,9 +207,16 @@ class MicrosoftAspNetCoreMvcController extends Class {
not this.isAbstract() and
not this.containsTypeParameters() and
(
this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass or
this.getABaseType*().getName().matches("%Controller") or
this.getABaseType*().getAnAttribute() instanceof MicrosoftAspNetCoreMvcControllerAttribute
this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass
or
this.getABaseType*().getName().matches("%Controller")
or
this.getABaseType*()
.getAnAttribute()
.getType()
.getABaseType*()
// ApiControllerAttribute is derived from ControllerAttribute
.hasQualifiedName("Microsoft.AspNetCore.Mvc.ControllerAttribute")
) and
not this.getABaseType*().getAnAttribute() instanceof
MicrosoftAspNetCoreMvcNonControllerAttribute