indice-co / indice-co/EDI.Net

[Feature request] Allow to nest same path Segment or Element in SegmentGroup (not consume it)

Open
#97 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
490
Forks
173
PR merge metrics
No merged PRs in 30d

Description

I would like to allow to use Segment or Element with same path as SegmentGroup - reconsider #32 or #36.
This would allow this class definition as:
```csharp
[EdiSegment, EdiPath("NAD")]
public class NAD
{
[EdiValue("X(3)", Path = "NAD/0/0")]
public string CodeQualifier { get; set; }

[EdiValue("X(35)", Path = "NAD/1/0")]
public string PartyIdentifier { get; set; }
}

[EdiSegmentGroup("NAD", "FII", "RFF", "CTA")]
public class SG2
{
public NAD NAD { get; set; }

public List RFFs { get; set; }
}
```
instead of:

```csharp
[EdiSegment, EdiPath("NAD")]
public class NAD
{
[EdiValue("X(3)", Path = "NAD/0/0")]
public string CodeQualifier { get; set; }

[EdiValue("X(35)", Path = "NAD/1/0")]
public string PartyIdentifier { get; set; }
}

[EdiSegmentGroup("NAD", "FII", "RFF", "CTA")]
public class SG2 : NAD
{
public List References { get; set; }
}
```
Both examples allow to reuse classes, but first one is clearer because it explicitly defines Segment property. It is also more intuitive for newcomers (i was bitten by it) than second form.

In general it could allow deeper type of "element" in outer one (like Segment or Element in SegmentGroup, but not SegmentGroup inside SegmentGroup).

This would change:

> Classes that are decorated with Segment, SegmentGroup, Message, Group or Interchange consume the segment that defines the contrainer and cannot be reused inside them.

I'm not sure if it would break compatibility, but it should not.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests. Start by tracing how EdiSegment and EdiSegmentGroup classes consume the segment defining their container, using the NAD/SG2 examples as the behavioral case; done means a same-path Segment or Element can be nested without consumption, while SegmentGroup nesting remains disallowed and compatibility is preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.