Skip to content

Commit 8788d36

Browse files
committed
Generate XBRL UTR schemas using jq templates
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent d7e0b6b commit 8788d36

53 files changed

Lines changed: 1674 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,59 @@ GENERATED = \
3333
schemas/iso/currency/2015/historical/alpha-code.json \
3434
schemas/iso/currency/2015/historical/alpha-currency.json \
3535
schemas/iso/currency/2015/historical/numeric-code.json \
36-
schemas/iso/currency/2015/historical/numeric-currency.json
36+
schemas/iso/currency/2015/historical/numeric-currency.json \
37+
schemas/xbrl/utr/area-item-type-normative.json \
38+
schemas/xbrl/utr/area-item-type.json \
39+
schemas/xbrl/utr/duration-item-type-normative.json \
40+
schemas/xbrl/utr/duration-item-type.json \
41+
schemas/xbrl/utr/electric-charge-item-type-normative.json \
42+
schemas/xbrl/utr/electric-charge-item-type.json \
43+
schemas/xbrl/utr/electric-current-item-type-normative.json \
44+
schemas/xbrl/utr/electric-current-item-type.json \
45+
schemas/xbrl/utr/energy-item-type-normative.json \
46+
schemas/xbrl/utr/energy-item-type.json \
47+
schemas/xbrl/utr/energy-per-monetary-item-type-normative.json \
48+
schemas/xbrl/utr/energy-per-monetary-item-type.json \
49+
schemas/xbrl/utr/flow-item-type-normative.json \
50+
schemas/xbrl/utr/flow-item-type.json \
51+
schemas/xbrl/utr/force-item-type-normative.json \
52+
schemas/xbrl/utr/force-item-type.json \
53+
schemas/xbrl/utr/frequency-item-type-normative.json \
54+
schemas/xbrl/utr/frequency-item-type.json \
55+
schemas/xbrl/utr/ghg-emissions-item-type-normative.json \
56+
schemas/xbrl/utr/ghg-emissions-item-type.json \
57+
schemas/xbrl/utr/ghg-emissions-per-monetary-item-type-normative.json \
58+
schemas/xbrl/utr/ghg-emissions-per-monetary-item-type.json \
59+
schemas/xbrl/utr/length-item-type-normative.json \
60+
schemas/xbrl/utr/length-item-type.json \
61+
schemas/xbrl/utr/mass-item-type-normative.json \
62+
schemas/xbrl/utr/mass-item-type.json \
63+
schemas/xbrl/utr/memory-item-type-normative.json \
64+
schemas/xbrl/utr/memory-item-type.json \
65+
schemas/xbrl/utr/monetary-item-type-normative.json \
66+
schemas/xbrl/utr/monetary-item-type.json \
67+
schemas/xbrl/utr/per-share-item-type-normative.json \
68+
schemas/xbrl/utr/per-share-item-type.json \
69+
schemas/xbrl/utr/per-unit-item-type-normative.json \
70+
schemas/xbrl/utr/per-unit-item-type.json \
71+
schemas/xbrl/utr/plane-angle-item-type-normative.json \
72+
schemas/xbrl/utr/plane-angle-item-type.json \
73+
schemas/xbrl/utr/power-item-type-normative.json \
74+
schemas/xbrl/utr/power-item-type.json \
75+
schemas/xbrl/utr/pressure-item-type-normative.json \
76+
schemas/xbrl/utr/pressure-item-type.json \
77+
schemas/xbrl/utr/pure-item-type-normative.json \
78+
schemas/xbrl/utr/pure-item-type.json \
79+
schemas/xbrl/utr/shares-item-type-normative.json \
80+
schemas/xbrl/utr/shares-item-type.json \
81+
schemas/xbrl/utr/temperature-item-type-normative.json \
82+
schemas/xbrl/utr/temperature-item-type.json \
83+
schemas/xbrl/utr/voltage-item-type-normative.json \
84+
schemas/xbrl/utr/voltage-item-type.json \
85+
schemas/xbrl/utr/volume-item-type-normative.json \
86+
schemas/xbrl/utr/volume-item-type.json \
87+
schemas/xbrl/utr/volume-per-monetary-item-type-normative.json \
88+
schemas/xbrl/utr/volume-per-monetary-item-type.json
3789

3890
# TODO: Make `jsonschema fmt` automatically detect test files
3991
all: common test
@@ -83,14 +135,19 @@ schemas/iso/currency/2015/%.json: build/iso/currency/list-one.json templates/iso
83135
$(JQ) --from-file $(word 2,$^) $< > $@
84136
$(JSONSCHEMA) fmt $@
85137

138+
build/xbrl/utr/%.json: scripts/xml2json.py vendor/data/xbrl/utr/%.xml
139+
$(MKDIRP) $(dir $@)
140+
$(PYTHON) $< $(word 2,$^) $@
141+
schemas/xbrl/utr/%.json: build/xbrl/utr/utr.json templates/xbrl/utr/%.jq
142+
$(MKDIRP) $(dir $@)
143+
$(JQ) --from-file $(word 2,$^) $< > $@
144+
$(JSONSCHEMA) fmt $@
145+
86146
generate-iso-language: generate/iso/language/main.py
87147
$(PYTHON) $<
88148
generate-iso-country: generate/iso/country/main.py
89149
$(PYTHON) $<
90-
build/xbrl/utr/%.json: scripts/xml2json.py vendor/data/xbrl/utr/%.xml
91-
$(PYTHON) $< $(word 2,$^) $@
92-
generate-xbrl-utr: generate/xbrl/utr/main.py build/xbrl/utr/utr.json
93-
$(PYTHON) $<
150+
94151

95152
# TODO: Add a `jsonschema pkg` command instead
96153
.PHONY: dist
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR area Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for areaItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "areaItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "areaItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR area Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for areaItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "areaItemType"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "areaItemType"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR duration Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for durationItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "durationItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "durationItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR duration Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for durationItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "durationItemType"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "durationItemType"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR electric Charge Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for electricChargeItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricChargeItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricChargeItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR electric Charge Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for electricChargeItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricChargeItemType"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricChargeItemType"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR electric Current Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for electricCurrentItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricCurrentItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricCurrentItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR electric Current Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for electricCurrentItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricCurrentItemType"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "electricCurrentItemType"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": ("XBRL UTR energy Item Type units (" + .["{http://www.xbrl.org/2009/utr}utr"]["@attributes"].lastUpdated + ")"),
4+
"description": "Valid units for energyItemType as defined in the XBRL Units Type Registry",
5+
"examples": (
6+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
7+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "energyItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
8+
9+
| .[0:3]
10+
| map(.["{http://www.xbrl.org/2009/utr}unitId"])
11+
),
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [
14+
"https://www.xbrl.org/specification/utr/rec-2013-11-18/utr-rec-2013-11-18-clean.html",
15+
"https://www.xbrl.org/utr/utr.xml"
16+
],
17+
"anyOf": (
18+
.["{http://www.xbrl.org/2009/utr}utr"]["{http://www.xbrl.org/2009/utr}units"]["{http://www.xbrl.org/2009/utr}unit"]
19+
| map(select(.["{http://www.xbrl.org/2009/utr}itemType"] == "energyItemType" and .["{http://www.xbrl.org/2009/utr}status"] == "REC"))
20+
21+
| map(
22+
{
23+
"const": .["{http://www.xbrl.org/2009/utr}unitId"],
24+
"title": .["{http://www.xbrl.org/2009/utr}unitName"],
25+
"description": (.["{http://www.xbrl.org/2009/utr}definition"] | gsub("\\s{2,}"; " ") | if endswith(".") then .[:-1] else . end)
26+
} +
27+
(if .["{http://www.xbrl.org/2009/utr}symbol"] then {"x-symbol": .["{http://www.xbrl.org/2009/utr}symbol"]} else {} end) +
28+
(if .["{http://www.xbrl.org/2009/utr}status"] then {"x-status": .["{http://www.xbrl.org/2009/utr}status"]} else {} end)
29+
)
30+
)
31+
}

0 commit comments

Comments
 (0)