JavaScript Schema Registry API for Data Transforms
This page contains the API reference for the Schema Registry client library of the data transforms JavaScript SDK.
Functions
newClient()
newClient (): <<SchemaRegistryClient, `SchemaRegistryClient`>>
Returns a client interface for interacting with Redpanda Schema Registry.
Example
import { newClient, SchemaFormat } from "@redpanda-data/sr";
var sr_client = newClient();
const schema = {
type: "record",
name: "Example",
fields: [
{ "name": "a", "type": "long", "default": 0 },
{ "name": "b", "type": "string", "default": "" }
]
};
const subj_schema = sr_client.createSchema(
"avro-value",
{
schema: JSON.stringify(schema),
format: SchemaFormat.Avro,
references: [],
}
);
decodeSchemaID()
decodeSchemaID (`buf`): <<DecodeResult, `DecodeResult`>>
Returns
DecodeResult in the same type as the given argument.
Interfaces
DecodeResult
The result of a decodeSchemaID function.
Schema
Properties
-
format(read only):SchemaFormat -
references(read only):Reference -
schema(read only):string
SchemaRegistryClient
Client interface for interacting with Redpanda Schema Registry.
Methods
-
createSchema(subject (string), schema):SubjectSchema -
lookupLatestSchema(subject (string)):SubjectSchema -
lookupSchemaById(id (number)):Schema -
lookupSchemaByVersion(subject (string), version (number)):SubjectSchema
SubjectSchema
Properties
-
id(read only):number -
schema(read only):Schema -
subject(read only):string -
version(read only):number