-
Notifications
You must be signed in to change notification settings - Fork 125
feat(cli): add possibility to fetch latest schema from schema registry #519
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
Conversation
There was a problem hiding this 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 introduces the ability to fetch the latest schema from the schema registry by allowing the "latest" version to be passed as a parameter.
- Refactored schema fetching logic via a new helper function (schemaFromRegistry).
- Updated parseSubjectVersion to return the version as a string to accommodate the "latest" keyword.
Comments suppressed due to low confidence (1)
cmd/avrogen/main.go:227
- [nitpick] The function name 'parseSubjectVersion' may be misleading now that it returns the version as a string instead of an integer. Consider renaming it (or adding a clarifying comment) to better reflect its behavior.
func parseSubjectVersion(entry string) (string, string, error) {
nrwiersma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Copilot suggestion here is good. Otherwise it looks fine.
There was a problem hiding this 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 adds functionality to allow fetching the latest schema from the schema registry when the "latest" keyword is used as the version parameter.
- Replaces inline client initialization and subject/version parsing with a new helper function, schemaFromRegistry.
- Refactors parseSubjectVersion into splitParameterEntry and integrates handling for the "latest" version case.
Comments suppressed due to low confidence (1)
cmd/avrogen/main.go:227
- [nitpick] Consider renaming 'splitParameterEntry' to 'parseSchemaRegistryEntry' to more clearly convey that it parses the subject and version from the registry entry.
func splitParameterEntry(entry string) (string, string, error) {
Goal of this PR
In case of struct generation from schema registry entries, we can pass not only numerical versions, but also a 'latest' version.
How did I test it?
Manual test with local schema registry.