You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a record with a fixed type. Both have the record and the fixed type have namespaces set.
I can rename the namespace of the record with avrohugger, but not the namespace of the fixed type
classSpecificSameRecordNameAsNamespaceSpecextends mutable.Specification {
"a Generator" should {
"generate files that compile even if the name of a record is the same as the name of a namespace" in {
valinfile=new java.io.File("avrohugger-core/src/test/avro/SpecificSameRecordNameAsNamespace.avsc")
valgen=newGenerator(SpecificRecord, avroScalaCustomNamespace =Map(
"namespace.conflict.same_name"->"namespace.renamed",
"namespace.conflict"->"namespace.no_conflict"
))
valoutDir= gen.defaultOutputDir +"/specific"
gen.fileToFile(infile, outDir)
valsourceRecord= scala.io.Source.fromFile(s"$outDir/namespace/no_conflict/same_name.scala").mkString
sourceRecord ==== util.Util.readFile("avrohugger-core/src/test/expected/specific/namespace/no_conflict/same_name.scala")
valsourceFixedType= scala.io.Source.fromFile(s"$outDir/namespace/renamed/fixed.scala").mkString
sourceFixedType ==== util.Util.readFile("avrohugger-core/src/test/expected/specific/namespace/renamed/fixed.scala")
}
}
}
This test fails because the fixed type is not renamed and so is written to the un-renamed directory
[info] a Generator should
[error] ! generate files that compile even if the name of a record is the same as the name of a namespace
[error] java.io.FileNotFoundException: target/generated-sources/specific/namespace/renamed/fixed.scala (No such file or directory) (SpecificSameRecordNameAsNamespaceSpec.scala:19)
For my use case, renaming only the record's namespace solved the issue I had (which is that the generated class FQN was the same as the fixed type package for this schema, resulting in compilation error for generated code).
The text was updated successfully, but these errors were encountered:
I have a record with a fixed type. Both have the record and the fixed type have namespaces set.
I can rename the namespace of the record with avrohugger, but not the namespace of the fixed type
Example avro schema.
Unit test demonstrating the issue
This test fails because the fixed type is not renamed and so is written to the un-renamed directory
For my use case, renaming only the record's namespace solved the issue I had (which is that the generated class FQN was the same as the fixed type package for this schema, resulting in compilation error for generated code).
The text was updated successfully, but these errors were encountered: