Git Product home page Git Product logo

Comments (6)

opwvhk avatar opwvhk commented on June 6, 2024

Thank you for the example; this is really helpful.

The tricky bit with comments in .avdl files is that Avro accepts them almost everywhere.

For example, the following example shows errors in the plugin but Avro happily allows it (and attributes the comment inside Plain to the next record Commented):

protocol MyProtocol {
    record Plain {
        int number; /** record comment */
    }
    record Commented {
        string text;
    }
}

It was a conscious decision not to support every case.

Having said that, switching annotations and comments is not as weird as the example above, so the upcoming version 203.0.2 will no longer choke on it.

from avro-schema-support.

caspermeijn avatar caspermeijn commented on June 6, 2024

Thank you for your reaction. I tested version 203.0.2 and it works with the given example. However I found that my simplified example was too simple. The received file can still not be parsed because of another comment before the version.

Below is a new simplified example:

/**
 * Copyright notice
 */
@version("1.0.0")

/**
 Multi line Comment about the message
 Multi line Comment about the message
 */
protocol MyProtocol {
}

I understand the struggles with the comments. In Xtext (a tool to create domain specific languages) you can specify that comments are hidden for the parser, therefore comments can be everywhere in the code. Maybe such a thing also exists for IntelliJ.

from avro-schema-support.

opwvhk avatar opwvhk commented on June 6, 2024

I can do that, but this would also remove the documentation comments from the elements. This in turn affects error handling by the parser, formatting, etc. Besides, it is actually a semantic error to specify two documentation comments for an element — the IDL parser will only use the last one.

I'll see if I can rework it as a warning (dangling doc comment).

from avro-schema-support.

opwvhk avatar opwvhk commented on June 6, 2024

The adjustments look good at first glance. Uploaded version 203.1.0.

from avro-schema-support.

caspermeijn avatar caspermeijn commented on June 6, 2024

This fixes parsing the files. I have some Dangling documentation warnings in the files, but navigating the files works fine. I will report the warnings to the supplier.

Thanks for solving this issue!

from avro-schema-support.

opwvhk avatar opwvhk commented on June 6, 2024

Correct: I've added these warnings, as the Avro IDL parser will ignore them.

from avro-schema-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.