jsonstat-validator 0.1.3__py3-none-any.whl → 0.1.4__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.
@@ -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.index, dict) and isinstance(self.label, dict):
183
- if set(self.index.keys()) != set(self.label.keys()):
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
- "If `index` and `label` are both dictionaries, "
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jsonstat-validator
3
- Version: 0.1.3
3
+ Version: 0.1.4
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
@@ -76,7 +76,7 @@ Please note that this implementation is intentionally more strict than the offic
76
76
 
77
77
  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
78
 
79
- Additionally, we enforce the `role` field as required when class=`dataset`.
79
+ Additionally, we enforce the `role` field as required when `class=dataset`.
80
80
 
81
81
  ## Table of Contents
82
82
 
@@ -0,0 +1,7 @@
1
+ jsonstat_validator/__init__.py,sha256=hvsaEgQFH8vY_bPRDyrhroxjJd1c5nFjmZQ_lxzH0AQ,806
2
+ jsonstat_validator/validator.py,sha256=HQ5OFKlLSCXevXP44MYb2P9Gm9UbyhacXoMFyE4_3sg,28221
3
+ jsonstat_validator-0.1.4.dist-info/LICENSE,sha256=cyCvx3tHW8u9ZWGkTMrCKaB2ft4RonlMBVOEHDa2tEk,1091
4
+ jsonstat_validator-0.1.4.dist-info/METADATA,sha256=vhPhl-4DqzwHywdDThjNYsoWcJaI7krZ8IuBrR4XEnM,7336
5
+ jsonstat_validator-0.1.4.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
6
+ jsonstat_validator-0.1.4.dist-info/top_level.txt,sha256=l6xoMFlWGRRbXMxl4MG-q0FA3In7rYZLBzVF8W7IhdU,19
7
+ jsonstat_validator-0.1.4.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,,