You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Joseph Pachod <jo...@resurgences.com> on 2016/02/18 22:45:26 UTC

Generating Schema with the String type defined in it possible?

Hi

I use the Java SchemaBuilder and I define a code field ending up like this:
{"name":"code","type":["null","string"],"default":null}

Then I use the maven plugin to generate the pojo. However, in the generated
schema, this field is now:
{"name":"code","type":["null",{"type":"string","avro.java.string":"String"}],"default":null}

Is there a way to define it directly through the SchemaBuilder?

I tried adding prop but type is reserved, hence it doesn't work.

Thanks in advance

Best
joseph

Re: Generating Schema with the String type defined in it possible?

Posted by Joseph Pachod <jo...@resurgences.com>.
Hi

After some testing, this does the work :
.name("value").type().stringBuilder().prop("avro.java.string","String").endString()
this then ends in :
"fields":[{"name":"value","type":"string","avro.java.string":"String"}]

Great, thanks again for Avro =)
best

2016-02-18 22:45 GMT+01:00 Joseph Pachod <jo...@resurgences.com>:

> Hi
>
> I use the Java SchemaBuilder and I define a code field ending up like this:
> {"name":"code","type":["null","string"],"default":null}
>
> Then I use the maven plugin to generate the pojo. However, in the
> generated schema, this field is now:
>
> {"name":"code","type":["null",{"type":"string","avro.java.string":"String"}],"default":null}
>
> Is there a way to define it directly through the SchemaBuilder?
>
> I tried adding prop but type is reserved, hence it doesn't work.
>
> Thanks in advance
>
> Best
> joseph
>



-- 
*Joseph PACHOD*
Architecte logiciel
Activité Santé
Tél: *0811 696 386*
joseph.pachod@berger-levrault.fr

[image: inconnu.jpg]