Skip to content

Fixes #25434: Preserve empty string for Kafka schemaRegistryTopicSuffixName#27015

Merged
aniketkatkar97 merged 9 commits intoopen-metadata:mainfrom
RajdeepKushwaha5:fix/25434-kafka-empty-suffix-name
Apr 21, 2026
Merged

Fixes #25434: Preserve empty string for Kafka schemaRegistryTopicSuffixName#27015
aniketkatkar97 merged 9 commits intoopen-metadata:mainfrom
RajdeepKushwaha5:fix/25434-kafka-empty-suffix-name

Conversation

@RajdeepKushwaha5
Copy link
Copy Markdown
Contributor

@RajdeepKushwaha5 RajdeepKushwaha5 commented Apr 3, 2026

Describe your changes:

Fixes #25434

What changes did you make?

When editing a Kafka or Redpanda connection, clearing the schemaRegistryTopicSuffixName field to an empty string reverts it to the schema default "-value" after saving. This prevents users whose Kafka schema registry does not use topic suffixes from configuring the connection correctly.

Root cause: RJSF (React JSON Schema Form) converts empty text inputs to undefined, which removes the field from formData. During the connection update merge, the old value ("-value") is preserved via object spread from the existing config. The backend never receives the empty string.

Fix: Added 'ui:emptyValue': '' to the RJSF uiSchema for the schemaRegistryTopicSuffixName field in both Kafka and Redpanda connection configs. This instructs RJSF to use an empty string ("") instead of undefined when the user clears the field, so the empty value is properly included in the form data and sent to the backend.

How did you test your changes?

  • Added unit tests in MessagingServiceUtils.test.ts verifying:
    • Kafka uiSchema includes ui:emptyValue: "" for schemaRegistryTopicSuffixName
    • Redpanda uiSchema includes ui:emptyValue: "" for schemaRegistryTopicSuffixName
    • Non-broker services (e.g. Kinesis) do NOT include this override
    • Invalid service types return only the common UI schema
  • All 4 tests pass
  • ESLint and Prettier checks pass

Files changed:

  • openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts — Added SCHEMA_REGISTRY_SUFFIX_UI_SCHEMA constant with ui:emptyValue and applied it to Kafka/Redpanda cases
  • openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.test.ts — New test file covering the fix

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.
  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

Summary by Gitar

  • Refactor:
    • Updated import path for COMMON_UI_SCHEMA to point to ServiceUISchema.constant.
  • Code Quality:
    • Improved retVal return logic in MessagingServiceUtils.ts to handle undefined checks more explicitly.

This will update automatically on new commits.

@RajdeepKushwaha5 RajdeepKushwaha5 requested a review from a team as a code owner April 3, 2026 08:42
Copilot AI review requested due to automatic review settings April 3, 2026 08:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an OpenMetadata UI bug where clearing schemaRegistryTopicSuffixName in Kafka/Redpanda connections could not be persisted because RJSF converted an empty string input to undefined, causing the backend update merge to retain the prior/default value.

Changes:

  • Add an RJSF ui:emptyValue: '' override for schemaRegistryTopicSuffixName in Kafka and Redpanda messaging connection UI schemas.
  • Add unit tests to verify the override is present for Kafka/Redpanda, absent for non-broker services, and that invalid service types return only the common UI schema.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts Extends Kafka/Redpanda uiSchema to preserve empty string values for schemaRegistryTopicSuffixName via ui:emptyValue.
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.test.ts Adds focused unit tests validating the new uiSchema behavior across service types and default handling.

@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@RajdeepKushwaha5
Copy link
Copy Markdown
Contributor Author

Bug #25434 — Kafka schemaRegistryTopicSuffixName cannot be cleared

Running vanilla OpenMetadata 1.11.7 in Docker (docker.getcollate.io/openmetadata/server:1.11.7). I create a Kafka messaging service with schemaRegistryTopicSuffixName = -value, then edit the connection, clear the field, and save. On re-opening the Edit Connection dialog, the field still shows -value — the clear silently failed.

Root cause: the RJSF uiSchema for Kafka/Redpanda has no ui:emptyValue hint, so RJSF treats the empty string as undefined and omits the field from the PATCH payload. The backend never receives the update and keeps the stale value.

kafkabug.mp4

@RajdeepKushwaha5
Copy link
Copy Markdown
Contributor Author

Fix #25434 — PR #27015

Same Docker backend (OpenMetadata 1.11.7) — only the UI layer is swapped for the Vite dev server running this branch. The fix adds { 'ui:emptyValue': '' } to the uiSchema for schemaRegistryTopicSuffixName on both Kafka and Redpanda messaging services (MessagingServiceUtils.ts .

I repeat the same flow from Video 1: open the existing Kafka service, clear the field, save, and re-open. The field is now correctly empty — RJSF submits "" instead of dropping the property, so the backend persists the clear.

Coverage: 4 new Jest tests in MessagingServiceUtils.test.ts — 2 positive (Kafka + Redpanda get the emptyValue hint) and 2 negative regression guards (Kinesis and invalid types don't). All 4 pass.

kafkafix.mp4

aniketkatkar97
aniketkatkar97 previously approved these changes Apr 17, 2026
@aniketkatkar97 aniketkatkar97 dismissed their stale review April 17, 2026 05:28

Missing playwright coverage

@aniketkatkar97
Copy link
Copy Markdown
Member

Hey @RajdeepKushwaha5, Awesome work. Can we also add playwright coverage for the same? I think you can just add the test case in existing ServiceForm.spec.ts.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.32% (59296/93638) 43.61% (31452/72106) 46.49% (9436/20293)

…xName (open-metadata#25434)

Adds a regression test in ServiceForm.spec.ts that creates a Kafka messaging service with schemaRegistryTopicSuffixName='-value', clears the field in the edit-connection form, and asserts the PATCH payload carries an explicit empty string and that the cleared value persists on reload. Addresses review feedback on PR open-metadata#27015 requesting Playwright coverage.
Copilot AI review requested due to automatic review settings April 17, 2026 07:09
@RajdeepKushwaha5
Copy link
Copy Markdown
Contributor Author

RajdeepKushwaha5 commented Apr 17, 2026

Hey @RajdeepKushwaha5, Awesome work. Can we also add playwright coverage for the same? I think you can just add the test case in existing ServiceForm.spec.ts.

Thanks for the review, @aniketkatkar97! I've pushed 7a63739 adding a Playwright regression test to ServiceForm.spec.ts under a new Kafka describe block, right next to the existing Superset / Looker suites.

The test covers the exact user flow from the bug report:

Creates a Kafka messaging service via API with schemaRegistryTopicSuffixName: '-value'
Opens the service → Connection tab → Edit Connection.
Clears the schemaRegistryTopicSuffixName field.
Intercepts the PATCH /api/v1/services/messagingServices request and asserts the JSON Patch body contains an op at /connection/config/schemaRegistryTopicSuffixName with value: "" — this is what actually proves the fix (without 'ui:emptyValue': '', RJSF would drop the field entirely and this assertion would fail).
Reopens the edit form and asserts the field stays empty, confirming the backend persisted the clear.
Cleans up the service via API in afterAll.
Together with the existing Jest tests (which assert the uiSchema shape), this now locks in the behaviour end-to-end. Let me know if you'd like any tweaks to the selectors or if you'd prefer the service setup done through the UI instead of the API helper — happy to adjust!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +460 to +464
// Regression coverage for issue #25434 (PR #27015):
// Clearing `schemaRegistryTopicSuffixName` on a Kafka connection must
// send an empty string to the backend instead of dropping the field,
// so the cleared value is persisted on reload.
test.describe('Kafka', () => {
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description’s “Files changed” list omits this Playwright spec update. Please update the PR description to include openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/ServiceForm.spec.ts so reviewers/maintainers can see the added E2E regression coverage at a glance.

Copilot uses AI. Check for mistakes.
aniketkatkar97
aniketkatkar97 previously approved these changes Apr 17, 2026
Copilot AI review requested due to automatic review settings April 20, 2026 08:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.test.ts Outdated
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Apr 20, 2026

Code Review ✅ Approved

Explicitly preserves empty strings for the Kafka schemaRegistryTopicSuffixName configuration. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

@aniketkatkar97 aniketkatkar97 merged commit 2633b8d into open-metadata:main Apr 21, 2026
49 of 50 checks passed
aniketkatkar97 pushed a commit that referenced this pull request Apr 21, 2026
…ixName (#27015)

* Fixes #25434: Preserve empty string for Kafka schemaRegistryTopicSuffixName

* test(e2e): add Playwright coverage for empty schemaRegistryTopicSuffixName (#25434)

Adds a regression test in ServiceForm.spec.ts that creates a Kafka messaging service with schemaRegistryTopicSuffixName='-value', clears the field in the edit-connection form, and asserts the PATCH payload carries an explicit empty string and that the cleared value persists on reload. Addresses review feedback on PR #27015 requesting Playwright coverage.

* style: apply prettier formatting to ServiceForm.spec.ts

* style: drop PR number from regression comment per Copilot review

* fix(test): import COMMON_UI_SCHEMA from non-deprecated ServiceUISchema.constant per Copilot review
@aniketkatkar97
Copy link
Copy Markdown
Member

Cherry-picked to 1.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot set Kafka connection schemaRegistryTopicSuffixName parameter to an empty string

3 participants