[
https://issues.apache.org/jira/browse/AVRO-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778953#comment-17778953
]
Oscar Westra van Holthe - Kind edited comment on AVRO-3890 at 10/24/23 8:09 AM:
--------------------------------------------------------------------------------
Adopting this new syntax will indeed take time. Even if there is an automatic
conversion (the IntelliJ/PyCharm/JetBrains plugin will support a quick fix that
can be applied on all files in a project or directory, recursively).
Adding an {{isImported}} method however, is specific to a single representation
(IDL), that isn't even the main representation. I'm not in favour of that.
What is feasible, is adding a schema property {{imported-from}} (or similar),
to imported schemata. If such a property is present, the schema is imported.
This will have to be behind a feature toggle though, as schema properties are
usually reserved for what a schema {*}is{*}, and not where it was read from.
was (Author: opwvhk):
Adopting this new syntax will indeed take time. Even if there is an automatic
conversion (the IntelliJ/PyCharm/JetBrains plugin will support a quick fix that
can be applied on all files in a project or directory (recursively).
Adding an {{isImported}} method however, is specific to a single representation
(IDL), that isn't even the main representation. I'm not in favour of that.
What is feasible, is adding a schema property {{imported-from}} (or similar),
to imported schemata. If such a property is present, the schema is imported.
This will have to be behind a feature toggle though, as schema properties are
usually reserved for what a schema {*}is{*}, and not where it was read from.
> Add feature to know if schema is imported in avdl
> -------------------------------------------------
>
> Key: AVRO-3890
> URL: https://issues.apache.org/jira/browse/AVRO-3890
> Project: Apache Avro
> Issue Type: New Feature
> Components: java
> Affects Versions: 1.11.2, 1.11.3
> Reporter: Thun Hak
> Priority: Minor
>
> consider the this invoice.avdl:
> {code:java}
> @namespace("purchase")
> protocol InvoiceProtocol{
> import idl "../customer/data.avdl";
> import idl "../product/data.avdl";
> record Invoice{
> timestamp_ms purchaseTime;
> customer.Customer customer;
> array<product.Item> items = [];
> }
> }{code}
> now, if I do this:
> {code:java}
> for(Schema s : protocol.getTypes()){
> System.out.println(s.getName() + " " + s.isImported());
> }{code}
> this should produce
> {code:java}
> Customer true
> Item true
> Invoice false{code}
> I have some use case where we want to perform operations only to the "main"
> schema and leave all imported schema alone.
> This feature (s.isImported()) would be really nice to have (if it's not
> available already).
> Thanks
--
This message was sent by Atlassian Jira
(v8.20.10#820010)