Skip to content

[Bug]: JSON round trip of DTOs loses non-derived members redefined by a derived property (memberElement, memberName, source, target) #424

Open

Description

@samatstariongroup

What type of issue is this?

  • Bug report
  • Feature request

Description

The JSON round trip of the Core DTOs loses the values of non-derived properties that a subclass redefines with a derived property. A client that reads a model back through SysML2.NET.REST gets the empty GUID (or null) for them.

KerML declares Membership::memberElement, memberName, memberShortName and Relationship::source / target as non-derived. Subclasses redefine them with derived properties, for example OwningMembership::ownedMemberElement redefines memberElement. In the generated DTOs these members are explicit interface implementations whose setter does nothing; they read a derived field with an internal setter. For example, in SysML2.NET/Core/AutoGenDto/OwningMembership.cs:

Guid IMembership.MemberElement
{
    get => this.ownedMemberElement;
    set { }
}

There are 173 such no-op setters across 90 DTO classes: IRelationship.Source 48, IFeature.IsVariable 47, IRelationship.Target 19, IMembership.MemberElement 19, IMembership.MemberName 19, IMembership.MemberShortName 19, ISubsetting.SubsettingFeature 2.

Consequences:

  1. Write: a DTO built by hand cannot carry these values, so the serializer sends "memberElement": {"@id": "00000000-0000-0000-0000-000000000000"}. The values are correct only when the DTO comes from a POCO through the Dal ToDto(includeDerivedProperties: true).
  2. Read: the JSON deserializer does not read these keys back. For example, SysML2.NET.Serializer.Json/Core/AutoGenDeSerializer/OwningMembershipDeSerializer.cs ignores memberElement, memberName, source and target, and the DTO could not store them anyway. After a round trip they hold Guid.Empty, null or an empty list.
  3. Compare: the generated comparers, for example SysML2.NET.Extensions/Core/AutoGenDtoComparers/OwningMembershipComparer.cs, do not compare these members, so no existing test notices the loss.

Steps to Reproduce

Run the Flexo integration scenario of #407 (SySML2.NET.REST.Tests/Integration/FlexoModelScenarioTestFixture.cs, category Integration). Step 2 commits OwningMembership, Membership, NamespaceImport, MembershipImport and Annotation elements whose payloads carry the correct references; the recorded requests contain no empty GUID. Reading them back gives, for every membership:

OwningMembership af81e848-… lost its memberElement   Expected: 77ea1ae5-…  But was: 00000000-0000-0000-0000-000000000000
OwningMembership af81e848-… lost its memberName      Expected: "Nested"    But was: null
NamespaceImport 8f61e128-… holds empty references:   Relationship.Source

System Configuration

  • SysML2.NET version: 0.26.0 (branch 407-feature-verify-rest-api-client-against-compliant-server)
  • Server: Flexo MMS SysML v2 service, develop build of commit 836d904d

Activity

  1. added a commit that references this issue on Nov 10, 2026
    7097d0e
  2. linked a pull request that will close this issuefix #424 #437on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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