Skip to content

Commit

Permalink
Fix Bug with types containing _ in their name
Browse files Browse the repository at this point in the history
There is a mismatch between the table creation and the debezium bridge. When a type name contains
'_' the resulting topic name was different. This led to errors in the validation. Debezium bridge
has been updated accordingly.

Signed-off-by: marcel <[email protected]>
  • Loading branch information
wagmarcel authored and abhijith-hr committed Oct 1, 2024
1 parent 2ee4292 commit 3dbe788
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions KafkaBridge/debeziumBridge/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ const getSubClasses = async function (klass) {
* camelCase => camel_case
* @param {*} str string in Pascal/camelCase
*/
const pascalCaseToSnakeCase = function (str) {
return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
const pascalCaseToSnakeCase = function (name) {
return name.replace(/(?<!^)(?=[A-Z])/g, '_').toLowerCase();
};

/**
Expand Down
4 changes: 2 additions & 2 deletions KafkaBridge/test/testDebeziumBridgeApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe('Test GetTopic', function () {
});
it('Should return last part in snake_case', async function () {
const getTopic = toTest.__get__('getTopic');
const result = getTopic('http://example/Device_Test');
result.should.equal('device_test');
const result = getTopic('http://example/Device_Test_WithUnderscore');
result.should.equal('device__test__with_underscore');
});
it('Should return reference part of url', async function () {
const getTopic = toTest.__get__('getTopic');
Expand Down

0 comments on commit 3dbe788

Please sign in to comment.