Fixes #25434: allow empty Kafka schema registry suffix#27496
Fixes #25434: allow empty Kafka schema registry suffix#27496himanshu748 wants to merge 3 commits intoopen-metadata:mainfrom
Conversation
Allow saving an explicit empty schemaRegistryTopicSuffixName in the Kafka connection form by using rjsf ui:emptyValue, preventing the schema default (-value) from being restored. Made-with: Cursor
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
There was a problem hiding this comment.
Pull request overview
Enables Kafka connection forms to persist an explicitly empty schemaRegistryTopicSuffixName by configuring the RJSF UI schema to submit an empty string (instead of omitting the field and re-applying the schema default).
Changes:
- Add a Kafka-specific
uiSchemaoverride settingui:emptyValueforschemaRegistryTopicSuffixName. - Add unit tests for
getMessagingConfigcovering Kafka and other messaging connector types.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts |
Adds ui:emptyValue override for Kafka so clearing the suffix field persists as ''. |
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.test.ts |
Adds unit coverage asserting the Kafka config includes the ui:emptyValue override. |
Comments suppressed due to low confidence (1)
openmetadata-ui/src/main/resources/ui/src/utils/MessagingServiceUtils.ts:60
schemaRegistryTopicSuffixNamealso exists in the Redpanda connection schema with the same default of "-value" (seeopenmetadata-spec/.../redpandaConnection.json). With the current change, Redpanda users will likely still be unable to persist an explicitly empty suffix for the same reason Kafka was affected. Consider applying the sameui:emptyValue: ''override forMessagingServiceType.Redpanda(and updating the corresponding test expectation) so behavior is consistent across messaging connectors that expose this field.
switch (type) {
case MessagingServiceType.Kafka:
schema = kafkaConnection;
/**
* By default, rjsf may treat an empty text input as `undefined` and omit the field
* from the submitted payload. Since the Kafka connection schema has a default
* `schemaRegistryTopicSuffixName` of "-value", omitting the field causes the
* value to be restored to the default after saving.
*
* Setting `ui:emptyValue` ensures a cleared input is persisted as an explicit
* empty string.
*/
Object.assign(uiSchema, {
schemaRegistryTopicSuffixName: { 'ui:emptyValue': '' },
});
break;
case MessagingServiceType.Redpanda:
schema = redpandaConnection;
| it('getMessagingConfig should return correct config for Redpanda connector', () => { | ||
| const config = getMessagingConfig(MessagingServiceType.Redpanda); | ||
|
|
||
| expect(config).toEqual({ | ||
| schema: { ...redpandaConnection }, | ||
| uiSchema: { ...COMMON_UI_SCHEMA }, |
There was a problem hiding this comment.
This test currently asserts Redpanda returns the unmodified COMMON_UI_SCHEMA. If you extend the ui:emptyValue fix to MessagingServiceType.Redpanda (recommended since Redpanda also defaults schemaRegistryTopicSuffixName to "-value"), update this expectation to include the override as well; otherwise the test will lock in the inconsistent behavior.
| it('getMessagingConfig should return correct config for Redpanda connector', () => { | |
| const config = getMessagingConfig(MessagingServiceType.Redpanda); | |
| expect(config).toEqual({ | |
| schema: { ...redpandaConnection }, | |
| uiSchema: { ...COMMON_UI_SCHEMA }, | |
| it('getMessagingConfig should return correct config for Redpanda connector and preserve empty schema suffix', () => { | |
| const config = getMessagingConfig(MessagingServiceType.Redpanda); | |
| expect(config).toEqual({ | |
| schema: { ...redpandaConnection }, | |
| uiSchema: { | |
| ...COMMON_UI_SCHEMA, | |
| schemaRegistryTopicSuffixName: { 'ui:emptyValue': '' }, | |
| }, |
|
Hi! This PR is ready for CI. Could a maintainer please add the label so the workflows can run? (Currently failing at the label gate.) Thanks! |
|
Hi! This PR is ready for CI. Could a maintainer please add the |
Apply the same rjsf ui:emptyValue override used for Kafka to Redpanda, since the connection schema defines the same default (-value). Made-with: Cursor
|
Addressed Copilot review suggestion: applied the same override to Redpanda as well (schema has the same default ). |
|
Addressed Copilot review suggestion: applied the same |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Made-with: Cursor
|
Gitar suggestion addressed: added a brief comment explaining why the Redpanda override exists (same rationale as Kafka). |
|
Gitar suggestion addressed: added a brief comment explaining why the Redpanda |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 1 resolved / 1 findingsAllows an empty Kafka schema registry suffix to resolve configuration constraints. Added an explanatory comment to the Redpanda case to match existing documentation. ✅ 1 resolved✅ Quality: Redpanda case missing explanatory comment unlike Kafka case
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Describe your changes:
Fixes #25434
Kafka schema registries sometimes do not use a topic suffix (e.g.
-value). The UI connection form currently restores the schema default (-value) when the field is cleared, making it impossible to persist an explicitly empty suffix.This change sets
ui:emptyValueforschemaRegistryTopicSuffixNameon the Kafka connection form so a cleared input is submitted as an explicit empty string.Testing
MessagingServiceUtilsconfig includesui:emptyValueoverride for Kafka.Type of change:
Checklist:
Hackathon / AI disclosure
Built with Cursor (AI-assisted) and manually reviewed.
Made with Cursor