Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated case class does not compile due to missing constructor parameters #150

Open
gintautassulskus-elsevier opened this issue Jun 2, 2021 · 0 comments

Comments

@gintautassulskus-elsevier
Copy link

gintautassulskus-elsevier commented Jun 2, 2021

For the following Avro schema

{
  "type": "record",
  "name": "RecordName",
  "namespace": "some.namespace",
  "fields": [
    {
      "name": "parentField",
      "type": {
        "type": "record",
        "name": "RecordName2",
        "fields": [
          {
            "name": "recordField1",
            "type": [
              "null",
              "string"
            ],
            "default": null
          },
          {
            "name": "recordField2",
            "type": [
              "null",
              "string"
            ],
            "default": null
          }
        ]
      },
      "default": {}
    }
  ]
}

avrohugger generates an invalid case classRecordName that tries to instantiate RecordName2 with no parameters.

final case class RecordName(var parentField: RecordName2 = new RecordName2(, )) extends org.apache.avro.specific.SpecificRecordBase {
  def this() = this(new RecordName2(, ))

The generator seems to work fine if either recordField1 or recordField2 is removed and/or "default": {}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant