You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,8 @@ Example payload:
105
105
}
106
106
```
107
107
108
+
Set `metadata.legacyCompat: true` to add a legacy-friendly tag per category. When enabled, each category gets an extra tag keyed by its `id` with value `"yes"`, in addition to the default `{ categoryId: "<id>" }`.
109
+
108
110
#### Field/type mapping (v2)
109
111
-`select` → `selectOne`
110
112
-`multiselect` → `selectMultiple`
@@ -119,7 +121,7 @@ Example payload:
119
121
- Categories with `track: true` are added to the track list (must not be empty if any track is declared).
120
122
121
123
#### Limits & validation (v2)
122
-
- JSON body ≤ 1 MB (enforced while streaming parse).
124
+
- JSON body ≤ 10 MB (streaming-validated).
123
125
- SVG icons ≤ 2 MB each; icons can be provided via:
124
126
-`svgData` (inline SVG string)
125
127
-`svgUrl` (remote fetch with 5s timeout and content-type check)
-`legacyCompat` (optional): when `true`, every category gets an extra tag keyed by its `id` with value `"yes"` (e.g., `{ "mahali-pa-kihistoria": "yes" }`) in addition to the default `{ categoryId: <id> }` tag to support legacy consumers.
116
+
-`categories`: array of categories with `id`, `name`, `appliesTo` (`observation`/`track`), optional `tags`, `fields`, `iconId`, `addTags`, `removeTags`, `terms`, `color`, `track`.
117
+
-`fields`: array of fields with `id`, `type`, optional `name/label/tagKey/options/...` (legacy types are mapped automatically).
118
+
-`icons` (optional): array with `id` plus either `svgData` or `svgUrl` (data URIs allowed).
119
+
-`translations` (optional): object keyed by BCP‑47 locale.
120
+
121
+
**Default tags**: If a category provides no `tags`, the service sets `{ categoryId: <id> }`. With `legacyCompat: true`, it also adds `{ <id>: "yes" }`.
122
+
123
+
**Response**: Binary stream of `.comapeocat` file.
124
+
125
+
**Status Codes**:
126
+
-`200 OK` - file built and validated
127
+
-`400 Bad Request` - validation errors (e.g., size limits, bad schema, path traversal)
128
+
-`422 Unprocessable Entity` - build produced a file but downstream validation timed out/failed
129
+
130
+
**Examples**:
131
+
```bash
132
+
curl -X POST \
133
+
-H "Content-Type: application/json" \
134
+
-d @config.json \
135
+
--output output.comapeocat \
136
+
http://localhost:3000/v2
137
+
```
138
+
139
+
**Implementation**: `src/controllers/settingsController.ts` (dispatch) and `src/services/comapeocatBuilder.ts` (build logic)
140
+
141
+
**Key validation/limits** (see `src/config/app.ts`):
142
+
- JSON body ≤ 10 MB (streaming enforced in `app.ts` onParse hook)
0 commit comments