-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsync.yaml
More file actions
548 lines (548 loc) · 18 KB
/
sync.yaml
File metadata and controls
548 lines (548 loc) · 18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
openapi: 3.0.3
info:
title: Manifest Management API
version: 0.1.0
description: |
CRUD endpoints that expose a manifest-friendly view of project flags for tooling such
as the OpenFeature CLI. The specification is provider-agnostic; replace the server
section with your deployment's base URL and token semantics.
tags:
- name: Manifest
description: Operations for reading and mutating manifest-friendly flag data.
servers:
- url: https://example.com
description: Replace with the provider base URL
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
FlagDefaultValue:
description: Default value for a flag (can be boolean, string, integer, or object)
oneOf:
- type: boolean
- type: string
- type: integer
- type: object
ManifestFlag:
type: object
required:
- key
- type
- defaultValue
properties:
key:
type: string
description: Unique flag key within the flag set.
example: search-rollout
name:
type: string
description: Human-friendly flag name. Defaults to the key when omitted.
example: Search rollout
type:
type: string
description: Flag data type.
enum: [boolean, string, integer, object]
description:
type: string
nullable: true
description: Optional flag description.
example: Enable the new search experience.
defaultValue:
$ref: '#/components/schemas/FlagDefaultValue'
ManifestEnvelope:
type: object
required:
- flags
properties:
flags:
type: array
items:
$ref: '#/components/schemas/ManifestFlag'
ManifestFlagResponse:
type: object
required:
- flag
- updatedAt
properties:
flag:
$ref: '#/components/schemas/ManifestFlag'
updatedAt:
type: string
format: date-time
description: |
ISO timestamp reflecting the last update to the flag record. Clients can use this to
detect changes between manifest fetches or to implement optimistic concurrency checks.
example: 2024-03-02T09:45:03.000Z
ArchiveResponse:
type: object
required:
- message
- archivedAt
properties:
message:
type: string
example: Flag "search-rollout" archived. Restore it using your management interface if needed.
archivedAt:
type: string
format: date-time
nullable: true
description: Timestamp recording when the flag was archived.
ErrorDetail:
type: object
properties:
field:
type: string
description: Field path related to the error.
example: key
code:
type: string
description: Short machine-readable code (matches Zod issue codes).
example: invalid_type
message:
type: string
description: Human-friendly error message.
example: Flag exists but is archived. Restore it via the UI to reuse this key.
ErrorResponse:
type: object
required:
- error
properties:
error:
type: object
required:
- message
- status
properties:
message:
type: string
example: Flag type cannot be changed from boolean to string.
status:
type: integer
example: 409
details:
type: array
items:
$ref: '#/components/schemas/ErrorDetail'
paths:
/openfeature/v0/manifest:
get:
tags:
- Manifest
summary: Get Project Manifest
description: |
Returns the project manifest containing active flags. Archived flags are excluded.
The response includes an `X-Manifest-Capabilities` header listing token capabilities.
security:
- bearerAuth: []
responses:
'200':
description: Manifest exported successfully.
headers:
X-Manifest-Capabilities:
schema:
type: string
example: read,write,delete
description: Comma-separated list that reflects the token capabilities.
content:
application/json:
schema:
$ref: '#/components/schemas/ManifestEnvelope'
examples:
manifest:
summary: Sample manifest
value:
flags:
- key: search-rollout
name: Search rollout
type: boolean
description: Enable the new search experience.
defaultValue: false
- key: welcome-banner
name: Welcome banner
type: string
description: Localized welcome message
defaultValue: control
'401':
description: Missing or invalid token.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
value:
error:
message: Authorization header required
status: 401
'403':
description: Token lacks scope to read the manifest.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
forbidden:
value:
error:
message: This API token does not have read access.
status: 403
'500':
description: Unexpected server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
serverError:
value:
error:
message: Unexpected error
status: 500
/openfeature/v0/manifest/flags:
post:
tags:
- Manifest
summary: Create Manifest Flag
description: |
Creates a new flag exposed through the manifest. The request must be authenticated
with a token that includes `write` or `delete` capability. Attempting to create a
flag whose key already exists (active or archived) returns 409.
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- key
- type
- defaultValue
properties:
key:
type: string
example: search-rollout
type:
type: string
enum: [boolean, string, integer, object]
name:
type: string
description: Optional display name. Defaults to the key.
example: Search rollout
description:
type: string
nullable: true
example: Enable the new search experience.
defaultValue:
$ref: '#/components/schemas/FlagDefaultValue'
additionalProperties: false
examples:
booleanFlag:
value:
key: search-rollout
type: boolean
name: Search rollout
description: Enable the new search experience.
defaultValue: false
responses:
'201':
description: Flag created successfully.
headers:
X-Manifest-Capabilities:
schema:
type: string
example: read,write,delete
content:
application/json:
schema:
$ref: '#/components/schemas/ManifestFlagResponse'
'400':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
validation:
value:
error:
message: Validation failed.
status: 400
details:
- field: key
code: too_small
message: Flag key is required.
'401':
description: Missing or invalid token.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
value:
error:
message: Authorization header required
status: 401
'403':
description: Token lacks write scope.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
forbidden:
value:
error:
message: This API token does not have write access.
status: 403
'409':
description: Flag key already exists (active or archived).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
archivedConflict:
value:
error:
message: Flag with key "search-rollout" is archived. Restore it in the UI or choose a new key.
status: 409
details:
- field: key
message: Flag exists but is archived. Restore it to reuse this key.
'500':
description: Unexpected server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/openfeature/v0/manifest/flags/{key}:
put:
tags:
- Manifest
summary: Update Manifest Flag
description: |
Replaces metadata for an existing manifest flag. The path parameter and body key must
match. Archived flags cannot be updated; they must be restored before modification.
security:
- bearerAuth: []
parameters:
- name: key
in: path
required: true
schema:
type: string
description: Flag key to update.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- key
- type
properties:
key:
type: string
example: search-rollout
type:
type: string
enum: [boolean, string, integer, object]
name:
type: string
example: Search rollout
description:
type: string
nullable: true
defaultValue:
$ref: '#/components/schemas/FlagDefaultValue'
additionalProperties: false
responses:
'200':
description: Flag updated successfully.
headers:
X-Manifest-Capabilities:
schema:
type: string
example: read,write,delete
content:
application/json:
schema:
$ref: '#/components/schemas/ManifestFlagResponse'
'400':
description: Validation failure (e.g., mismatched keys).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
mismatchedKey:
value:
error:
message: Flag key in path and payload must match.
status: 400
details:
- field: key
message: Path key and payload key differ.
'401':
description: Missing or invalid token.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
value:
error:
message: Authorization header required
status: 401
'403':
description: Token lacks write scope.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
forbidden:
value:
error:
message: This API token does not have write access.
status: 403
'404':
description: Flag not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
notFound:
value:
error:
message: Flag "search-rollout" was not found.
status: 404
'409':
description: Conflict (archived flag, immutable type).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
archivedConflict:
value:
error:
message: Flag "search-rollout" is archived. Restore it in the UI before updating.
status: 409
details:
- field: key
message: Archived flags cannot be updated via the manifest API.
typeConflict:
value:
error:
message: Flag type cannot be changed from boolean to string.
status: 409
'500':
description: Unexpected server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
tags:
- Manifest
summary: Archive Manifest Flag
description: |
Removes a flag from the manifest. Providers may implement this as either a soft
delete (archive) or a hard delete; consult your provider documentation for specifics.
Flags that are active in protected environments may reject deletion requests depending
on provider policy.
security:
- bearerAuth: []
parameters:
- name: key
in: path
required: true
schema:
type: string
description: Flag key to archive.
responses:
'200':
description: Flag archived successfully (soft delete).
headers:
X-Manifest-Capabilities:
schema:
type: string
example: read,write,delete
content:
application/json:
schema:
$ref: '#/components/schemas/ArchiveResponse'
examples:
archived:
value:
message: Flag "search-rollout" archived. Restore it using your management interface if needed.
archivedAt: 2024-03-02T10:01:22.000Z
'401':
description: Missing or invalid token.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
unauthorized:
value:
error:
message: Authorization header required
status: 401
'403':
description: Token lacks delete scope.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
forbidden:
value:
error:
message: This API token does not have delete access.
status: 403
'404':
description: Flag not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
notFound:
value:
error:
message: Flag "search-rollout" was not found.
status: 404
'409':
description: Flag already archived or active in a protected environment.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
alreadyArchived:
value:
error:
message: Flag "search-rollout" is already archived.
status: 409
details:
- field: key
message: Flag is already archived. Restore it to use it again.
protectedEnvironment:
value:
error:
message: Flag is active in a protected environment. Disable it before archiving.
status: 409
details:
- field: key
message: Disable the flag in protected environments before archiving.