class

Noir::CSharpAttributeRoutes

Inherits Reference < Object

Route templates and HTTP verbs that a project's own attribute classes contribute, read from the attribute's definition instead of from a name:

[V3ApiController("series")] -> api/v3/series [RestGetById] -> GET {id:int} [RestPutById] -> PUT {id:int?}

An attribute is followed through its constructor (: base(3, resource)), the Template it assigns or returns ($"api/v{version}/{resource}"), the HttpMethods it lists and the built-in Http<Verb>Attribute / Route it derives, with the usage's arguments bound to the constructor parameters. Pure text in, no file access: the caller hands it lexed files.

Constants

BUILTIN_VERBS = {"HttpGet" => "GET", "HttpPost" => "POST", "HttpPut" => "PUT", "HttpDelete" => "DELETE", "HttpPatch" => "PATCH", "HttpHead" => "HEAD", "HttpOptions" => "OPTIONS"}
LITERAL_WORD_RE = /"(\w+)"/
MAX_DEPTH = 6
PROVIDERS = {"IRouteTemplateProvider", "IActionHttpMethodProvider"}
TEMPLATE_ASSIGN_RE = /\bTemplate\s*=(?![=>])\s*([^;]+);/

Template = $"api/{x}"; in a constructor body.

Constructors

Instance methods

add(lexer : CSharpLexer, type : CSharpType, scope : String = "") : Nil

Records type when it is an attribute class (FooAttribute).

Source
empty?
Source
resolve(attribute : CSharpDecl::Attribute, scope : String = "") : Result | Nil

What the usage attribute means. scope is the project of the file using it: a name two projects both define resolves to the one in the usage's own project, and to nothing when that does not settle it.

Source
route_names

Names of the recorded attributes whose definition reaches a route or verb provider; what one means at a usage (a prefix, a verb, nothing readable) is up to resolve.

Source

Nested types