Repository navigation
Fix: namespace schema compatibility strategy - #1386
Merged
RobertIndie merged 9 commits intoJul 2, 2025
Merged
RobertIndie merged 9 commits into
RobertIndie merged 9 commits into
Conversation
…rategy methods to manage schema compatibility settings
…CompatibilityStrategy methods
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR separates schema compatibility into two distinct strategies—auto-update and standard compatibility—by introducing a new SchemaAutoUpdateCompatibilityStrategy type, updating parsing logic, extending the namespace API, and adjusting tests.
- Add
SchemaAutoUpdateCompatibilityStrategytype with parse andString()methods - Update
Policiesstruct andNewDefaultPolicies()to include the auto-update strategy field - Extend the
Namespacesinterface and implementation to set/get both compatibility and auto-update strategies, plus update related tests
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/schema_strategy.go | Introduce new strategy type and parsing utilities |
| pkg/utils/schema_strategy_test.go | Add table-driven tests for both parsing and String() |
| pkg/utils/policies.go | Update Policies struct and defaults for auto-update field |
| pkg/admin/schema_test.go | Update assertions to use constant instead of string |
| pkg/admin/namespace_test.go | Add tests for setting/getting the new compatibility methods |
| pkg/admin/namespace.go | Extend interface and implementation with new methods |
Comments suppressed due to low confidence (2)
pulsaradmin/pkg/utils/schema_strategy.go:26
- [nitpick] This exported type lacks a GoDoc comment. Please add a doc comment above
SchemaAutoUpdateCompatibilityStrategyto explain its purpose.
type SchemaAutoUpdateCompatibilityStrategy string
pulsaradmin/pkg/admin/namespace.go:541
- The code uses
strings.ReplaceAllbut thestringspackage isn't imported, which will cause a compilation error. Please addimport "strings"at the top of this file.
s, err := utils.ParseSchemaCompatibilityStrategy(strings.ReplaceAll(string(b), "\"", ""))
nlu90
approved these changes
Jul 1, 2025
…n expected values and error handling
RobertIndie
approved these changes
Jul 1, 2025
Member
|
The CI failure is not related to this PR and would be fixed by #1387. merge this PR first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes #
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>to link to the master issue.)Master Issue: #
Motivation
Making pulsar-client-go support both https://github.com/apache/pulsar/blob/master/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/SchemaAutoUpdateCompatibilityStrategy.java and https://github.com/apache/pulsar/blob/master/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/SchemaCompatibilityStrategy.java
Modifications
Describe the modifications you've done.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation