ImFlog / schema-registry-plugin

Gradle plugin to interact with Confluent Schema-Registry.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update forked avro plugin

ImFlog opened this issue · comments

It's been a long time since I didn't do it, could be good to avoid too big desynchronization.

I tried a bit to update the plugin but it's pretty hard to maintain as I cannot cleanly add a new piece of code without being impacted by the changes in Avro code.

So I got a new idea 💡

We could treat the schema as a string and not as a Json Schema object. And thus:

  • Search for local reference names in the schema (in reverse, starting with the top level references)
  • For each one, replace by the content of the local reference schema
    ⚠️ Do we need to do some kind of check before replacing ? For instance that it's a type or an array ?
    -> Probably because else we could also replace name values for instance
    💡 We could use a regexp to find the local reference and then check if it's a type or an array or an union ? => Might be hard if everything is on the same line
    -> This is only 3 cases, we can find 3 regexp that match. Maybe we can prettify the schema before to make it easier to find the local reference.
  • If the local reference is not found, we could throw an error
  • Then classic schema registry parsing

Need to POC this to see if it works. What's cool is that we already have the tests written so it's pretty simple to try.