Parsing fails
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 490
- Forks
- 173
- PR merge metrics
- No merged PRs in 30d
Description
I have quite en extensive example Edifact message that fails to parse some parts.
It consists of a EdiMessage with a SegmentGroup5 inside. SegmentGroup5 contains a list of SegmentGroup7, and SegmentGroup7 contains two EdiSegments CharacteristicsClassId and CharacteristicValue.
The problem is when I add parsing of a LOC EdiSegment to SegmentGroup5 the list of SegmentGroup7 show empty. When I remove "LOC" from SegmentGroup5 parsing the SegmentGroup7 is non empty.
The edi message:
UNA:+.? '
UNB+UNOC:3+91100:ZZ+92545:ZZ+250227:1505+E250227559168++23-DDK-S03-S++1'
UNH+1+UTILTS:D:02B:UN:E5SE1B'
BGM+S03:SVK:260+E250227559169+9+AB'
DTM+137:202502271505:203'
DTM+735:?+0100:406'
MKS+23+E04::260'
NAD+DDK'
NAD+MR+92545:SVK:260'
NAD+MS+91100:SVK:260'
IDE+24+E250227559167'
LOC+239+TES:SVK:260'
NAD+DDK+40900:SVK:260'
NAD+DDQ+35410:SVK:260'
LIN+++8716867000030:::9'
PIA+1+Z04:PC:SVK:260+U82:PT:SVK:260+Z06:OT:SVK:260+Z58:LOD:SVK:260+Z01:BAP:SVK:260'
DTM+368:202502271505:203'
DTM+354:1:802'
DTM+324:202503010000202504010000:719'
STS+7++Z01:SVK:260'
MEA+AAZ++KWH'
CCI+++E12::260'
CAV+E17::260'
CCI+++E02::260'
CAV+E01::260'
CCI+++Z01:SVK:260'
CAV+:::760'
SEQ++1'
QTY+135:-9226'
UNT+28+1'
UNZ+1+E250227559168'
The class:
using System;
using indice.Edi;
using indice.Edi.Serialization;
using indice.Edi.Utilities;
namespace ClassLibraryUtilsEdifact.Messages;
[EdiMessage]
public class testUtiltsEdiMsg
{
public testUtiltsEdiMsg()
{
SG5s = new List();
}
[EdiSegment, EdiPath("LOC")]
public class LocationIdentification
{
public LocationIdentification()
{
this.LocationFunctionCodeQualifier = "";
this.LocationItemNumberIdentificationNameCode = "";
this.Location_ItemNumberIdentification_CodeListQualifier = "";
this.LocationItemNumberIdentification_CodeListResponsibleAgencyCoded = "";
this.LocationItemNumberIdentification_LocatioName = "";
}
// 3227 LOCATION FUNCTION CODE QUALIFIER
[EdiValue("X(3)", Path = "LOC/0/0")]
public string LocationFunctionCodeQualifier { get; set; }
// C517/3225 Location name code
[EdiValue("X(35)", Path = "LOC/1/0")]
public string LocationItemNumberIdentificationNameCode { get; set; }
// C517/1131 Code list identification code
[EdiValue("X(35)", Path = "LOC/1/1")]
public string Location_ItemNumberIdentification_CodeListQualifier { get; set; }
// C517/3055 Code list responsible agency code
[EdiValue("X(17)", Path = "LOC/1/2")]
public string LocationItemNumberIdentification_CodeListResponsibleAgencyCoded { get; set; }
// C517/
[EdiValue("X(256)", Path = "LOC/1/3")]
public string LocationItemNumberIdentification_LocatioName { get; set; }
}
[EdiSegment, EdiPath("DTM")]
public class DateTimePeriod
{
public DateTimePeriod()
{
this.FunctionCodeQualifier = "";
this.Value = "";
this.FormatCode = "";
}
// C507/2005 Date or time or period function code qualifier
[EdiValue("X(3)", Path = "DTM/0/0", Mandatory = true)]
public string FunctionCodeQualifier { get; set; }
// C507/2380 Date or time or period text
[EdiValue("X(35)", Path = "DTM/0/1", Mandatory = true)]
public string Value { get; set; }
// C507/2379 Date or time or period format code
[EdiValue("X(3)", Path = "DTM/0/2", Mandatory = true)]
public string FormatCode { get; set; }
}
[EdiSegment, EdiPath("CCI")]
public class CharacteristicsClassId
{
public CharacteristicsClassId()
{
this.ClassTypeCode = "";
this.CharacteristicDescriptionCode = "";
this.CodeListIdentificationCode = "";
this.CodeListResponsibleAgencyCode = "";
}
// 7059 CLASS TYPE CODE
[EdiValue("X(3)", Path = "CCI/0/0")]
public string ClassTypeCode { get; set; }
// C240/7037 Characteristic description code
[EdiValue("X(17)", Path = "CCI/2/0")]
public string CharacteristicDescriptionCode { get; set; }
// C240/1131 Code list identification code
[EdiValue("X(17)", Path = "CCI/2/1")]
public string CodeListIdentificationCode { get; set; }
// C240/3055 Code list responsible agency code
[EdiValue("X(3)", Path = "CCI/2/2")]
public string CodeListResponsibleAgencyCode { get; set; }
}
[EdiSegment, EdiPath("CAV")]
public class CharacteristicValue
{
public CharacteristicValue()
{
this.CharacteristicValueCoded = "";
this.CodeListIdentificationCode = "";
this.CodeListResponsibleAgencyCode = "";
}
// C889/7111 Characteristic value description code
[EdiValue("X(3)", Path = "CAV/0/0")]
public string CharacteristicValueCoded { get; set; }
// C889/1131 Code list identification code
[EdiValue("X(3)", Path = "CAV/0/1")]
public string CodeListIdentificationCode { get; set; }
// C889/3055 Code list responsible agency code
[EdiValue("X(3)", Path = "CAV/0/2")]
public string CodeListResponsibleAgencyCode { get; set; }
public bool IsDefined()
{
return CharacteristicValueCoded.Length != 0
&& CodeListIdentificationCode.Length != 0
&& CodeListResponsibleAgencyCode.Length != 0;
}
}
[EdiSegmentGroup("IDE", "LOC")]
public class SegmentGroup5
{
public SegmentGroup5()
{
this.IdentityObjectTypeCodeQualifier = "";
this.IdentityObjectIdentifier = "";
this.IdentityObjectIdentificationCodeQualifier = "";
this.IdentityStatusDescriptionCode = "";
this.locs = new List<LocationIdentification>();
this.SG7s = new List<SegmentGroup7>();
}
// Identity
// 7495 OBJECT TYPE CODE QUALIFIER
[EdiValue("X(3)", Path = "IDE/0/0")]
public string IdentityObjectTypeCodeQualifier { get; set; }
// C206/7402 Object identifier
[EdiValue("X(35)", Path = "IDE/1/0")]
public string IdentityObjectIdentifier { get; set; }
[EdiValue("X(3)", Path = "IDE/1/1")]
public string IdentityObjectIdentificationCodeQualifier { get; set; }
[EdiValue("X(3)", Path = "IDE/1/2")]
public string IdentityStatusDescriptionCode { get; set; }
// Place / Location identifier
public List<LocationIdentification> locs { get; set; }
public List<SegmentGroup7> SG7s { get; set; }
[EdiSegmentGroup("CCI", "CAV")]
public class SegmentGroup7
{
public SegmentGroup7()
{
this.CharClassId = new CharacteristicsClassId();
this.CharacteristicValue = new CharacteristicValue();
}
// Charasteristics Class Id
public CharacteristicsClassId CharClassId { get; set; }
public CharacteristicValue CharacteristicValue { get; set; }
}
}
public List<SegmentGroup5> SG5s { get; set; }
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied testUtiltsEdiMsg class, especially SegmentGroup5's EdiSegmentGroup annotation and its locs and SG7s properties. Reproduce the EDIFACT message with and without LOC parsing, then trace how SegmentGroup5 and nested SegmentGroup7 are populated. Done means LOC is parsed while the expected SG7 entries remain 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
- 35/100