-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathopenapi.yaml
745 lines (723 loc) · 24.6 KB
/
openapi.yaml
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
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
###############################################################################
# Licensed Materials - Property of IBM
#
# 5725-U33, 5737-H33
#
# (C) Copyright IBM Corp. 2020 All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
###############################################################################
openapi: 3.0.0
info:
title: IBM Event Streams Schema Registry
description: "
IBM Event Streams schema registry management REST API
<p>
This specification describes a REST API, provided by the
<a href=\"https://cloud.ibm.com/docs/EventStreams/index.html\">
IBM Cloud Event Streams</a> service.
<p>
Access to this API requires an IAM Bearer Token to be presented through
bearer authentication or an IAM API Key to be presented as the password in
basic authentication.
<p>
The API exposes the following resources:
<ul>
<li><strong>schemas</strong> - a collection of one or more schema
versions that are used to describe the data stored on a Kafka
topic. As the applications that produce and consume this data
evolve, so will the schemas used to describe the contents of
each message on the topic. It may be the case that the data
stored in Kafka uses several versions of a schema to describe
its content. The schema registry
helps manage this complexity.</li>
<li><strong>schema versions</strong> - one particular version of a
schema. Each schema version corresponds to an Avro schema
that describes the encoding of message data.</li>
<li><strong>schema rules</strong> - are used to place constraints on
whether it is valid to add a new schema version to the schema
versions that already comprise a schema. For example: schema
rules can be used to enforce that data encoded using a new
version of a schema version can still be understood by
applications that are using an older version of the schema.
</li>
<li><strong>global rules</strong> - provide the default rules to use if a
particular schema has not being configured with its own
schema
rule.</li>
</ul>
<p>
The registry supports enforcing the following compatibility requirements
between the different versions of a schema:
<table border=\"1\">
<tr><th>Compatibility Rule</th><th>Tested against</th><th>Description</th>
</tr>
<tr><td>NONE</td>
<td>N/A</td>
<td>No compatibility checking is performed when a new schema version
is created</td></tr>
<tr><td>BACKWARD</td>
<td>Latest version of the schema</td>
<td rowspan=\"2\">A new version of the schema can omit fields that are
present in the existing version of the schema.<br>
A new version of the schema can add optional fields that are not
present in the existing version of the schema.</td></tr>
<tr><td>BACKWARD_TRANSITIVE</td>
<td>All versions of the schema</td></tr>
<tr><td>FORWARD</td>
<td>Latest version of the schema</td>
<td rowspan=\"2\">A new version of the schema can add fields that are
not present in the existing version of the schema.<br>
A new version of the schema can omit optional fields that are
present in the existing version of the schema.</td></tr>
<tr><td>FORWARD_TRANSITIVE</td>
<td>All versions of the schema</td></tr>
<tr><td>FULL</td>
<td>Latest version of the schema</td>
<td rowspan=\"2\">A new version of the schema can add optional fields
that are not present in the existing version of the schema.</br>
A new version of the schema can omit optional fields that are
present in the existing version of the schema.</td></tr>
<tr><td>FULL_TRANSITIVE</td>
<td>All versions of the schema</td></tr>
</table>
"
version: 1.0.0
security:
- BearerAuth: []
- BasicAuth: []
paths:
/artifacts:
get:
tags:
- schemas
summary: List schema IDs
description: Returns an array containing the schema IDs of all of the
schemas that are stored in the registry.
responses:
200:
description: The list schema IDs request was successful. The response
body is a JSON array containing a list of schema IDs.
content:
application/json:
schema:
type: array
items:
type: string
description: Schema ID
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
post:
tags:
- schemas
parameters:
- in: header
name: X-Registry-ArtifactId
schema:
type: string
required: false
description: The name to assign to the new schema. This must be
unique. If this value is not specified then a UUID is used.
summary: Create a new schema
description: Create a new schema and populate it with an initial schema
version containing the AVRO document in the request body.
requestBody:
description: The AVRO schema to use as the first version of this new
schema.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/avroSchema'
responses:
200:
description: The schema was successfully created. Information about
the newly created schema is included in the response body.
content:
application/json:
schema:
$ref: '#/components/schemas/schemaMetadata'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
409:
description: A schema with the specified schema ID already exists.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
/artifacts/{id}:
delete:
tags:
- schemas
summary: Delete a schema
description: Deletes a schema and all of its versions from the schema
registry.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of the schema to delete.
responses:
204:
description: The schema was successfully deleted from the registry.
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDNotFound'
get:
tags:
- schemas
summary: Get the latest version of a schema
description: Retrieves the lastest version of the specified schema.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of a schema. The latest version of this schema will
be returned in the response body.
responses:
200:
description: The latest version of the schema was successfully
retrieved. This schema version is included in the response body.
content:
application/json:
schema:
$ref: '#/components/schemas/avroSchema'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDNotFound'
/artifacts/{id}/versions:
get:
tags:
- schema versions
summary: List the versions of a schema
description: Returns an array containing the version numbers of all of
the versions of the specified schema.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The schema ID for which the list of versions will be
returned.
responses:
200:
description: The request to list the versions of a schema was
successful. The body of the response contains an array of schema
version numbers.
content:
application/json:
schema:
type: array
items:
type: integer
description: Schema version number
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDNotFound'
post:
tags:
- schema versions
summary: Create a new schema version
description: Creates a new version of a schema using the AVRO schema
supplied in the request body.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: A schema ID. This identifies the schema for which a new
version will be created.
requestBody:
description: The AVRO schema to use for the new schema version.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/avroSchema'
responses:
200:
description: The new schema version was successfully created.
Information about the newly created schema is returned in the
response body.
content:
application/json:
schema:
$ref: '#/components/schemas/schemaMetadata'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDNotFound'
409:
description: Either the schema already has the maximum number of
permitted versions, or creating a new schema version would fail
the required compatibility checks based on existing versions of the
schema. Consult the error information returned in the response body
for details.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
/artifacts/{id}/versions/{version}:
delete:
tags:
- schema versions
summary: Delete a version of the schema
description: Delete a version of the schema. If this was the only version
of the schema then the whole schema will be deleted.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: A schema ID that identifies the schema to delete a version
from.
- in: path
name: version
schema:
type: integer
required: true
description: The schema version number to delete.
responses:
204:
description: The schema version was successfully deleted.
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDOrVersionNotFound'
get:
tags:
- schema versions
summary: Get a version of the schema
description: Retrieve a particular version of the schema.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The schema ID identifying which schema to return a version
from.
- in: path
name: version
schema:
type: integer
required: true
description: The version number that identifies the particular schema
version to return.
responses:
200:
description: The AVRO schema corresponding to the requested schema
version.
content:
application/json:
schema:
$ref: '#/components/schemas/avroSchema'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDOrVersionNotFound'
/artifacts/{id}/rules:
post:
tags:
- schema rules
summary: Create a schema rule
description: Create a new rule that controls compatibility checks for a
particular schema. Schema rules override the registries global
compatibility rule setting.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of the schema that the rule is to be associated
with.
requestBody:
description: A JSON object representing the schema rule to create.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
responses:
200:
description: The schema rule was created successfully. The value of
the schema rule is returned in the body of the response.
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDNotFound'
409:
description: A schema rule with the same type already exists for this
schema. Use the REST request that specifies the `PUT` verb to a
path of `/artifacts/{id}/rules/{rule}` to update the rule.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
/artifacts/{id}/rules/{rule}:
delete:
tags:
- schema rules
summary: Delete a schema rule
description: Delete a rule that controls compatibility checks for a
particular schema. After this operation completes the schema will be
subject to compatibility checking defined by the global compatibility
rule setting for the registry.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of the schema that the rule is to be deleted from.
- in: path
name: rule
schema:
type: string
enum:
- COMPATIBILITY
required: true
description: The type of rule to delete. Currently only the value that
can be specified is `COMPATIBILITY`.
responses:
204:
description: The schema rule was successfully deleted.
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDOrSchemaRuleNotFound'
get:
tags:
- schema rules
summary: Get a schema rule configuration
description: Retrieves the current configuration for a schema rule. If a
schema rule exists then it overrides the corresponding global rule that
would otherwise be applied.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of the schema to retrieve the rule for.
- in: path
name: rule
schema:
type: string
enum:
- COMPATIBILITY
required: true
description: The type of rule to retrieve. Currently only the value
that can be specified is `COMPATIBILITY`.
responses:
200:
description: The schema rule was successfully retrieved. The value of
the schema rule is returned in the body of the response.
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
404:
$ref: '#/components/responses/schemaIDOrSchemaRuleNotFound'
put:
tags:
- schema rules
summary: Update the configuration of a schema rule.
description: Updates the configuration of an existing schema rule. The
updated rule will be applied to the specified schema, overriding the
value set for the corresponding global rule.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The ID of the schema for which to update the rule
configuration.
- in: path
name: rule
schema:
type: string
enum:
- COMPATIBILITY
required: true
description: The type of rule to update. Currently only the value that
can be specified is `COMPATIBILITY`.
requestBody:
description: A JSON object representing the updated values to use for
the schema rule.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
responses:
200:
description: The schema rule was successfully retrieved. The value of
the schema rule is returned in the body of the response.
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
409:
description: This schema does not have a rule of the specified type.
Use the REST request that specifies the `POST` verb to a path of
`/artifacts/{id}/rules` to create a schema rule.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
/rules/{rule}:
get:
tags:
- global rules
summary: Retrieve the configuration for a global rule.
description: Retrieves the configuration for the specified global rule.
The value of the global rule is used as the _default_ when a schema
does not have a corresponding schema compatibility rule defined.
parameters:
- in: path
name: rule
schema:
type: string
enum:
- COMPATIBILITY
required: true
description: The type of the global rule to retrieve. Currently only
`COMPATIBILITY` is supported.
responses:
200:
description: The global rule was successfully retrieved. The value of
the global rule is returned in the body of the response.
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
put:
tags:
- global rules
summary: Update the configuration for a global rule
description: Update the configuration for the specified global rule.
The value of the global rule is used as the _default_ when a schema
does not have a corresponding schema compatibility rule defined.
parameters:
- in: path
name: rule
schema:
type: string
enum:
- COMPATIBILITY
required: true
description: The type of the global rule to update. Currently only
`COMPATIBILITY` is supported.
responses:
200:
description: The global rule was successfully updated. The new value
for the global rule is returned in the body of the response.
content:
application/json:
schema:
$ref: '#/components/schemas/rule'
400:
$ref: '#/components/responses/badRequest'
403:
$ref: '#/components/responses/forbidden'
components:
responses:
badRequest:
description: The request was not valid. Consult the error information
returned in the response body for details.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
forbidden:
description: The client is not authorized to perform this request.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
schemaIDNotFound:
description: The registry does not contain a schema with the specified
schema ID.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
schemaIDOrSchemaRuleNotFound:
description: Either the registry does not contain a schema with the
specified schema ID, or the schema is not configured with the specified
type of rule.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
schemaIDOrVersionNotFound:
description: Either the registry does not contain a schema with the
specified schema ID, or the schema identified by the schema ID does
not contain a version corresponding to the specified version number.
content:
application/json:
schema:
$ref: '#/components/schemas/error'
securitySchemes:
BearerAuth:
type: http
scheme: bearer
BasicAuth:
type: http
scheme: basic
schemas:
avroSchema:
example: {
"type": "record",
"name": "book",
"fields" : [
{"name": "title", "type": "string"},
{"name": "author", "type": "string"}
]
}
rule:
required:
- type
- config
type: object
description: Rules define constraints on whether the schema registry will
accept a new version of a schema.
properties:
type:
type: string
enum:
- COMPATIBILITY
description: The type of the rule. Currently only one type is
supported (`COMPATIBILITY`).
config:
oneOf:
- $ref: '#/components/schemas/compatibilityRuleConfig'
description: The configuration value for the rule. Which values are
valid depends on the value of this object's `type` property.
example: {
"type": "COMPATIBILITY",
"config": "BACKWARD"
}
compatibilityRuleConfig:
type: string
enum:
- BACKWARD
- BACKWARD_TRANSITIVE
- FORWARD
- FORWARD_TRANSITIVE
- FULL
- FULL_TRANSITIVE
- NONE
description: Valid values for the `config` property of a compatibility
rule.
schemaMetadata:
required:
- createdOn
- globalId
- id
- modifiedOn
- type
- version
type: object
description: Information about a schema version.
properties:
createdOn:
type: integer
description: Creation timestamp of the schema in UNIX epoc format.
globalId:
type: integer
description: Globally unique ID assigned to the initial version of
the schema.
id:
type: string
description: The ID of the schema. This is either taken from the
`X-Registry-ArtifactId` header when the request is made to create
the schema or is an automatically assigned UUID value.
modifiedOn:
type: integer
description: Last modification timestamp of the schema in UNIX epoc
format.
type:
type: string
description: Type of the schema. Always the string `AVRO`.
version:
type: integer
description: Version number assigned to this version of the schema.
example: {
"id":"my-schema",
"type":"AVRO",
"version":1,
"createdOn":1579267788258,
"modifiedOn":1579267788258,
"globalId":75
}
error:
required:
- error_code
- message
properties:
error_code:
type: integer
description: HTTP Status code of the response.
message:
type: string
description: Error message.
incident:
type: string
description: Optional incident ID. IBM support can use this to
correlate the error response with the underlying cause.
example: {
"error_code": 404,
"message": "No schema with ID 1234 was found in the registry"
}