Documentation
¶
Index ¶
- func BackendBindingsFromIR(ir gwdkir.Program) []source.BackendBinding
- func BindBackendHandlers(ir *gwdkir.Program) []source.BackendBinding
- func DiscoverGoEndpoints(ir *gwdkir.Program) error
- func ValidateBackendBindingPolicyIR(config gowdk.Config, ir gwdkir.Program) error
- func ValidateContractReferences(refs []gwdkir.ContractReference) error
- func ValidateProgram(config gowdk.Config, ir gwdkir.Program) error
- func ValidateSourceProgram(config gowdk.Config, ir gwdkir.Program) error
- type ContractEndpointBinding
- type EndpointBinding
- type EndpointKind
- type RouteBinding
- type RouteInfo
- type RouteKind
- type RouteMetadata
- type Severity
- type ValidationError
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackendBindingsFromIR ¶ added in v0.2.8
func BackendBindingsFromIR(ir gwdkir.Program) []source.BackendBinding
BackendBindingsFromIR derives the backend binding records already attached to the program's endpoints, without inspecting Go packages on disk. Callers that only need binding metadata for reporting (e.g. build reports) should use this instead of re-running handler discovery.
func BindBackendHandlers ¶ added in v0.1.5
func BindBackendHandlers(ir *gwdkir.Program) []source.BackendBinding
BindBackendHandlers discovers same-package Go handlers for act and api blocks, attaches the resulting binding metadata to the program's endpoints and page load bindings, and returns the full binding record list (sorted by source, kind, and block name) for reporting and public manifest JSON. Discovery is intentionally non-fatal: missing packages, missing functions, and unsupported signatures are reported as binding metadata so generated apps can emit clear 501 responses.
func DiscoverGoEndpoints ¶ added in v0.2.8
DiscoverGoEndpoints merges optional //gowdk:act and //gowdk:api comments from selected feature-package Go files into the program as standalone Go endpoints.
func ValidateBackendBindingPolicyIR ¶ added in v0.2.8
ValidateBackendBindingPolicyIR enforces build-mode rules for declared backend endpoints after same-package Go handler binding metadata has been produced. When the program carries no binding metadata but declares backend endpoints (callers that build straight from an unbound program), handlers are re-discovered from disk before the policy check.
func ValidateContractReferences ¶ added in v0.1.5
func ValidateContractReferences(refs []gwdkir.ContractReference) error
ValidateContractReferences converts linked contract-reference metadata into compiler diagnostics for CLI validation paths.
func ValidateProgram ¶ added in v0.2.8
ValidateProgram checks render-mode invariants that must hold before codegen. The validators read the compiler IR directly; there is no manifest intermediary on this path. It returns a non-nil error only when at least one error-severity diagnostic is present; warning-only programs return nil.
func ValidateSourceProgram ¶ added in v0.2.8
ValidateSourceProgram checks a program built from a single in-memory source buffer. Cross-file checks (use packages and component references resolved against the discovered project) are skipped because sibling files are not present in the program.
Types ¶
type ContractEndpointBinding ¶ added in v0.1.5
type ContractEndpointBinding struct {
Name string
Kind gwdkir.ContractKind
Status gwdkir.ContractBindingStatus
Message string
ImportAlias string
ImportPath string
Type string
Result string
Roles []string
Handler string
Register string
}
ContractEndpointBinding describes a command/query contract exposed through a generated backend endpoint.
type EndpointBinding ¶ added in v0.1.5
type EndpointBinding struct {
Kind EndpointKind
EndpointSource string
Source string
SourceSpan source.SourceSpan
Package string
PackagePath string
PackageName string
Symbol string
Method string
Route string
Cache string
Guards []string
CSRF bool
PageID string
Handler string
BindingStatus source.BackendBindingStatus
BindingMessage string
BindingImportPath string
BindingPackage string
BindingFunction string
BindingSignature source.BackendSignatureKind
BindingInputType string
Contract ContractEndpointBinding
}
EndpointBinding is backend action/API metadata. Endpoints are not route kinds; they hang off the generated app/runtime backend layer.
type EndpointKind ¶ added in v0.1.5
type EndpointKind string
EndpointKind describes backend endpoint behavior separate from page/file routes.
const ( EndpointAction EndpointKind = "action" EndpointAPI EndpointKind = "api" EndpointFragment EndpointKind = "fragment" EndpointCommand EndpointKind = "command" EndpointQuery EndpointKind = "query" )
type RouteBinding ¶ added in v0.1.5
type RouteBinding struct {
Kind RouteKind
Method string
Route string
PageID string
Package string
Render gowdk.RenderMode
Cache string
DynamicParams []string
RouteParams []source.RouteParam
Layouts []string
Guards []string
Source string
SourceSpan source.SourceSpan
Handler string
}
RouteBinding is route-level metadata. Route kinds are intentionally limited to static files, SPA routes, SSR routes, and hybrid routes.
type RouteInfo ¶ added in v0.1.5
RouteInfo is non-fatal route metadata surfaced by CLI inspection commands.
type RouteKind ¶ added in v0.1.5
type RouteKind string
RouteKind describes route behavior in the CLI routes report.
type RouteMetadata ¶ added in v0.1.5
type RouteMetadata struct {
Routes []RouteBinding
Endpoints []EndpointBinding
Info []RouteInfo
}
RouteMetadata is route and endpoint metadata used by the CLI routes report.
func BuildRouteMetadataFromIR ¶ added in v0.1.5
func BuildRouteMetadataFromIR(config gowdk.Config, ir gwdkir.Program) RouteMetadata
BuildRouteMetadataFromIR converts stable compiler IR into CLI route and endpoint metadata.
type Severity ¶ added in v0.3.0
type Severity int
Severity classifies a diagnostic as a hard error or a non-fatal warning.
type ValidationError ¶
type ValidationError struct {
Code string
PageID string
ComponentName string
Source string
Span source.SourceSpan
// Related carries secondary source locations, such as the first declaration
// that a conflict diagnostic also points at. It is optional and additive.
Related []source.RelatedSpan
Message string
Severity Severity
}
func ValidatePage ¶
func ValidatePage(config gowdk.Config, page gwdkir.Page) []ValidationError
func (ValidationError) Error ¶
func (err ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []ValidationError
func ValidateProgramReport ¶ added in v0.3.0
func ValidateProgramReport(config gowdk.Config, ir gwdkir.Program) ValidationErrors
ValidateProgramReport returns every diagnostic, including warnings, so the caller can surface warnings while still gating the build on HasErrors.
func ValidateSourceProgramReport ¶ added in v0.3.0
func ValidateSourceProgramReport(config gowdk.Config, ir gwdkir.Program) ValidationErrors
ValidateSourceProgramReport is the single-source counterpart to ValidateProgramReport.
func (ValidationErrors) Error ¶
func (errs ValidationErrors) Error() string
func (ValidationErrors) HasErrors ¶ added in v0.3.0
func (errs ValidationErrors) HasErrors() bool
HasErrors reports whether any diagnostic is error severity. Warning-only reports return false so the build proceeds.
func (ValidationErrors) Warnings ¶ added in v0.3.0
func (errs ValidationErrors) Warnings() ValidationErrors
Warnings returns only the warning-severity diagnostics.
Source Files
¶
- backend_binding_policy.go
- backend_binding_types.go
- backend_bindings.go
- backend_inline_signatures.go
- backend_input_fields.go
- backend_package_inspection.go
- backend_typed_signatures.go
- go_endpoints.go
- route_bindings.go
- routes.go
- validate.go
- validate_assets.go
- validate_component_client.go
- validate_component_contracts.go
- validate_component_fingerprint.go
- validate_component_lists.go
- validate_component_view.go
- validate_component_view_contract.go
- validate_contract_refs.go
- validate_errors.go
- validate_identity.go
- validate_packages.go
- validate_page.go
- validate_scripts.go
- validate_source_uses.go
- validate_spans.go
- validate_stores.go