feat(09-04): compile ordered Winter list schemas

- Typed columns, actions, default sort, search term, and page sizes
- Omitted sortable defaults to true and empty collections marshal as arrays
- Unknown keys, bad defaults, and path escape fail before routes are served
This commit is contained in:
Jakub Zych
2026-09-24 18:46:53 +02:00
parent fd591ed3a7
commit aab4398ce4
5 changed files with 448 additions and 134 deletions

View File

@@ -136,16 +136,11 @@ func constrainController(g pact.Router) {
func (s *service) listSchema(w http.ResponseWriter, r *http.Request) {
s.protect(w, r, func(cc *CompiledController) {
cols := cc.List.Columns
if cols == nil {
cols = []ListColumn{}
schema := cc.List
if schema == nil {
schema = &ListSchema{}
}
WriteData(w, http.StatusOK, &ListSchema{
Title: cc.List.Title,
RecordsPerPage: cc.List.RecordsPerPage,
ShowSearch: cc.List.ShowSearch,
Columns: cols,
}, map[string]any{})
WriteData(w, http.StatusOK, schema, map[string]any{})
})
}