jsonstat-validator 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jsonstat_validator/__init__.py +1 -1
- jsonstat_validator/validator.py +9 -4
- {jsonstat_validator-0.1.3.dist-info → jsonstat_validator-0.1.5.dist-info}/METADATA +4 -3
- jsonstat_validator-0.1.5.dist-info/RECORD +7 -0
- {jsonstat_validator-0.1.3.dist-info → jsonstat_validator-0.1.5.dist-info}/WHEEL +1 -1
- jsonstat_validator-0.1.3.dist-info/RECORD +0 -7
- {jsonstat_validator-0.1.3.dist-info → jsonstat_validator-0.1.5.dist-info/licenses}/LICENSE +0 -0
- {jsonstat_validator-0.1.3.dist-info → jsonstat_validator-0.1.5.dist-info}/top_level.txt +0 -0
jsonstat_validator/__init__.py
CHANGED
jsonstat_validator/validator.py
CHANGED
@@ -179,11 +179,15 @@ class Category(JSONStatBaseModel):
|
|
179
179
|
|
180
180
|
# Ensure index and label have the same keys if both are dictionaries
|
181
181
|
if self.index and self.label:
|
182
|
-
if isinstance(self.
|
183
|
-
|
182
|
+
if isinstance(self.label, dict):
|
183
|
+
index_keys = (
|
184
|
+
set(self.index)
|
185
|
+
if isinstance(self.index, list)
|
186
|
+
else set(self.index.keys())
|
187
|
+
)
|
188
|
+
if index_keys != set(self.label.keys()):
|
184
189
|
raise ValueError(
|
185
|
-
"
|
186
|
-
"they must have the same keys."
|
190
|
+
"Validation error: `index` and `label` must have the same keys."
|
187
191
|
)
|
188
192
|
|
189
193
|
# Ensure coordinates are a dictionary where keys are category IDs
|
@@ -246,6 +250,7 @@ class Link(JSONStatBaseModel):
|
|
246
250
|
href: Optional[AnyUrl] = Field(default=None, description="It specifies a URL.")
|
247
251
|
class_: Optional[Literal["dataset", "dimension", "collection"]] = Field(
|
248
252
|
default=None,
|
253
|
+
alias="class",
|
249
254
|
description=(
|
250
255
|
"It describes the class of the resource referenced "
|
251
256
|
"in the link. Not required when the resource referenced "
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: jsonstat-validator
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.5
|
4
4
|
Summary: A Python validator for the JSON-stat 2.0 standard format, based on Pydantic.
|
5
5
|
Author-email: Ahmed Hassan <ahmedhassan.ahmed@fao.org>
|
6
6
|
License: # MIT License
|
@@ -50,6 +50,7 @@ Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
50
50
|
Requires-Dist: black>=23.0.0; extra == "dev"
|
51
51
|
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
52
52
|
Requires-Dist: isort>=5.12.0; extra == "dev"
|
53
|
+
Dynamic: license-file
|
53
54
|
|
54
55
|
# JSON-stat Validator
|
55
56
|
|
@@ -76,7 +77,7 @@ Please note that this implementation is intentionally more strict than the offic
|
|
76
77
|
|
77
78
|
This dataset would be considered valid by the official JSON-stat validator tool, but will fail validation in this package because it violates the rule in the `dataset.size` section of the specification stating that: `size has the same number of elements and in the same order as in id`.
|
78
79
|
|
79
|
-
Additionally, we enforce the `role` field as required when class
|
80
|
+
Additionally, we enforce the `role` field as required when `class=dataset`.
|
80
81
|
|
81
82
|
## Table of Contents
|
82
83
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
jsonstat_validator/__init__.py,sha256=a7RmQtNORo6rUfEYXqHy0NF7nKav-MZS__IMJEO4OeA,806
|
2
|
+
jsonstat_validator/validator.py,sha256=g7q9lw9cOnWdYw1LBQrTY0ielr6mpjWuD20nkUEeWr8,28244
|
3
|
+
jsonstat_validator-0.1.5.dist-info/licenses/LICENSE,sha256=cyCvx3tHW8u9ZWGkTMrCKaB2ft4RonlMBVOEHDa2tEk,1091
|
4
|
+
jsonstat_validator-0.1.5.dist-info/METADATA,sha256=2e7dhb6jnrog11FaEMLP_ylrktmneGnmM_0DSJ0Indc,7358
|
5
|
+
jsonstat_validator-0.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
6
|
+
jsonstat_validator-0.1.5.dist-info/top_level.txt,sha256=l6xoMFlWGRRbXMxl4MG-q0FA3In7rYZLBzVF8W7IhdU,19
|
7
|
+
jsonstat_validator-0.1.5.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
jsonstat_validator/__init__.py,sha256=hvsaEgQFH8vY_bPRDyrhroxjJd1c5nFjmZQ_lxzH0AQ,806
|
2
|
-
jsonstat_validator/validator.py,sha256=_m3Q4VjnrCM11xg3LkC4A_rDle2rHnMsIk4SAv-dL4A,28121
|
3
|
-
jsonstat_validator-0.1.3.dist-info/LICENSE,sha256=cyCvx3tHW8u9ZWGkTMrCKaB2ft4RonlMBVOEHDa2tEk,1091
|
4
|
-
jsonstat_validator-0.1.3.dist-info/METADATA,sha256=tutn48KR1gZeDLpwagNii8TcYpUA5gQyVjzQXcDSmco,7336
|
5
|
-
jsonstat_validator-0.1.3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
6
|
-
jsonstat_validator-0.1.3.dist-info/top_level.txt,sha256=l6xoMFlWGRRbXMxl4MG-q0FA3In7rYZLBzVF8W7IhdU,19
|
7
|
-
jsonstat_validator-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|