ImFlog/schema-registry-plugin

Use of Regex to Allow Downloading of Multiple Schemas

briancullen opened this issue · 4 comments

I was trying to use the plugin and one area that seemed a little cumbersome is that if you want to download a number of different schemas you have to list them all individually. As an improvement what do people think about being able to use a regex to specify the subject that we want to download?

I have created a simple change that supports this and will turn it into a PR in a few minutes to show you what I mean. I have made sure that the changes are backward compatible and while I know there are some areas that could be improved on it does currently work. Apart from the usual naming questions the following areas come to mind:

  1. If the regex is invalid an error message is printed and the regex is just skipped the error count returned by the task in not incremented.
  2. There is nothing to stop the same subject being downloaded multiple times if it matches multiple rules (although adding some deduplication wouldn't be too hard).
  3. The complete list of subject names is always fetched even if there are no regexs specified.

Be interested to know what people think. I'd find these changes useful.

Hello @briancullen and thank you for the interest in the plugin.

This seems to be a reasonable use case for schema download, I will take a look at your PR probably this week. Sorry for the delay I was on holidays :)

About the mentioned points :

  1. Maybe we could check the regexp when we define it instead of when we start the download action and return an error if the pattern is invalid ? This seems strange to me to allow people to use bad regexp and still return a "success"
  2. Seems OK for me to allow multiple download, as the output directories will probably be different.
  3. I guess this could be improved easily (will see in the PR)

Hello and thanks for the response.

I will take another look at the code when I get a chance, unfortunately I haven't been on vacation but this week has been a little busy. To be honest I didn't want to spend too much time on it until I knew if it was likely to be accepted.

Let me know if you have any other feedback.

No worries,
I took a look at the PR just now, you can find my remarks there. Should be good to be merged soon enough.

Released in 1.3.0 :)