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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ all: common test
common:
$(JSONSCHEMA) metaschema schemas meta --verbose
$(JSONSCHEMA) lint schemas meta --verbose
$(JSONSCHEMA) validate meta/schemas-root.json --verbose $(SCHEMAS)
$(JSONSCHEMA) validate meta/schemas.json --verbose $(SCHEMAS)
$(JSONSCHEMA) validate meta/test.json --verbose $(TESTS)
$(SHELLCHECK) scripts/*.sh
Expand Down
5 changes: 5 additions & 0 deletions generate/xbrl/utr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def create_unit_schema_entry(unit):
symbol = unit.get(f"{UTR_NS}symbol", "")
status = unit.get(f"{UTR_NS}status", "")

if definition.endswith('.'):
definition = definition[:-1]

definition = re.sub(r'\s{2,}', ' ', definition)

entry = {
"const": unit_id,
"title": unit_name,
Expand Down
53 changes: 53 additions & 0 deletions meta/schemas-root.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"anyOf": [
{
"properties": {
"examples": {
"type": "array",
"minItems": 1
},
"const": true
}
},
{
"properties": {
"examples": {
"type": "array",
"minItems": 3
},
"const": false
}
}
],
"required": [
"x-license",
"title",
"description",
"examples",
"x-links",
"$schema"
],
"properties": {
"$schema": {
"const": "https://json-schema.org/draft/2020-12/schema"
},
"$comment": {
"not": {
"$ref": "../schemas/ietf/uri/uri-reference.json"
}
},
"x-license": {
"const": "https://github.com/sourcemeta/std/blob/main/LICENSE"
},
"x-links": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "../schemas/ietf/http/https-url.json"
}
}
}
}
73 changes: 29 additions & 44 deletions meta/schemas.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,39 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"anyOf": [
{
"properties": {
"examples": {
"type": "array",
"minItems": 1
},
"const": true
}
},
{
"properties": {
"examples": {
"type": "array",
"minItems": 3
},
"const": false
}
}
],
"required": [
"x-license",
"title",
"description",
"examples",
"x-links",
"$schema"
],
"$dynamicAnchor": "meta",
"$ref": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"$schema": {
"const": "https://json-schema.org/draft/2020-12/schema"
},
"$id": false,
"$comment": {
"not": {
"$ref": "../schemas/ietf/uri/uri-reference.json"
}
"$ref": "#/$defs/clean-prose"
},
"x-license": {
"const": "https://github.com/sourcemeta/std/blob/main/LICENSE"
"title": {
"$ref": "#/$defs/clean-prose"
},
"x-links": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "../schemas/ietf/http/https-url.json"
}
"description": {
"$ref": "#/$defs/clean-prose"
}
},
"$defs": {
"clean-prose": {
"type": "string",
"not": {
"anyOf": [
{
"pattern": "\\.$"
},
{
"pattern": " \\s"
},
{
"pattern": "[\\n\\r\\t]"
},
{
"pattern": "[\\x00-\\x1F\\x7F]"
}
]
},
"pattern": "^[^\\s].*[^\\s]$|^[^\\s]$"
}
}
}
16 changes: 8 additions & 8 deletions schemas/xbrl/utr/duration-item-type-normative.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@
"anyOf": [
{
"title": "Year",
"description": "Gregorian calendar year of 365 days. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian calendar year of 365 days. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "yr",
"const": "Y"
},
{
"title": "Month",
"description": "Gregorian calendar month of 30.41 days. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian calendar month of 30.41 days. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "mo",
"const": "M"
},
{
"title": "Day",
"description": "Day of 24 hours. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Day of 24 hours. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "d",
"const": "D"
},
{
"title": "Hour",
"description": "Hour of 60 minutes. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Hour of 60 minutes. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "h",
"const": "H"
},
{
"title": "Minute",
"description": "Minute of 60 seconds. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Minute of 60 seconds. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "m",
"const": "MM"
},
{
"title": "Second",
"description": "Second. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Second. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "s",
"const": "S"
},
{
"title": "Quarter",
"description": "Gregorian Calendar Quarter (three months). Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian Calendar Quarter (three months). Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "qtr",
"const": "Q"
},
{
"title": "Week",
"description": "Gregorian Calendar Week. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian Calendar Week. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "wk",
"const": "WK"
Expand Down
16 changes: 8 additions & 8 deletions schemas/xbrl/utr/duration-item-type.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,56 @@
"anyOf": [
{
"title": "Year",
"description": "Gregorian calendar year of 365 days. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian calendar year of 365 days. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "yr",
"const": "Y"
},
{
"title": "Month",
"description": "Gregorian calendar month of 30.41 days. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian calendar month of 30.41 days. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "mo",
"const": "M"
},
{
"title": "Day",
"description": "Day of 24 hours. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Day of 24 hours. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "d",
"const": "D"
},
{
"title": "Hour",
"description": "Hour of 60 minutes. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Hour of 60 minutes. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "h",
"const": "H"
},
{
"title": "Minute",
"description": "Minute of 60 seconds. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Minute of 60 seconds. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "m",
"const": "MM"
},
{
"title": "Second",
"description": "Second. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Second. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "s",
"const": "S"
},
{
"title": "Quarter",
"description": "Gregorian Calendar Quarter (three months). Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian Calendar Quarter (three months). Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "qtr",
"const": "Q"
},
{
"title": "Week",
"description": "Gregorian Calendar Week. Use only as a denominator because durationItemType is not numeric and has no units.",
"description": "Gregorian Calendar Week. Use only as a denominator because durationItemType is not numeric and has no units",
"x-status": "REC",
"x-symbol": "wk",
"const": "WK"
Expand Down
4 changes: 2 additions & 2 deletions schemas/xbrl/utr/electric-charge-item-type-normative.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"anyOf": [
{
"title": "Ampere Hours",
"description": "An ampere hour or amp hour is a unit of electric charge, equal to the charge transferred by a steady current of one ampere flowing for one hour.",
"description": "An ampere hour or amp hour is a unit of electric charge, equal to the charge transferred by a steady current of one ampere flowing for one hour",
"x-status": "REC",
"x-symbol": "Ah",
"const": "Ah"
},
{
"title": "Coulomb",
"description": "The coulomb is the International System of Units (SI) unit of electric charge. It is the charge transported by a constant current of one ampere in one second.",
"description": "The coulomb is the International System of Units (SI) unit of electric charge. It is the charge transported by a constant current of one ampere in one second",
"x-status": "REC",
"x-symbol": "C",
"const": "C"
Expand Down
4 changes: 2 additions & 2 deletions schemas/xbrl/utr/electric-charge-item-type.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"anyOf": [
{
"title": "Ampere Hours",
"description": "An ampere hour or amp hour is a unit of electric charge, equal to the charge transferred by a steady current of one ampere flowing for one hour.",
"description": "An ampere hour or amp hour is a unit of electric charge, equal to the charge transferred by a steady current of one ampere flowing for one hour",
"x-status": "REC",
"x-symbol": "Ah",
"const": "Ah"
},
{
"title": "Coulomb",
"description": "The coulomb is the International System of Units (SI) unit of electric charge. It is the charge transported by a constant current of one ampere in one second.",
"description": "The coulomb is the International System of Units (SI) unit of electric charge. It is the charge transported by a constant current of one ampere in one second",
"x-status": "REC",
"x-symbol": "C",
"const": "C"
Expand Down
6 changes: 3 additions & 3 deletions schemas/xbrl/utr/energy-item-type-normative.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@
},
{
"title": "Volt-ampere-hours",
"description": "Volt-ampere (VA) hours of energy.",
"description": "Volt-ampere (VA) hours of energy",
"x-status": "REC",
"x-symbol": "VAh",
"const": "VAh"
},
{
"title": "Dekatherm",
"description": "The dekatherm is a unit of energy used to measure natural gas. One dekatherm is equal to 10 therms or one million British thermal units (Btu).",
"description": "The dekatherm is a unit of energy used to measure natural gas. One dekatherm is equal to 10 therms or one million British thermal units (Btu)",
"x-status": "REC",
"x-symbol": "dth",
"const": "dth"
},
{
"title": "Megawatt-Day",
"description": "Megawatt-Day is used to measure energy generated in one day by a power-plant. Is commonly used to define fuel-burnup. A commonly used measure of fuel burnup is the fission energy release per unit mass of fuel.",
"description": "Megawatt-Day is used to measure energy generated in one day by a power-plant. Is commonly used to define fuel-burnup. A commonly used measure of fuel burnup is the fission energy release per unit mass of fuel",
"x-status": "REC",
"x-symbol": "MWd",
"const": "MWd"
Expand Down
6 changes: 3 additions & 3 deletions schemas/xbrl/utr/energy-item-type.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@
},
{
"title": "Volt-ampere-hours",
"description": "Volt-ampere (VA) hours of energy.",
"description": "Volt-ampere (VA) hours of energy",
"x-status": "REC",
"x-symbol": "VAh",
"const": "VAh"
},
{
"title": "Dekatherm",
"description": "The dekatherm is a unit of energy used to measure natural gas. One dekatherm is equal to 10 therms or one million British thermal units (Btu).",
"description": "The dekatherm is a unit of energy used to measure natural gas. One dekatherm is equal to 10 therms or one million British thermal units (Btu)",
"x-status": "REC",
"x-symbol": "dth",
"const": "dth"
},
{
"title": "Megawatt-Day",
"description": "Megawatt-Day is used to measure energy generated in one day by a power-plant. Is commonly used to define fuel-burnup. A commonly used measure of fuel burnup is the fission energy release per unit mass of fuel.",
"description": "Megawatt-Day is used to measure energy generated in one day by a power-plant. Is commonly used to define fuel-burnup. A commonly used measure of fuel burnup is the fission energy release per unit mass of fuel",
"x-status": "REC",
"x-symbol": "MWd",
"const": "MWd"
Expand Down
2 changes: 1 addition & 1 deletion schemas/xbrl/utr/force-item-type-normative.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"anyOf": [
{
"title": "Newton",
"description": "The newton is the International System of Units (SI) derived unit of force. One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in direction of the applied force.",
"description": "The newton is the International System of Units (SI) derived unit of force. One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in direction of the applied force",
"x-status": "REC",
"x-symbol": "N",
"const": "N"
Expand Down
2 changes: 1 addition & 1 deletion schemas/xbrl/utr/force-item-type.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"anyOf": [
{
"title": "Newton",
"description": "The newton is the International System of Units (SI) derived unit of force. One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in direction of the applied force.",
"description": "The newton is the International System of Units (SI) derived unit of force. One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in direction of the applied force",
"x-status": "REC",
"x-symbol": "N",
"const": "N"
Expand Down
Loading