confluentinc / confluentinc/confluent-kafka-javascript

Schema Registry: getSchemaById method missing

Open
#250 1 comment 0 reactions 0 assignees View on GitHub
component:schema-registry
Dominant language
TypeScript
Stars
304
Forks
45
Avg merge
11h 47m
Merged PRs (30d)
5

Description

Hi all,

We are currently migrating from using `@kafkajs/confluent-schema-registry` to `@confluentinc/schemaregistry`, but one element of the deserialization process is causing us an issue with migrating.

For `@kafkajs/confluent-schema-registry`, the deserialization method only requires the buffer to be passed in. Under the hood, it decodes the `registryId` from the payload, and uses the `getSchemaById` method to complete the deserialization of the payload. You can see the code pointer [here](https://github.com/kafkajs/confluent-schema-registry/blob/master/src/SchemaRegistry.ts#L293-L331).

In `@confluentinc/schemaregistry`, deserialization requires both the topic and the buffer to be passed in. It seems like this is because, rather than `getSchemaById`, this library uses `getBySubjectAndId`. The code pointer for that is [here](https://github.com/confluentinc/confluent-kafka-javascript/blob/master/schemaregistry/serde/serde.ts#L340-L351).

Unfortunately in our specific use case, it's going to be a challenge to thread through the topic to the point where we do our message deserialization - would it be possible to change this interface so that it only requires the buffer instead? Or is there a reason we are missing as to why `getBySubjectAndId` is required in this case?

Thanks in advance!

Contributor guide

Open the contributing guide

Research direction

Start by reading schemaregistry/serde/serde.ts around the referenced deserialization code and compare it with the linked SchemaRegistry.ts implementation. Determine whether schema lookup can be performed from the buffer without a topic, then verify that the deserialization interface and its behavior meet that requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.