Edifact.Schema 1.0.0-preview.6

This is a prerelease version of Edifact.Schema.
dotnet add package Edifact.Schema --version 1.0.0-preview.6
                    
NuGet\Install-Package Edifact.Schema -Version 1.0.0-preview.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Edifact.Schema" Version="1.0.0-preview.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Edifact.Schema" Version="1.0.0-preview.6" />
                    
Directory.Packages.props
<PackageReference Include="Edifact.Schema" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Edifact.Schema --version 1.0.0-preview.6
                    
#r "nuget: Edifact.Schema, 1.0.0-preview.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Edifact.Schema@1.0.0-preview.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Edifact.Schema&version=1.0.0-preview.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Edifact.Schema&version=1.0.0-preview.6&prerelease
                    
Install as a Cake Tool

Edifact.Schema

The compiled directory format — segments, composites, elements, code lists and message specifications — with the reader, writer and linker that turn a pack on disk into a resolved schema.

A SchemaPack is what one UN/EDIFACT release says: NAD has these slots in this order, 3035 admits these codes, INVOIC:D:96A:UN has this segment table. It is a lookup model, not a validator and not a matcher — it will hand you INVOIC's definition, and Edifact.Structure is what matches segments against it. Use this package directly when you want to read a directory rather than check something against one: building a field picker, generating documentation, diffing two releases.

Install

dotnet add package Edifact.Schema --prerelease

net8.0 and net10.0, no external dependencies.

You supply the directory

No directory data ships in this package. A compiled pack is a derivative of the UN Directory, and shipping one would make every consumer a redistributor of it — a stronger claim than this project has made. Download a release from UNECE (https://unece.org/trade/uncefact/unedifact/download) and ingest it once:

dotnet tool install --global Edifact.Cli --prerelease
edifact ingest ~/Downloads/D01B --out ~/edifact/packs/compiled

That writes the pack to ~/edifact/packs/compiled/untdid-d01b, and puts the four ISO 9735 syntax definitions — iso9735-v3.json, iso9735-v4.json and the two CONTRL files — in ~/edifact/packs/syntax beside it. A directory release and a syntax version are independent axes, and the UNTDID does not publish the service definitions in a form every release yields, so those four are transcribed once per syntax version and ship inside the Edifact.Cli package rather than coming out of any ingest. Files already in that directory are left alone.

Use it

using Edifact.Schema;
using Edifact.Schema.Model;
using Edifact.Schema.Serialization;

// Lazy: a release needing only version 3 never opens the version 4 file.
var syntax = new SyntaxPackSet("/home/me/edifact/packs/syntax");

var pack = PackReader.Read("/home/me/edifact/packs/compiled/untdid-d96a", syntax.For);

Console.WriteLine($"{pack.Id} — {pack.Manifest.DirectoryLabel}");        // untdid-d96a — D.96A
Console.WriteLine($"{pack.Messages.Count} messages, {pack.Segments.Count} segments");

// A linked segment: every composite and element reference already resolved.
foreach (var slot in pack.Segment("NAD").Slots)
{
    Console.WriteLine($"  {slot.Position}  {slot.Code}  {slot.Requirement}  max {slot.MaxRepeat}");
}

// A message definition, keyed the way UNH S009 selects it.
if (pack.TryGetMessage(new MessageKey("INVOIC", "D", "96A")) is { } invoic)
{
    Console.WriteLine($"{invoic.Key} has {invoic.Items.Length} top-level items");
}

// Code values, with the directory's own change indicators.
foreach (var entry in pack.CodeLists["3035"].Entries.Take(5))
{
    Console.WriteLine($"  {entry.Code}  {entry.Name}");
}

PackReader.Read throws SchemaPackException when a pack is there and does not hold together — a reference that resolves nowhere is a broken artefact, not bad user input, so it is raised rather than reported. PackWriter.Write(pack, directory) writes one back out; SchemaLinker.Link builds one from parsed specifications, which is what Edifact.Untdid does at the end of an ingest.

Structure only, no prose

A committed pack holds tags, cardinalities, representations and code values, and no descriptive text. The UN licence permits passing the Directory on unmodified; it does not permit modifying and distributing it, and a pack carrying the directory's prose in a transformed shape would be exactly that. edifact ingest --include-prose builds a local pack that keeps the text, for your own use.

Where this sits

Edifact.Core       → nothing                the tokenizer, usable with no directory at all
Edifact.Schema     → Core                   what a release says            ← you are here
Edifact.Structure  → Core, Schema           matching a segment table
Edifact.Overlays   → Structure              what a guide says on top of a release
Edifact.Validation → Structure, Overlays    the usual entry point

Full documentation: https://github.com/101-semaphore/EDIFACT.

Licence

Apache-2.0. See the NOTICE in this package for what the wider project is derived from and under what terms.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Edifact.Schema:

Package Downloads
Edifact.Structure

Matches a segment stream against a message's segment table, resolving segment group nesting and repetition into a message tree with every position accounted for.

Edifact.Untdid

Reads a UN/EDIFACT directory distribution as published by UNECE — the fixed-column CP437 archives — detects which release dialect it is, and compiles it into a pack. No directory content is included; you supply the distribution.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.6 86 10/11/2026
1.0.0-preview.5 114 9/19/2026
1.0.0-preview.4 96 9/17/2026
1.0.0-preview.3 145 9/7/2026
1.0.0-preview.2 128 9/6/2026
1.0.0-preview.1 107 9/6/2026