Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 47B4D7B70 for ; Mon, 19 Dec 2011 17:33:55 +0000 (UTC) Received: (qmail 93795 invoked by uid 500); 19 Dec 2011 17:33:54 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 93685 invoked by uid 500); 19 Dec 2011 17:33:54 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 93479 invoked by uid 99); 19 Dec 2011 17:33:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 17:33:54 +0000 X-ASF-Spam-Status: No, hits=-2002.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 17:33:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C594411BB6F for ; Mon, 19 Dec 2011 17:33:31 +0000 (UTC) Date: Mon, 19 Dec 2011 17:33:31 +0000 (UTC) From: =?utf-8?Q?C=C3=A9dric_Torcq_=28Updated=29_=28JIRA=29?= To: dev@avro.apache.org Message-ID: <202922705.26915.1324316011810.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <648684330.26908.1324316011368.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (AVRO-983) maven-avro-plugin: Allow maven schema compiler to support external reference in an another avro schema file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AVRO-983?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] C=C3=A9dric Torcq updated AVRO-983: ------------------------------ Fix Version/s: 1.6.2 Status: Patch Available (was: Open) =20 > maven-avro-plugin: Allow maven schema compiler to support external refere= nce in an another avro schema file > -------------------------------------------------------------------------= ---------------------------------- > > Key: AVRO-983 > URL: https://issues.apache.org/jira/browse/AVRO-983 > Project: Avro > Issue Type: Improvement > Components: java > Affects Versions: 1.6.1 > Reporter: C=C3=A9dric Torcq > Fix For: 1.6.2 > > Original Estimate: 0.25h > Remaining Estimate: 0.25h > > Avro Maven plugin doesn't support an external reference in an another Avr= o schema file even this schema is available in the same src directory > Example : > {code:javascript}=20 > [ > =09{ > =09=09"namespace": "com.afklm.karma.demand.inter", > =09=09"name": "DatedFlightLegInterType", > =09=09"type": "record", > =09=09"fields": > =09=09=09[ > =09=09=09=09{ "name": "legOrgArp", "type": "string" }, > =09=09=09=09{ "name": "legDestArp", "type": "string" }, > =09=09=09=09{ "name": "legDepDate", "type": "long" }, > =09=09=09=09{ "name": "flightNb", "type": "string" }, > =09=09=09=09{ "name": "dfl", "type": "com.afklm.karma.demand.output.Dated= FlightLegType" } > =09=09=09] > =09}, > =09{ > =09=09"namespace": "com.afklm.karma.demand.inter", > =09=09"name": "AirportAirportDatedFlightLegInterType", > =09=09"type": "record", > =09=09"fields": > =09=09=09[ > =09=09=09=09{ "name": "aa", "type": "AirportAirportInterType" }, > =09=09=09=09{ "name": "legOrgArp", "type": "string" }, > =09=09=09=09{ "name": "legDestArp", "type": "string" }, > =09=09=09=09{ "name": "legDepDate", "type": "long" }, > =09=09=09=09{ "name": "flightNb", "type": "string" } > =09=09=09] > =09} > ] > {code}=20 > generate a fatal error : > {code}=20 > org.apache.avro.SchemaParseException: "com.afklm.karma.demand.output.Date= dFlightLegType" is not a defined name. The type of t > he "dfl" field must be a defined name or a {"type": ...} expression. > at org.apache.avro.Schema.parse(Schema.java:1131) > at org.apache.avro.Schema.parse(Schema.java:1200) > at org.apache.avro.Schema$Parser.parse(Schema.java:968) > at org.apache.avro.Schema$Parser.parse(Schema.java:945) > at org.apache.avro.mojo.SchemaMojo.doCompile(SchemaMojo.java:58) > at org.apache.avro.mojo.AbstractAvroMojo.compileFiles(AbstractAvr= oMojo.java:137) > at org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo= .java:107) > {code} > I propose a patch to support also this case : > In org.apache.avro.mojo.SchemaMojo (line 55): > =09=09// File src =3D new File(sourceDirectory, filename); > =09=09// Schema.Parser parser =3D new Schema.Parser(); > =09=09// Schema schema =3D parser.parse(src); > =09=09// SpecificCompiler compiler =3D new SpecificCompiler(schema); > =09=09// compiler.setTemplateDir(templateDirectory); > =09=09// compiler.setStringType(StringType.valueOf(stringType)); > =09=09// compiler.compileSchema(src, > =09=09// outputDirectory); > =09=09 > =09=09 > DirectoryScanner scanner =3D new DirectoryScanner(); > scanner.setBasedir(sourceDirectory); > scanner.setIncludes( getIncludes() ); > scanner.addDefaultExcludes(); > scanner.scan(); > File[] avroFiles =3D new File[scanner.getIncludedFiles().length]; > for (int i =3D 0; i < avroFiles.length; i++) { > =09avroFiles[i] =3D new File( scanner.getBasedir(), scanner.getIn= cludedFiles()[i] ); > =09=09} > SpecificCompiler.compileSchema(avroFiles, outputDirectory); -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira