Skip to content

Commit dbeaaeb

Browse files
committed
Generate ISO currency schemas using jq templates
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 70abf40 commit dbeaaeb

30 files changed

Lines changed: 3316 additions & 2979 deletions

Makefile

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
JSONSCHEMA ?= jsonschema
22
SHELLCHECK ?= shellcheck
3+
JQ ?= jq
34
PYTHON ?= python3
45
CURL ?= curl
56
TAR ?= tar
@@ -42,10 +43,34 @@ test:
4243

4344
build/iso/currency/list-%.json: scripts/xml2json.py vendor/data/iso/currency/list-%.xml
4445
$(PYTHON) $< $(word 2,$^) $@
45-
generate-iso-currency: generate/iso/currency/main.py \
46-
build/iso/currency/list-one.json \
47-
build/iso/currency/list-three.json
48-
$(PYTHON) $<
46+
schemas/iso/currency/2015/%.json: build/iso/currency/list-one.json templates/iso/currency/2015/%.jq
47+
$(MKDIRP) $(dir $@)
48+
$(JQ) --from-file $(word 2,$^) $< > $@
49+
$(JSONSCHEMA) fmt $@
50+
schemas/iso/currency/2015/historical/%.json: build/iso/currency/list-three.json templates/iso/currency/2015/historical/%.jq
51+
$(MKDIRP) $(dir $@)
52+
$(JQ) --from-file $(word 2,$^) $< > $@
53+
$(JSONSCHEMA) fmt $@
54+
55+
generate-iso-currency: \
56+
schemas/iso/currency/2015/alpha-code.json \
57+
schemas/iso/currency/2015/alpha-currency.json \
58+
schemas/iso/currency/2015/alpha-fund.json \
59+
schemas/iso/currency/2015/alpha-precious-metal.json \
60+
schemas/iso/currency/2015/alpha-test.json \
61+
schemas/iso/currency/2015/alpha-unknown.json \
62+
schemas/iso/currency/2015/numeric-code-additional.json \
63+
schemas/iso/currency/2015/numeric-code.json \
64+
schemas/iso/currency/2015/numeric-currency.json \
65+
schemas/iso/currency/2015/numeric-fund.json \
66+
schemas/iso/currency/2015/numeric-precious-metal.json \
67+
schemas/iso/currency/2015/numeric-test.json \
68+
schemas/iso/currency/2015/numeric-unknown.json \
69+
schemas/iso/currency/2015/historical/alpha-code.json \
70+
schemas/iso/currency/2015/historical/alpha-currency.json \
71+
schemas/iso/currency/2015/historical/numeric-code.json \
72+
schemas/iso/currency/2015/historical/numeric-currency.json
73+
4974
generate-iso-language: generate/iso/language/main.py
5075
$(PYTHON) $<
5176
generate-iso-country: generate/iso/country/main.py

generate/iso/currency/main.py

Lines changed: 0 additions & 380 deletions
This file was deleted.

0 commit comments

Comments
 (0)