sev-2 / raiden

A Framework for Supabase
MIT License
24 stars 2 forks source link

Feature : support auto validate model in rest controller #36

Closed vani-rf closed 5 months ago

vani-rf commented 5 months ago

Detail Update :

Example :

- controller 

type BadgesController struct { raiden.ControllerBase Http string path:"/badges" type:"rest" Model models.Badges }

- HTTP Call

// Example CURL

curl --location 'http://localhost:8004/rest/v1/badges' \ --header 'apikey: {{ YOUR API KEY }}' \ --header 'Authorization: Bearer {{ Your Token }}' \ --header 'Content-Type: application/json' \ --header 'Prefer: return=minimal' \ --header 'Cookie: frontend_lang=en_US' \ --data '{ "name": "t"}'

// Example Response

{ "code": "Validation Fail", "details": "{\"Name\":[\"name should be at least 2\"]}", "message": "invalid payload for key : Name" }