Skip to content

[MapToParent] should inherit parent's attributePrefix #149

Open

Description

@JeremyCaney

If a binding model has [MapToParent] on a property which maps to an object with a [MapToParent] on one of its properties, that grandchild property will be prefixed with the parent's property name, but not the grandparent's property name.

Example

record Location(
  string City, 
  string State
);
record Contact(
  string Name, 
  [MapToParent] Location Location
);
record Request(
  [MapToParent] Contact PrimaryContact, 
  [MapToParent] Contact SecondaryContact
);

In this case, when Request is mapped through the ReverseTopicMappingService, it will end up with:

  • PrimaryContactName
  • LocationCity
  • LocationState
  • SecondaryContactName
  • LocationCity (collision)
  • LocationState (collision)

Instead, the [MapToParent] on Contact should inherit the attributePrefix from the parent's [MapToParent] so you end up with:

  • PrimaryContactName
  • PrimaryContactLocationCity
  • PrimaryContactLocationState
  • SecondaryContactName
  • SecondaryContactLocationCity
  • SecondaryContactLocationState

Explicit attributePrefix

This should happen even if an attributePrefix is explicitly declared on the nested [MapToParent] property. So if you had:

record Contact(
  string Name, 
  [MapToParent("")] Location Location
);

Then that should output:

  • PrimaryContactName
  • PrimaryContactCity
  • PrimaryContactState
  • SecondaryContactName
  • SecondaryContactCity
  • SecondaryContactState

Activity

  1. self-assigned this
    on Aug 14, 2026
  2. added
    Type: BugBehavior that is inconsistent with documented or expected behavior.
    Area: MappingRelates to one of the `ITopicMappingService` interfaces or implementations.
    on Aug 14, 2026
  3. added theissue type on Aug 14, 2026
  4. added this to the OnTopic 6.0.0 milestone on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: MappingRelates to one of the `ITopicMappingService` interfaces or implementations.Priority: 0Severity 2: MajorStatus 2: ScheduledPlanned for an upcoming release.Type: BugBehavior that is inconsistent with documented or expected behavior.

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions