Documentation
¶
Overview ¶
Package controller validates generated net/http controller metadata from the shared typed compiler program.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
PolicyID string
Module string
Authenticated bool
Position token.Position
PhysicalPosition token.Position
// contains filtered or unexported fields
}
Authorization is one validated deny-by-default policy attached to a generated HTTP route.
func (Authorization) AllRoles ¶
func (authorization Authorization) AllRoles() []string
AllRoles returns the sorted roles that are all required.
func (Authorization) AllScopes ¶
func (authorization Authorization) AllScopes() []string
AllScopes returns the sorted scopes that are all required.
func (Authorization) AnyRoles ¶
func (authorization Authorization) AnyRoles() []string
AnyRoles returns the sorted roles of which at least one is required.
func (Authorization) Expression ¶
func (authorization Authorization) Expression() string
Expression returns the compiler-validated restricted policy expression.
type Binding ¶
type Binding struct {
Index int
Field string
Name string
Location Location
Required bool
Kind ScalarKind
Type types.Type
TypeID string
Position token.Position
PhysicalPosition token.Position
}
Binding maps one request DTO field to an HTTP request location.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is the immutable-by-convention controller validation result.
func Build ¶
func Build( program *load.Program, resolution resolve.Result, providers provider.Catalog, modules modulith.Model, ) Catalog
Build validates controller and route declarations without reloading source, inspecting bodies, reflecting on runtime values, or invoking methods.
func (Catalog) Controllers ¶
func (c Catalog) Controllers() []Controller
Controllers returns controller records in stable symbol order.
func (Catalog) Diagnostics ¶
func (c Catalog) Diagnostics() []Diagnostic
Diagnostics returns deterministic controller diagnostics.
type Controller ¶
type Controller struct {
Symbol load.Symbol
SymbolID string
Name string
PackagePath string
Prefix string
Module string
ProviderID string
Position token.Position
PhysicalPosition token.Position
// contains filtered or unexported fields
}
Controller is one @Controller type and its stable routes.
func (Controller) Routes ¶
func (c Controller) Routes() []Route
Routes returns routes sorted by HTTP method, path, and symbol ID.
type Diagnostic ¶
type Diagnostic struct {
Position token.Position
PhysicalPosition token.Position
SymbolID string
Kind string
Message string
}
Diagnostic is one deterministic source-positioned controller failure.
func (Diagnostic) Error ¶
func (d Diagnostic) Error() string
Error renders a compiler-style diagnostic.
type Location ¶
type Location string
Location identifies one generated request DTO binding source.
const ( // Path binds an http.ServeMux path wildcard. Path Location = "path" // Query binds one URL query value. Query Location = "query" // Header binds one HTTP request header. Header Location = "header" // Body binds the strict JSON request body. Body Location = "body" // Form binds one URL-encoded form field. Form Location = "form" )
type Route ¶
type Route struct {
Symbol load.Symbol
SymbolID string
Name string
HTTPMethod string
Path string
Module string
ProviderID string
Receiver types.Type
Request types.Type
RequestTypeID string
Response types.Type
ResponseTypeID string
Raw bool
NoContent bool
View bool
ExecutorParameter bool
BindingResult bool
ViewRendererID string
ValidatorID string
Position token.Position
PhysicalPosition token.Position
// contains filtered or unexported fields
}
Route is one validated controller method and HTTP pattern.
func (Route) Authorization ¶
func (r Route) Authorization() (Authorization, bool)
Authorization returns immutable generated policy metadata when the route is explicitly protected.
type ScalarKind ¶
type ScalarKind string
ScalarKind identifies one generated path, query, or header conversion.
const ( // ScalarString identifies string data. ScalarString ScalarKind = "string" // ScalarBoolean identifies strconv-compatible Boolean data. ScalarBoolean ScalarKind = "boolean" // ScalarInteger identifies a signed integer. ScalarInteger ScalarKind = "integer" // ScalarDuration identifies time.Duration data. ScalarDuration ScalarKind = "duration" )