Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfluentSchemaRegistryArgumentError: no such type #263

Open
hrebijan opened this issue Jul 2, 2024 · 0 comments
Open

ConfluentSchemaRegistryArgumentError: no such type #263

hrebijan opened this issue Jul 2, 2024 · 0 comments

Comments

@hrebijan
Copy link

hrebijan commented Jul 2, 2024

Hi!

In my project I'm using .proto schema:

syntax = "proto3";

package common;

import "google/protobuf/timestamp.proto";

enum EventType {
  EVENT_UNSPECIFIED = 0;
  CREATED = 1;
  UPDATED = 2;
  DELETED = 4;
}

message SomeMessage {
  string uid = 1;
  string text = 2;
}
...

When try to register schema:

 const { id } = await this.registry.register(schema, { subject: 'some.subject', compatibility: COMPATIBILITY.BACKWARD});

i got error:

ConfluentSchemaRegistryArgumentError: no such type: common..EventType
    at Object.exports.schemaFromConfluentSchema (/app/node_modules/.pnpm/@[email protected]/node_modules/@kafkajs/confluent-schema-registry/src/schemaTypeResolver.ts:99:11)
    at SchemaRegistry.register (/app/node_modules/.pnpm/@[email protected]/node_modules/@kafkajs/confluent-schema-registry/src/SchemaRegistry.ts:119:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
...

My suggest to solve this issue:
in: src/ProtoSchema.ts to lookup both types - messages and enums:

- this.message = root.lookupType(this.getTypeName(parsedMessage, opts))
+ this.message = root.lookupTypeOrEnum(this.getTypeName(parsedMessage, opts));

Question: why are in function getTypeName doubled dots pkg..name ?

My suggestion:

- return `${pkg ? pkg + '.' : ''}.${name}`;
+ return `${pkg ? pkg : ''}.${name}`;

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant