[
https://issues.apache.org/jira/browse/AVRO-2371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746298#comment-17746298
]
Christophe Le Saec commented on AVRO-2371:
------------------------------------------
This should work if you put the list of file to compile in command :
{noformat}
avro\linking\user.avsc avro\linking\Department.avsc output
{noformat}
instead of "imports" command
> How can import one "avrofile" in another "avrofile" like java import
> --------------------------------------------------------------------
>
> Key: AVRO-2371
> URL: https://issues.apache.org/jira/browse/AVRO-2371
> Project: Apache Avro
> Issue Type: Improvement
> Reporter: Bheema
> Priority: Major
>
> {
> "type": "record",
> "name": "User",
> "namespace": "example.avro",
> "fields": [
> \{"name": "name", "type": "string"},
> \{"name": "favorite_number", "type": ["int", "null"]},
> \{"name": "favorite_color", "type": ["string", "null"]}
> ]
> }
>
>
> {"namespace": "example.avro",
> "type": "record",
> {color:#FF0000}*"imports": ["user.avsc"],*{color}
> "name": "Department",
> "fields": [
> \{"name": "name", "type": "string"},
> \{"name": "favorite_number", "type": ["int", "null"]},
> \{"name": "favorite_color", "type": ["string", "null"]},
> \{"name": "user","type": ["User"]}
> ]
> }
>
> Input files to compile:
> avro\linking\Department.avsc
> Exception in thread "main" org.apache.avro.SchemaParseException: Undefined
> name: "User"
> at org.apache.avro.Schema.parse(Schema.java:1228)
> at org.apache.avro.Schema.parse(Schema.java:1340)
> at org.apache.avro.Schema.parse(Schema.java:1269)
> at org.apache.avro.Schema$Parser.parse(Schema.java:1032)
> at org.apache.avro.Schema$Parser.parse(Schema.java:997)
> at
> org.apache.avro.tool.SpecificCompilerTool.run(SpecificCompilerTool.java:92)
> at org.apache.avro.tool.Main.run(Main.java:87)
> at org.apache.avro.tool.Main.main(Main.java:76)
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)