Arch JSON pipeline
SWC never parses view XML in the browser. The Go kernel parses arch once per request and returns JSON that SWC components consume directly.
Flow
sys.view arch (XML)
→ parser.ParseViewFromArch (view_xml.go)
→ swcmeta.SerializeView (arch.go)
→ GET /web/swc/workspace JSON payload
→ WorkspaceRouter → ListView / FormView / …
Request
GET /web/swc/workspace?action=12&menu_id=5&view_type=form&id=7&edit=1&q=acme
| Query param | Purpose |
|---|---|
action | Window action id (optional if model is set) |
menu_id | Menu context |
view_type | list, form, kanban, … |
id | Record id (form) |
edit | 1 for edit mode |
q | List/kanban search filter |
model | Load workspace by model when action is omitted |
filter | Named search-view filters (comma-separated) |
sort | List sort (field or -field) |
offset | List page offset |
Payload shape
{
"actionId": 12,
"menuId": "5",
"viewType": "form",
"model": "crm.lead",
"recordId": 7,
"formEdit": false,
"csrfToken": "…",
"arch": {
"type": "form",
"model": "crm.lead",
"header": { "buttons": [], "fields": [] },
"sheet": {
"groups": [{ "string": "Lead", "fields": [{ "name": "name", "type": "char" }] }],
"notebook": []
},
"hasChatter": true
},
"record": { "id": 7, "name": "Acme deal" },
"viewTabs": [
{ "mode": "kanban", "label": "Kanban", "href": "/web?…", "active": false },
{ "mode": "list", "label": "List", "href": "/web?…", "active": false },
{ "mode": "form", "label": "Form", "href": "/web?…&id=7", "active": true }
],
"listSearch": "",
"listTotal": 0,
"defaults": { "type": "opportunity" }
}
defaults is the window action default_* context, without the prefix. New forms and kanban quick-create merge it into the record.
Arch enrichment
swcmeta/enrichField merges ORM metadata into each arch field:
type,string,relation,selectionfrom registered model metadata (struct tags → ORM)requiredfrom model when not set in XML- Auto-generated O2M subview columns when nested
is omitted
Records in the payload are ACL-redacted the same way as JSON-RPC reads.
Kanban extension
For type="kanban", the server adds grouped columns:
"kanban": {
"groupField": "stage_id",
"draggable": true,
"columns": [
{ "value": 1, "label": "New", "records": [{ "id": 3, "name": "Lead A" }] }
]
}
Client types
TypeScript definitions: core/swc/src/types/workspace.ts (SwcWorkspacePayload, SwcArchField, SwcViewArch).
Go definitions: core/engine/swcmeta/types.go.
SPA navigation
ActionService.navigate() updates the URL and dispatches popstate. WorkspaceRouter refetches workspace JSON and swaps view components. View tabs in the breadcrumb bar sync from payload.viewTabs.