Skip to content

Add assemble methods in Courier record companions that use field inclusion #39

@josh-newman

Description

@josh-newman

Right now, records that use field inclusion have the standard two construction methods in their companion (building from DataMap and with all fields specified explicitly). I think it'd be useful to add additional methods, perhaps called assemble, that accept the included arguments as records instead of individual fields. For example:

record A {
  field1: int
  // many others
}

record B {
  ...A
  fieldB: string
}

I'd like to construct B with B.assemble(A(...), "fieldB"), instead of B(1, ..., "fieldB").

For records with multiple inclusions, I think generating a single assemble that accepts all included records plus all additional fields is sufficiently useful (rather than worrying about the complexity of overloads for different inclusion combinations).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions