Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created June 10, 2019 15:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheresalice/efff1350eb0623b3fae0c42333363e9e to your computer and use it in GitHub Desktop.
Save wheresalice/efff1350eb0623b3fae0c42333363e9e to your computer and use it in GitHub Desktop.
OpenAPI spec for Confluent Schema Registry
openapi: 3.0.1
info:
title: Schema Registry
version: 5.2.1
description: Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility settings and expanded Avro support. It provides serializers that plug into Apache Kafka® clients that handle schema storage and retrieval for Kafka messages that are sent in the Avro format.
externalDocs:
url: >-
https://docs.confluent.io/current/schema-registry/develop/api.html#schemaregistry-api
description: Confluent's API reference
paths:
/subjects:
get:
description: list all subjects
responses:
'200':
description: a list of all subjects
content:
application/vnd.schemaregistry.v1+json:
schema:
type: array
items:
type: string
'500':
description: 50001 -- Error in the backend datastore
'/schemas/ids/{id}':
get:
description: fetch a schema by globally unique id
parameters:
- name: id
description: globally unique id
required: true
in: path
schema:
type: integer
responses:
'200':
description: Get the schema string identified by the input ID
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
properties:
schema:
type: string
'404':
description: 40403 -- Schema not found
'500':
description: 50001 -- Error in the backend datastore
'/subjects/{subject}':
post:
description: check if a schema is registered under the subject
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: string
requestBody:
content:
application/vnd.schemaregistry.v1+json:
schema:
$ref: '#/components/schemas/schema'
responses:
'200':
description: the found subject
content:
application/json:
schema:
type: object
properties:
subject:
type: string
version:
type: integer
id:
type: integer
schema:
type: string
'404':
description: 40401 -- Subject not found<br> 40403 -- Schema not found
'500':
description: Internal server error
delete:
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: string
description: delete all schema versions under the subject
responses:
'200':
description: success
content:
application/vnd.schemaregistry.v1+json:
schema:
$ref: '#/components/schemas/integer_array'
'/subjects/{subject}/versions':
post:
description: Register a new schema under the specified subject
parameters:
- name: subject
in: path
required: true
schema:
type: string
requestBody:
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
properties:
schema:
type: string
description: The avro schema string
responses:
'200':
description: success
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
properties:
id:
type: integer
description: ID of the new schema
'409':
description: Incompatible Avro schema
'422':
description: 42201 -- Invalid Avro schema
'500':
description: >-
50001 -- Error in the backend data store<br> 50002 -- Operation
timed out<br> 50003 -- Error while forwarding the request to the
primary
get:
description: Get a list of versions registered under the specified subject
parameters:
- name: subject
in: path
required: true
schema:
type: string
responses:
'200':
description: A list of versions
content:
application/vnd.schemaregistry.v1+json:
schema:
$ref: '#/components/schemas/integer_array'
'404':
description: 40401 -- Subject not found
'500':
description: 50001 -- Error in the backend datastore
'/subjects/{subject}/versions/{version}':
get:
description: Get a specific version of the schema registered under this subject
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: integer
- name: version
in: path
required: true
description: version number (or `latest`)
schema:
type: integer
example: latest
responses:
'200':
description: schema
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
properties:
name:
type: string
version:
type: integer
schema:
type: string
delete:
description: delete a specific version of a subject
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: integer
- name: version
in: path
required: true
description: version number
schema:
type: integer
responses:
'200':
description: delete successful
content:
application/vnd.schemaregistry.v1+json:
schema:
type: integer
description: the ID of the deleted version
'404':
description: 40401 -- Subject not found<br> 40402 -- Version not found
'422':
description: 42202 -- Invalid version
'500':
description: 50001 -- Error in the backend data store
'/subjects/{subject}/versions/{version}/schema':
get:
description: >-
Get the avro schema for the specified version of this subject. The
unescaped schema only is returned.
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: integer
- name: version
in: path
required: true
description: version number (or `latest`)
schema:
type: integer
example: latest
responses:
'200':
description: the avro schema
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
'404':
description: 40401 -- Subject not found<br> 40402 -- Version not found
'422':
description: 42202 -- Invalid version
'500':
description: 50001 -- Error in the backend data store
'/compatibility/subjects/{subject}/versions/{version}':
post:
parameters:
- name: subject
in: path
required: true
description: subject name
schema:
type: integer
- name: version
in: path
required: true
description: version number (or `latest`)
schema:
type: integer
example: latest
requestBody:
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
responses:
'200':
description: whether the schema is compatible
content:
application/vnd.schemaregistry.v1+json:
schema:
type: object
properties:
is_compatible:
type: boolean
description: whether the schema is compatible
'404':
description: 40401 -- Subject not found<br> 40402 -- Version not found
'422':
description: 42201 -- Invalid Avro schema 42202 -- Invalid version
'500':
description: 50001 -- Error in the backend data store
/config:
get:
description: get the top level config
responses:
'200':
description: config
content:
application/json:
schema:
$ref: '#/components/schemas/config'
put:
description: update the global config
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/config'
responses:
'200':
description: change successful
content:
application/json:
schema:
type: object
'422':
description: 42203 -- Invalid compatibility level
'500':
description: >-
50001 -- Error in the backend data store 50003 -- Error while
forwarding the request to the primary
'/config/{subject}':
get:
parameters:
- name: subject
in: path
description: subject name
required: true
schema:
type: string
description: get the subject config
responses:
'200':
description: config
content:
application/json:
schema:
$ref: '#/components/schemas/config'
put:
parameters:
- name: subject
in: path
description: subject name
required: true
schema:
type: string
description: update the subject config
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/config'
responses:
'200':
description: change successful
content:
application/json:
schema:
type: object
'422':
description: 42203 -- Invalid compatibility level
'500':
description: >-
50001 -- Error in the backend data store 50003 -- Error while
forwarding the request to the primary
components:
schemas:
schema:
type: object
properties:
schema:
type: object
integer_array:
type: array
items:
type: integer
config:
type: object
properties:
compatibility:
type: string
enum:
- BACKWARD
- BACKWARD_TRANSITIVE
- FORWARD
- FORWARD_TRANSITIVE
- FULL
- FULL_TRANSITIVE
- NONE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment