You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Jun Rao <ju...@gmail.com> on 2013/12/30 20:06:08 UTC

generating specific record with shared common schema

Hi,

We have a bunch of avro schema files and want to generate specific record
for each. All schema files exist in a directory called X. Those schema
files may reference some common schemas defined in another directory called
Y. So far, we have been using some of the internal apis such as
Schema.parse(JsonNode schema, Names names) to achieve this. Is there an
easy way to achieve this using the public apis?

Thanks,

Jun

Re: generating specific record with shared common schema

Posted by Jun Rao <ju...@gmail.com>.
Got it. Thanks a lot.

Jun


On Thu, Jan 2, 2014 at 8:23 AM, David M. Carr <da...@carrclan.us> wrote:

> I'm doing something similar in my Gradle Avro plugin.  You can see the
> APIs being used here:
>
>
> https://github.com/commercehub-oss/gradle-avro-plugin/blob/de228e79a790db7a3d17482e95cd0b783c8cd6e3/src/main/java/com/commercehub/gradle/plugin/avro/GenerateAvroJavaTask.java#L107
>
>
> On Thu, Jan 2, 2014 at 10:44 AM, Jun Rao <ju...@gmail.com> wrote:
>
>> I am not using maven. What's the underlying Avro api being used?
>>
>> Thanks,
>>
>> Jun
>>
>>
>> On Wed, Jan 1, 2014 at 12:42 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>wrote:
>>
>>> If yours is a Maven project.
>>>
>>> How about using this ?
>>>
>>> <plugin>
>>>
>>> <groupId>org.apache.avro</groupId>
>>>
>>> <artifactId>avro-maven-plugin</artifactId>
>>>
>>> <version>1.7.5</version>
>>>
>>> <executions>
>>>
>>> <execution>
>>>
>>> <phase>generate-sources</phase>
>>>
>>> <goals>
>>>
>>> <goal>schema</goal>
>>>
>>> </goals>
>>>
>>> <configuration>
>>>
>>> <sourceDirectory>${project.basedir}/src/main/resources/avro/</
>>> sourceDirectory>
>>>
>>> </configuration>
>>>
>>> </execution>
>>>
>>> </executions>
>>>
>>> </plugin>
>>>
>>> Regards,
>>>
>>> Deepak
>>>
>>>
>>> On Tue, Dec 31, 2013 at 12:36 AM, Jun Rao <ju...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> We have a bunch of avro schema files and want to generate specific
>>>> record for each. All schema files exist in a directory called X. Those
>>>> schema files may reference some common schemas defined in another directory
>>>> called Y. So far, we have been using some of the internal apis such as
>>>> Schema.parse(JsonNode schema, Names names) to achieve this. Is there an
>>>> easy way to achieve this using the public apis?
>>>>
>>>> Thanks,
>>>>
>>>> Jun
>>>>
>>>
>>>
>>>
>>> --
>>> Deepak
>>>
>>>
>>
>
>
> --
> David M. Carr
> david@carrclan.us
>

Re: generating specific record with shared common schema

Posted by "David M. Carr" <da...@carrclan.us>.
I'm doing something similar in my Gradle Avro plugin.  You can see the APIs
being used here:

https://github.com/commercehub-oss/gradle-avro-plugin/blob/de228e79a790db7a3d17482e95cd0b783c8cd6e3/src/main/java/com/commercehub/gradle/plugin/avro/GenerateAvroJavaTask.java#L107


On Thu, Jan 2, 2014 at 10:44 AM, Jun Rao <ju...@gmail.com> wrote:

> I am not using maven. What's the underlying Avro api being used?
>
> Thanks,
>
> Jun
>
>
> On Wed, Jan 1, 2014 at 12:42 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>wrote:
>
>> If yours is a Maven project.
>>
>> How about using this ?
>>
>> <plugin>
>>
>> <groupId>org.apache.avro</groupId>
>>
>> <artifactId>avro-maven-plugin</artifactId>
>>
>> <version>1.7.5</version>
>>
>> <executions>
>>
>> <execution>
>>
>> <phase>generate-sources</phase>
>>
>> <goals>
>>
>> <goal>schema</goal>
>>
>> </goals>
>>
>> <configuration>
>>
>> <sourceDirectory>${project.basedir}/src/main/resources/avro/</
>> sourceDirectory>
>>
>> </configuration>
>>
>> </execution>
>>
>> </executions>
>>
>> </plugin>
>>
>> Regards,
>>
>> Deepak
>>
>>
>> On Tue, Dec 31, 2013 at 12:36 AM, Jun Rao <ju...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> We have a bunch of avro schema files and want to generate specific
>>> record for each. All schema files exist in a directory called X. Those
>>> schema files may reference some common schemas defined in another directory
>>> called Y. So far, we have been using some of the internal apis such as
>>> Schema.parse(JsonNode schema, Names names) to achieve this. Is there an
>>> easy way to achieve this using the public apis?
>>>
>>> Thanks,
>>>
>>> Jun
>>>
>>
>>
>>
>> --
>> Deepak
>>
>>
>


-- 
David M. Carr
david@carrclan.us

Re: generating specific record with shared common schema

Posted by Jun Rao <ju...@gmail.com>.
I am not using maven. What's the underlying Avro api being used?

Thanks,

Jun


On Wed, Jan 1, 2014 at 12:42 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com> wrote:

> If yours is a Maven project.
>
> How about using this ?
>
> <plugin>
>
> <groupId>org.apache.avro</groupId>
>
> <artifactId>avro-maven-plugin</artifactId>
>
> <version>1.7.5</version>
>
> <executions>
>
> <execution>
>
> <phase>generate-sources</phase>
>
> <goals>
>
> <goal>schema</goal>
>
> </goals>
>
> <configuration>
>
> <sourceDirectory>${project.basedir}/src/main/resources/avro/</
> sourceDirectory>
>
> </configuration>
>
> </execution>
>
> </executions>
>
> </plugin>
>
> Regards,
>
> Deepak
>
>
> On Tue, Dec 31, 2013 at 12:36 AM, Jun Rao <ju...@gmail.com> wrote:
>
>> Hi,
>>
>> We have a bunch of avro schema files and want to generate specific record
>> for each. All schema files exist in a directory called X. Those schema
>> files may reference some common schemas defined in another directory called
>> Y. So far, we have been using some of the internal apis such as
>> Schema.parse(JsonNode schema, Names names) to achieve this. Is there an
>> easy way to achieve this using the public apis?
>>
>> Thanks,
>>
>> Jun
>>
>
>
>
> --
> Deepak
>
>

Re: generating specific record with shared common schema

Posted by ๏̯͡๏ <ÐΞ€ρ@Ҝ>, de...@gmail.com.
If yours is a Maven project.

How about using this ?

<plugin>

<groupId>org.apache.avro</groupId>

<artifactId>avro-maven-plugin</artifactId>

<version>1.7.5</version>

<executions>

<execution>

<phase>generate-sources</phase>

<goals>

<goal>schema</goal>

</goals>

<configuration>

<sourceDirectory>${project.basedir}/src/main/resources/avro/</
sourceDirectory>

</configuration>

</execution>

</executions>

</plugin>

Regards,

Deepak


On Tue, Dec 31, 2013 at 12:36 AM, Jun Rao <ju...@gmail.com> wrote:

> Hi,
>
> We have a bunch of avro schema files and want to generate specific record
> for each. All schema files exist in a directory called X. Those schema
> files may reference some common schemas defined in another directory called
> Y. So far, we have been using some of the internal apis such as
> Schema.parse(JsonNode schema, Names names) to achieve this. Is there an
> easy way to achieve this using the public apis?
>
> Thanks,
>
> Jun
>



-- 
Deepak