avro icon indicating copy to clipboard operation
avro copied to clipboard

AVRO-1524: avro-maven-plugin be able to generate schema from IDL

Open databius opened this issue 2 years ago • 8 comments

What is the purpose of the change

Implement AVRO-1524: update avro-maven-plugin to generate schema from IDL

Verifying this change

This change consists of several parts:

  • The new avro-maven-plugin configurations, plus tests
  • Documentation (1 file)

All changes have tests.

Documentation

  • Does this pull request introduce a new feature? (yes / ~no~)
  • If yes, how is the feature documented? (~not applicable~ / docs / ~JavaDocs~ / ~not documented~)

databius avatar Oct 25 '23 04:10 databius

Thank you for implementing this!

The idea is good, but plugin mojos should have one task.

Can you please create separate mojos for each of the two new actions?

opwvhk avatar Oct 25 '23 08:10 opwvhk

Thank you for implementing this!

The idea is good, but plugin mojos should have one task.

Can you please create separate mojos for each of the two new actions?

Agree that plugin mojos should have single responsibility. But the mojo names confused me.

Since https://github.com/apache/avro/pull/1589, we have:

  • IDLMojo - @goal idl - Generate Java classes and interfaces from AvroIDL files (.avdl)
  • IDLProtocolMojo - @goal idl-protocol - The old version of IDLMojo

IDLMojo looks like a generic IDL tool so I added the new actions to it. I think it would be clearer if it had a more meaningful name likes IDL2JavaMojo

And the new Mojos might be:

  • IDL2ProtocolMojo - @goal idl-2-protocol - Generate Json protocol from Avro IDL files (.avdl)
  • IDL2SchemaMojo - @goal idl-2-schema - Generate Json Schema from Avro IDL files (.avdl) Are they OK?

databius avatar Oct 25 '23 16:10 databius

Since #1589, we have:

  • IDLMojo - @goal idl - Generate Java classes and interfaces from AvroIDL files (.avdl)
  • IDLProtocolMojo - @goal idl-protocol - The old version of IDLMojo

IDLMojo looks like a generic IDL tool so I added the new actions to it. I think it would be clearer if it had a more meaningful name likes IDL2JavaMojo

And the new Mojos might be:

  • IDL2ProtocolMojo - @goal idl-2-protocol - Generate Json protocol from Avro IDL files (.avdl)
  • IDL2SchemaMojo - @goal idl-2-schema - Generate Json Schema from Avro IDL files (.avdl) Are they OK?

Looks good, but I'm not a fan of the -2- infix; it looks like a separate number. I prefer this without the dashes, but -to- as infix works as well.

Given that #1589 hasn't been released yet, what do you think of the following:

  • IDL2JavaMojo - @goal idl2java - Generate Java classes and interfaces from AvroIDL files (.avdl)
  • IDLProtocolMojo - @goal idl-protocol - The old version of IDLMojo
  • IDL2ProtocolMojo - @goal idl2protocol - Generate Json protocol from Avro IDL files (.avdl)
  • IDL2SchemaMojo - @goal idl2schema - Generate Json Schema from Avro IDL files (.avdl)

opwvhk avatar Oct 30 '23 07:10 opwvhk

Thanks for your comment. Just pushed some updates. Please help to take a look if you have time @opwvhk

databius avatar Nov 02 '23 03:11 databius

Thank @opwvhk for your approval. May I ask how to merge it to main?

databius avatar Nov 11 '23 04:11 databius

Any chance of getting this feature into a release soon?

westsail42 avatar Feb 08 '24 01:02 westsail42