aboutsummaryrefslogtreecommitdiffhomepage
path: root/scaffolder/README.md
blob: 477b3f6653da9dfc6af163e9e244c727fa112c16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# edi-parser-scaffolder

Autonomous utility to generate parser for a given revision of the Edifact
specification.

## Usage

1. fetch specification for a given Edifact revision
2. scaffold the parsers for this specification

### Read specification

Read files downloaded from
https://unece.org/trade/uncefact/unedifact/download

You can specify individual files one by one:
```
$ stack exec edi-parser-scaffolder -- read-bundle --revision D96A --specification ./specification/references/ --message-file /path/to/D96A/DIRDEF_D.96A  --segment-file /path/to/D96A/TRSD.96A --composite-file /path/to/D96A/TRCD.96A --simple-file /path/to/D96A/TRED.96A --simple-code-file /path/to/D96A/UNCL-1.96A  --simple-code-file /path/to/D96A/UNCL-2.96A
$ stack exec edi-parser-scaffolder -- read-bundle --revision D21B --specification ./specification/references/ --message-file /path/to/D21B/IFCSUM_D.21B --message-file /path/to/D21B/IFTSTA_D.21B  --segment-file /path/to/D21B/EDSD.21B --segment-file /path/to/D21B/IDSD.21B --composite-file /path/to/D21B/EDCD.21B --composite-file /path/to/D21B/IDCD.21B --simple-file /path/to/D21B/EDED.21B --simple-code-file /path/to/D21B/UNCL.21B
```

Or give the whole zip file:
```
$ stack exec edi-parser-scaffolder -- read-bundle --revision D96A --message IFCSUM --message IFTSTA --message IFTSAI --message DESADV --specification ./specification/references/ --bundle /path/to/D96A/d96a.zip
```

### Fetch specification

This function is deprecated and parsing may break at any time!
Prefer the bundle reading above

```
$ stack exec edi-parser-scaffolder -- \
  fetch --revision D96A --specification ./specification/references
```

If you're only interested in a subset of the specification, you can select the
messages:

```
$ stack exec edi-parser-scaffolder -- \
  fetch --revision D96A --specification ./specification/references/ --messages IFCSUM,IFTSAI,DESADV
```

### Scaffold the parsers

```
$ stack exec edi-parser-scaffolder -- \
  scaffold --revision D96A --specification ./specification/references/ --src specification/src/
```