Skip to content

Improve error message for ambiguous names in override application #765

@MateuszKubuszok

Description

@MateuszKubuszok

When field names passed in overrides are ambiguous (due to name comparator used), we currently use this piece of code:

runtimeField match {
case TransformerOverride.Unused =>
".withFieldUnused(...)"
case TransformerOverride.Const(_) =>
s".withFieldConst(_.$anotherToName, ...)"
case TransformerOverride.ConstPartial(_) =>
s".withFieldConstPartial(_.$anotherToName, ...)"
case TransformerOverride.Computed(_, _, _) =>
s".withFieldComputed(_.$anotherToName, ...)"
case TransformerOverride.ComputedPartial(_, _, _) =>
s".withFieldComputedPartial(_.$anotherToName, ...)"
case TransformerOverride.Renamed(sourcePath, _) =>
s".withFieldRenamed($sourcePath, _.$anotherToName})"
}

It always returns _.fieldName even if the field is actually nested, and it never shows example for scoped overrides defined (e.g. withFieldComputedFrom(_.from)(_.to, ...)).

It could be improved, with tests, printing the right values from the journal etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugErroneous behavior in existing featureslow hanging fruitTask that should be easy to implement - perfect for people that want to start contributing.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions