[ 
https://issues.apache.org/jira/browse/AVRO-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778960#comment-17778960
 ] 

Oscar Westra van Holthe - Kind commented on AVRO-3890:
------------------------------------------------------

A better solution is to define what makes a schema a "main" schema. Is that 
truly only how it's read? Or does it (also) relate to composition?

 

Based on composition, these are all possibilities to define a "main" schema:
 * The outermost schema in a {{.avsc}} file -- this is the most common 
definition
(this option does not apply to you, as you're using IDL)
 * The first schema defined in a protocol
 * All (named) schemata that are not referenced
 * All (named) schemata that are either not referenced, or the first 
encountered schema in a cycle

 

The good thing is that this approach does not require any change in Avro: you 
can start using it today if you like.

> 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)

Reply via email to