src_managed
. Avrohugger generates into that directory by default, in target
, intended for source files managed totally by sbt (and thus are excluded from publishing as well). Overriding that is probably a question for sbt, but I wonder if it'll work for you if you configure Avrohugger's output to use a directory in src
, e.g. https://github.com/julianpeeters/sbt-avrohugger/blob/master/src/sbt-test/sbt-avrohugger/overridesettings/build.sbt#L12
avroSpecificScalaSource
. https://github.com/julianpeeters/sbt-avrohugger#settings
Hey @julianpeeters avrohugger does not seem to support indirect recursion in schemas despite it being fine in avro. e.g.
{
"type": "record",
"name": "A",
"fields": [
{
"name": "B",
"type": [
"null",
{
"name": "C",
"type": "record",
"fields": [
{
"name": "D",
"type": [
"null",
"A"
]
},
]
}
]
}
]
}
Avrohugger is throwing a key not found
error.
I did some investigating into the code and I noticed that problem is with the order of type registration and compilation. There is a SourceFormat.registerType
method call for each “compilation unit”. I imagine the assumption was that as a topological search is being done first then it would be safe to do registration just before compiling each unit. However in order to support indirect recursion you would have to to register all types first before you can start compiling them.
Would it be possible to change this in order to support indirect recursion?
Hi, I am trying to generate an ADT from this schema using ScalaADT
protocol Foo {
record Bar {
string a;
}
record Baz {
string b;
}
}
but what I get is
/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */
final case class Bar(a: String)
final case class Baz(b: String)
I would have expected this
/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */
sealed trait Foo
final case class Bar(a: String) extends Foo
final case class Baz(b: String) extends Foo
Inside the build.sbt file I have inserted
avroScalaSpecificCustomTypes in Compile := {
avrohugger.format.Standard.defaultTypes.copy(
protocol = avrohugger.types.ScalaADT)
}
sourceGenerators in Compile += (avroScalaGenerate in Compile).taskValue
Did I omit something?
Is the behavior I have described to you actually what one should expect?
I apologize if it is a known problem and if it is just my misunderstanding, and I hope not to waste your time unnecessarily.
Thank you
And I'm having the first issue:
new MemberData(, , , , , , , , , , )
Do you know why it's generating those ,
?
It's not compilable code
new MemberData()
instead
I've got my build.sbt file setup as:
import Dependencies._
import sbt._
ThisBuild / scalaVersion := "2.13.2"
ThisBuild / version := "0.0.1"
lazy val root = (project in file("."))
.settings(
name := "ziostreams",
libraryDependencies ++= Seq(
zio, zioKafka, zioStreams, avro
)
).settings(
// watchSources ++= ((avroSourceDirectory in Compile).value ** "*.avdl").get
// ,
sourceGenerators in Compile += (avroScalaGenerate in Compile).taskValue
)
And the plugin.sbt file set to use 2.0.0-RC4
When I do a sbt compile I'm getting error not found value avroScalaSourceDirectory and avroScalaGenerate (other line is uncommented)