Skip to content
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

fix: improve avro library detection #31

Merged

Conversation

yannrouillard
Copy link
Contributor

@yannrouillard yannrouillard commented Feb 5, 2024

So far we checked for the presence of the library in the target schema
class file but this library could be loaded indirectly and not
explicitely listed.

As a fallback, we now:

  • look for the library string without the import keyword, to allow
    to specify it using the schemas static annotation if needed
    (for instance 'Schema(library="com.sksamuel.avro4s")')

  • search for the library in the build.sbt as well.

Yann Rouillard added 2 commits February 5, 2024 11:31
So far we checked for the presence of the library in the target schema
class file but this library could be loaded indirectly and not
explicitely listed.

As a fallback, we now:

 - look for the library string without the import keyword, to allow
   to specify it using the schemas static annotation if needed
   (for instance '@Schema(library="com.sksamuel.avro4s")')

 - search for the library in the build.sbt as well.
Instead of requiring the project to load the com.lihaoyi.upickle
and com.lihaoyi.os-lib libraries in the project, we now dynamically
add them to the dependencies when running the schema generation command.

It still not bulletproof as it could lead to version conflict with
existing libraries but it will good enough for now :-)
@yannrouillard yannrouillard self-assigned this Feb 5, 2024
@yannrouillard yannrouillard merged commit c579893 into main Feb 5, 2024
@yannrouillard yannrouillard deleted the fix/PTFM-9207/fix-some-issues-in-kafka-schema-generation branch February 5, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants