How do I load a avro schema in IntelliJ?

10,500

Solution 1

I recently started an Avro project and was annoyed at having to use avro-tools.jar, so I made an IntelliJ plugin - https://plugins.jetbrains.com/plugin/12281-avro-and-parquet-viewer/. Drag-and-drop Avro and Parquet files to view them in plain text, JSON and tabular views, alongside their schemas.

For Visual Studio Code users, my colleagues use https://marketplace.visualstudio.com/items?itemName=dvirtz.parquet-viewer.

Solution 2

What I ended up doing is:

Download avro tools: https://github.com/miguno/avro-cli-examples/blob/master/README.md

Use the following tools from the jar

idl2schemata  Extract JSON schemata of the types from an Avro IDL file
compile  Generates Java code for the given schema

The resulting set of java classes I put under the correct package in my code.

This at least made the type checker happy in IntelliJ. Did not run the code yet.

Share:
10,500
WillamS
Author by

WillamS

Updated on July 28, 2022

Comments

  • WillamS
    WillamS almost 2 years

    I cloned a project from github and now have it open as a project in IntelliJ. The project is written in Scala.

    The project depends on some objects defined in an avro schema that is in another project on github. The avro schema is a single *.avdl file.

    How do I load the avro *.advl schema / file in my project in IntelliJ?

    So that the object types defined in the avro schema are known in the rest of the project.

    Does IntelliJ recognize avro *.advl files? Do I need to generate Scala/Java classes somehow from the avro advl file? And then load these classes?

  • WillamS
    WillamS over 8 years
    Yes but I am not sure what the plugin does. I did not find out how it could load the advl file.