GX4008: signal-bound fields need rules or gx.Unchecked
An action input reads a signal and has no rules.
Cause
An action input reads a signal and has no rules. The browser controls each signal value, so the server must check it.
Example
package cart
import "app/cart/route"
signals {
Qty int = 1
}
<button on:click={route.Add{}}>Add</button>package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `POST /cart/add`
Qty int `signal:"qty"`
}gx check reports:
cart/route/route.go:5:6: GX4008: action "Add" has signal-bound fields; add Rules() or embed gx.UncheckedFix
- Add a
Rulesmethod with a rule for each signal field. - Or embed
gx.Uncheckedin the input type when the value needs no check.