Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
JSONSCHEMA ?= jsonschema
SHELLCHECK ?= shellcheck
JQ ?= jq
PYTHON ?= python3
CURL ?= curl
TAR ?= tar
Expand All @@ -15,13 +16,32 @@ TESTS = $(shell find test/ -type f -name '*.json')

VERSION = $(shell tr -d '\n\r' < VERSION)

GENERATED = \
schemas/iso/currency/2015/alpha-code.json \
schemas/iso/currency/2015/alpha-currency.json \
schemas/iso/currency/2015/alpha-fund.json \
schemas/iso/currency/2015/alpha-precious-metal.json \
schemas/iso/currency/2015/alpha-test.json \
schemas/iso/currency/2015/alpha-unknown.json \
schemas/iso/currency/2015/numeric-code-additional.json \
schemas/iso/currency/2015/numeric-code.json \
schemas/iso/currency/2015/numeric-currency.json \
schemas/iso/currency/2015/numeric-fund.json \
schemas/iso/currency/2015/numeric-precious-metal.json \
schemas/iso/currency/2015/numeric-test.json \
schemas/iso/currency/2015/numeric-unknown.json \
schemas/iso/currency/2015/historical/alpha-code.json \
schemas/iso/currency/2015/historical/alpha-currency.json \
schemas/iso/currency/2015/historical/numeric-code.json \
schemas/iso/currency/2015/historical/numeric-currency.json

# TODO: Make `jsonschema fmt` automatically detect test files
all: common test
$(JSONSCHEMA) fmt schemas meta --verbose
$(JSONSCHEMA) fmt test --verbose --default-dialect "https://json-schema.org/draft/2020-12/schema"

.PHONY: common
common:
common: $(GENERATED)
$(JSONSCHEMA) metaschema schemas meta --verbose
$(JSONSCHEMA) lint schemas meta --verbose
$(JSONSCHEMA) validate meta/schemas-root.json --verbose $(SCHEMAS)
Expand All @@ -42,10 +62,27 @@ test:

build/iso/currency/list-%.json: scripts/xml2json.py vendor/data/iso/currency/list-%.xml
$(PYTHON) $< $(word 2,$^) $@
generate-iso-currency: generate/iso/currency/main.py \
build/iso/currency/list-one.json \
build/iso/currency/list-three.json
$(PYTHON) $<
schemas/iso/currency/2015/historical/alpha-code.json: build/iso/currency/list-three.json templates/iso/currency/2015/historical/alpha-code.jq
$(MKDIRP) $(dir $@)
$(JQ) --from-file $(word 2,$^) $< > $@
$(JSONSCHEMA) fmt $@
schemas/iso/currency/2015/historical/alpha-currency.json: build/iso/currency/list-three.json templates/iso/currency/2015/historical/alpha-currency.jq
$(MKDIRP) $(dir $@)
$(JQ) --from-file $(word 2,$^) $< > $@
$(JSONSCHEMA) fmt $@
schemas/iso/currency/2015/historical/numeric-code.json: build/iso/currency/list-three.json templates/iso/currency/2015/historical/numeric-code.jq
$(MKDIRP) $(dir $@)
$(JQ) --from-file $(word 2,$^) $< > $@
$(JSONSCHEMA) fmt $@
schemas/iso/currency/2015/historical/numeric-currency.json: build/iso/currency/list-three.json templates/iso/currency/2015/historical/numeric-currency.jq
$(MKDIRP) $(dir $@)
$(JQ) --from-file $(word 2,$^) $< > $@
$(JSONSCHEMA) fmt $@
schemas/iso/currency/2015/%.json: build/iso/currency/list-one.json templates/iso/currency/2015/%.jq
$(MKDIRP) $(dir $@)
$(JQ) --from-file $(word 2,$^) $< > $@
$(JSONSCHEMA) fmt $@

generate-iso-language: generate/iso/language/main.py
$(PYTHON) $<
generate-iso-country: generate/iso/country/main.py
Expand Down
380 changes: 0 additions & 380 deletions generate/iso/currency/main.py

This file was deleted.

Loading