indice-co / indice-co/EDI.Net

v1.9.17 suddenly adds empty N1 segment to EDI files.

Open
#180 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

under-investigation
Dominant language
C#
Stars
490
Forks
173
PR merge metrics
No merged PRs in 30d

Description

I was using v1.9.12, since then I have downgraded and upgrade 1 version at a time to verify which version introducted this. It is v1.9.17, I have upgraded to 1.9.16 and up to that version the EDI comes out the same. As soon as I upgrade to v1.9.17 I get an extra unwanted and empty N1 segement, IE

N1*OT*ORIGIN\
N1*\ *** This is suddenly here, only change was in upgrading libraries. Unable to determine where this is coming from. All the members of Origin appear to be NULL, expect CITY and SATE members.
N4*CITY*KS\
N1*DT*DESTINATION\
N3*STREET ADDRESS\
N4*CITY*KS\
FGS*R*MK*XXXXXX\

I can't share actual EDI, would probably take too much to sanitize one. Below is the pertainent class definition and encompassing class.

```csharp

// Segment(s) are include as an list (ie a loop)

// Name Loop (N1)
public List NameSegments { get; set; }

// Location Loop (N4)
public List LocationSegments { get; set; }

// Form Group Segment Loop (FGS)
public List FormGroupSegments { get; set; }

// Related/Relevant Class Segment Declarations
[EdiSegment]
public class LocationSegment
{
[EdiCondition("OT", Path = "N1/0")]
public OriginSegment Origin { get; set; }

[EdiCondition("DT", Path = "N1/0")]
public DestinationSegment Destination { get; set; }
}

[EdiSegmentGroup("N1")]
public class OriginSegment
{
[EdiValue("X(2)", Path = "N1/0", Description = "N101 - Name Qualifier")]
public string EntityId { get; set; }

[EdiValue("X(35)", Path = "N1/1", Description = "N102 - Name")]
public string Name { get; set; }

[EdiValue("X(2)", Path = "N1/2", Description = "N103 - Id Code Qualifier")]
public string IdCodeQualifier { get; set; }

[EdiValue("X(9)", Path = "N1/3", Description = "N104 - Id Code"),
EdiCondition("TC", Path ="N1/2")]
public string IdCode { get; set; }

[EdiValue("X(18)", Path = "N4/0", Description = "N401 - City Name")/*,
EdiCondition("TC", CheckFor = EdiConditionCheckType.NotEqual, Path = "N1/2")*/]
public string CityName { get; set; }

[EdiValue("X(2)", Path = "N4/1", Description = "N401 - State")/*,
EdiCondition("TC", CheckFor = EdiConditionCheckType.NotEqual, Path = "N1/2")*/]
public string State { get; set; }
}

[EdiSegmentGroup("N1")]
public class DestinationSegment
{
[EdiValue("X(2)", Path = "N1/0", Description = "N101 - Name Qualifier")]
public string EntityId { get; set; }

[EdiValue("X(35)", Path = "N1/1", Description = "N102 - Name")]
public string Name { get; set; }

[EdiValue("X(2)", Path = "N1/2", Description = "N103 - Id Code Qualifier")]
public string IdCodeQualifier { get; set; }

[EdiValue("X(9)", Path = "N1/3", Description = "N104 - Id Code")]
public string IdCode { get; set; }

[EdiValue("X(35)", Path = "N3/0", Description = "N301 - First Street Address")]
public string FirstStreeAddress { get; set; }

[EdiValue("X(35)", Path = "N3/1", Description = "N302 - Second Street Address")]
public string SecondStreeAddress { get; set; }

[EdiValue("X(18)", Path = "N4/0", Description = "N401 - City Name")]
public string CityName { get; set; }

[EdiValue("X(2)", Path = "N4/1", Description = "N401 - State")]
public string State { get; set; }
}
```

I hope that is enough of an example/explanation of what I am seeing. Let me know if you need anything else.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the supplied LocationSegment, OriginSegment, and DestinationSegment declarations as the starting entry point; compare serialization behavior between v1.9.16 and v1.9.17 with a minimized representative EDI model. Done means identifying the regression and confirming that serialization no longer emits an empty N1 segment when the origin fields are null.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.