Skip to content

Update the macro to support overloaded apply #19

Description

@gpoirier

The way the DSL code is generated by createSchema regarding the apply partially applied function, it prevent the possibility to have overloaded apply methods on the companion object of a case class where the macro is being used. There's a FIXME in the code related to this:
https://github.com/ypg-data/sparrow/blob/master/core/src/test/scala/com.mediative.sparrow/SchemaSpec.scala#L67

The solution is to replace the following style in the generated code:

implicit val schema = (
  field[String]("name") and
  field[Long]("count")
)(apply _)

By something of this style:

implicit val schema = (
  field[String]("name") and
  field[Long]("count")
)((name: String, count: Long) => apply(name, count))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions