Fail to group several segments in a hierarchy of member classes when de-serialize
- Dominant language
- C#
- Stars
- 490
- Forks
- 173
- PR merge metrics
- No merged PRs in 30d
Description
`Hi.` Do I miss proper usage of EdiSegmentGroup attribute?
Here is excerpt of 943 Warehouse Stock Transfer Shipment Advice, where W04 is “Item detail total” and N9 is a reference to this detail. My intention is to encapsulate in a member class of Line the identification (N9) and item details (W04) in of Purchase Order.
Problem is that the ItemDetailTotal type in my code is de-serialized as a null and segment W04 elements are not assigned to properties of ItemDetailTotal.
I only can get it working when put all segments for W04 and N9 directly under Line member class, that is the closest I can get.
I thought of keeping them in individual member classes with EdiSegment attributes as below.
ST\*943\*000001234~
W06\*R\*15107\*20210329\*\*\******PO~
N1\*WH\*\*12\*1111~
N3\*Abcd~
W27\*M\*KTML~
W04\*1000\*EA\*\*VN\*5900\*LT~
N9\*LI\*10~
W04\*5000\*EA\*\*VN\*8530\*LT~
N9\*LI\*20~
W03\*0~
SE\*12\*000007242~
```C#
[EdiMessage]
public class StockTransferShipmentAdviceMessage
{
public List Lines { get; set; }
///
/// W03
///
public TotalShipmentInformation Totals { get; set; }
}
[EdiSegment, EdiSegmentGroup("W04", SequenceEnd = "W03")]
public class Line
{
///
/// W04
///
public ItemDetailTotal ItemDetail { get; set; }
///
/// N9
///
public ReferenceIdentification ReferenceNumber { get; set; }
}
[EdiSegment, EdiPath("W04")]
public class ItemDetailTotal
{
[EdiValue("9(9)", Path = "*/0", Description = "Number of units")]
public string NumberOfUnitsShipped { get; set; }
[EdiValue(Path = "*/1", Description = "Measurements")]
public string UnitsOfMeasurement { get; set; }
[EdiValue("X(20)", Path = "*/2")]
public string UpcCaseCode { get; set; }
}
///
/// N9
///
[EdiSegment, EdiPath("N9")]
public class ReferenceIdentification
{
[EdiValue(Path = "*/0", Description = "N901 - ‘LI’ (Line Item Identifier)")]
public string ReferenceIdentificationQualifier { get; set; }
[EdiValue(Path = "*/1", Description = "N902 - LI – Customer Line Reference")]
public string Value { get; set; }
[EdiValue(Path = "*/2", Description = "N903 - Reference Description")]
public string Description { get; set; }
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the EdiSegmentGroup("W04", SequenceEnd="W03") declaration on Line and the EdiPath("W04") and EdiPath("N9") mappings, then reproduce deserialization with the supplied 943 sample. Done means each repeated W04/N9 pair populates nested ItemDetailTotal and ReferenceIdentification instead of requiring segments directly on Line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100