SegmentGroup Deserialization
- Dominant language
- C#
- Stars
- 490
- Forks
- 173
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a little bit trouble with the deserialization of a SegmentGroup...
My Model looks like this (only the relevant parts):
```c#
public class Edifact_IC
{
public UNB_Segment UNB { get; set; }
public IC_Message Message { get; set; }
public UNZ_Segment UNZ { get; set; }
}
[EdiMessage]
public class IC_Message
{
......
public List Ref { get; set; }
.....
}
//------SegmentGroups-----
[EdiSegmentGroup("RFF", "DTM"),EdiCondition("...", "...", Path = "RFF/0/0")]
public class SG1_Reference
{
public RFF_Segment Ref { get; set; }
public List Date { get; set; }
}
//------Segments-----
......
[EdiSegment, EdiPath("RFF")]
public class RFF_Segment
{
[EdiValue("X(3)", Mandatory = true, Path = "RFF/0/0")]
public string Qualifier { get; set; }
[EdiValue("X(70)", Mandatory = false, Path = "RFF/0/1")]
public string Reference { get; set; }
.....
}
```
If I try to deserialize following (only EDIFACT Snipped for testing):
`
UNA:+.? '
UNB+UNOC:3+XXXXXXXXXX:500+XXXXXXXXX:500+XXXXXX:0610+XXXXXXXXX++VL'
UNH+XXXXXXX+XXXXX:X:XXX:XX:2.3c'
RFF+AGI:XXXXX'
DTM+293:20181001060000:204'
UNZ+1+XXXXXXXXXXXX'
`
the "RFF-Segment" property (Ref) in "SG1_Reference" is always Null. The DTM-Segment in the same SegmentGroup is correct...
If I change the SegmentGroup Class to:
```c#
//------SegmentGroups-----
[EdiSegmentGroup("RFF", "DTM"),EdiCondition("...", "...", Path = "RFF/0/0")]
public class SG1_Reference : RFF_Segment
{
//public RFF_Segment Ref { get; set; }
public List Date { get; set; }
}
```
the deserialization works good, but I have now (obviously) not a RFF_Segment property but the "Qualifier" and "Reference" properties.
How do I change the SG1_Reference class that I have a RFF_Segment and a DTM_Segment property?
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue using the supplied EDIFACT snippet and the SG1_Reference, RFF_Segment, and DTM_Segment definitions. Trace the deserialization handling for the segment group and compare the nested RFF_Segment property with the inheritance variant. Done means both the RFF_Segment property and the DTM_Segment list are populated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100