@cleocode/lafs-protocol 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,14 +3,11 @@
3
3
  "$id": "https://lafs.dev/schemas/v1/envelope.schema.json",
4
4
  "title": "LAFS Envelope v1",
5
5
  "type": "object",
6
- "additionalProperties": false,
7
6
  "required": [
8
7
  "$schema",
9
8
  "_meta",
10
9
  "success",
11
- "result",
12
- "error",
13
- "page"
10
+ "result"
14
11
  ],
15
12
  "properties": {
16
13
  "$schema": {
@@ -62,11 +59,28 @@
62
59
  "type": "boolean"
63
60
  },
64
61
  "mvi": {
65
- "type": "boolean"
62
+ "type": "string",
63
+ "enum": ["minimal", "standard", "full", "custom"],
64
+ "description": "Disclosure level: minimal (MVI only), standard (common fields), full (all fields), custom (per _fields parameter)"
66
65
  },
67
66
  "contextVersion": {
68
67
  "type": "integer",
69
68
  "minimum": 0
69
+ },
70
+ "warnings": {
71
+ "type": "array",
72
+ "items": {
73
+ "type": "object",
74
+ "properties": {
75
+ "code": { "type": "string", "description": "Warning identifier (e.g., DEPRECATED_FIELD)" },
76
+ "message": { "type": "string", "description": "Human-readable warning" },
77
+ "deprecated": { "type": "string", "description": "The deprecated feature or field name" },
78
+ "replacement": { "type": "string", "description": "Suggested replacement, if any" },
79
+ "removeBy": { "type": "string", "description": "Version when the deprecated feature will be removed" }
80
+ },
81
+ "required": ["code", "message"]
82
+ },
83
+ "description": "Non-fatal advisory warnings (deprecations, migration hints)"
70
84
  }
71
85
  }
72
86
  },
@@ -127,14 +141,7 @@
127
141
  "page": {
128
142
  "type": ["object", "null"],
129
143
  "additionalProperties": false,
130
- "required": [
131
- "mode",
132
- "limit",
133
- "offset",
134
- "nextCursor",
135
- "hasMore",
136
- "total"
137
- ],
144
+ "required": ["mode"],
138
145
  "properties": {
139
146
  "mode": {
140
147
  "type": "string",
@@ -160,7 +167,61 @@
160
167
  "type": ["integer", "null"],
161
168
  "minimum": 0
162
169
  }
163
- }
170
+ },
171
+ "allOf": [
172
+ {
173
+ "if": {
174
+ "type": "object",
175
+ "properties": { "mode": { "const": "cursor" } },
176
+ "required": ["mode"]
177
+ },
178
+ "then": {
179
+ "required": ["mode", "nextCursor", "hasMore"],
180
+ "properties": {
181
+ "mode": true,
182
+ "nextCursor": true,
183
+ "hasMore": true,
184
+ "limit": true,
185
+ "total": true
186
+ }
187
+ }
188
+ },
189
+ {
190
+ "if": {
191
+ "type": "object",
192
+ "properties": { "mode": { "const": "offset" } },
193
+ "required": ["mode"]
194
+ },
195
+ "then": {
196
+ "required": ["mode", "limit", "offset", "hasMore"],
197
+ "properties": {
198
+ "mode": true,
199
+ "limit": true,
200
+ "offset": true,
201
+ "hasMore": true,
202
+ "total": true
203
+ }
204
+ }
205
+ },
206
+ {
207
+ "if": {
208
+ "type": "object",
209
+ "properties": { "mode": { "const": "none" } },
210
+ "required": ["mode"]
211
+ },
212
+ "then": {
213
+ "required": ["mode"],
214
+ "properties": {
215
+ "mode": true
216
+ }
217
+ }
218
+ }
219
+ ]
220
+ },
221
+ "_extensions": {
222
+ "type": "object",
223
+ "description": "Vendor extensions. Keys SHOULD use x- prefix (e.g., x-myvendor-trace-id).",
224
+ "additionalProperties": true
164
225
  }
165
226
  },
166
227
  "allOf": [
@@ -183,11 +244,39 @@
183
244
  }
184
245
  },
185
246
  "then": {
247
+ "required": ["error"],
186
248
  "properties": {
187
249
  "result": { "type": "null" },
188
250
  "error": { "type": "object" }
189
251
  }
190
252
  }
253
+ },
254
+ {
255
+ "if": {
256
+ "properties": {
257
+ "_meta": {
258
+ "type": "object",
259
+ "properties": {
260
+ "strict": { "const": true }
261
+ }
262
+ }
263
+ }
264
+ },
265
+ "then": {
266
+ "additionalProperties": false,
267
+ "properties": {
268
+ "$schema": true,
269
+ "_meta": true,
270
+ "success": true,
271
+ "result": true,
272
+ "error": true,
273
+ "page": true,
274
+ "_extensions": true
275
+ }
276
+ },
277
+ "else": {
278
+ "additionalProperties": true
279
+ }
191
280
  }
192
281
  ]
193
282
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "version": "1.0.0",
4
4
  "codes": [
5
5
  {
@@ -91,6 +91,24 @@
91
91
  "httpStatus": 426,
92
92
  "grpcStatus": "FAILED_PRECONDITION",
93
93
  "cliExit": 10
94
+ },
95
+ {
96
+ "code": "E_DISCLOSURE_UNKNOWN_FIELD",
97
+ "category": "VALIDATION",
98
+ "description": "Unrecognized expansion field in _expand parameter",
99
+ "retryable": false,
100
+ "httpStatus": 400,
101
+ "grpcStatus": "INVALID_ARGUMENT",
102
+ "cliExit": 2
103
+ },
104
+ {
105
+ "code": "E_MVI_BUDGET_EXCEEDED",
106
+ "category": "VALIDATION",
107
+ "description": "Response exceeds declared MVI budget (token, byte, or item limit)",
108
+ "retryable": false,
109
+ "httpStatus": 413,
110
+ "grpcStatus": "RESOURCE_EXHAUSTED",
111
+ "cliExit": 2
94
112
  }
95
113
  ]
96
114
  }