Validation Plugin#
A Lesstruct plugin that validates content before it is saved by rejecting empty titles.
Prerequisites#
- TinyGo 0.28+
Build#
| |
Install#
Copy the compiled WASM file to the Lesstruct plugins directory:
| |
Expected Behavior#
When content is saved, the plugin intercepts the before_save hook and checks if the "title" field is empty.
- If the title is empty, the plugin returns an error response:
1{"error":"validation failed","message":"title must not be empty"} - If the title is not empty, the original content passes through unchanged.