json-structure 0.1.21__tar.gz → 0.2.0__tar.gz
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.
- {json_structure-0.1.21 → json_structure-0.2.0}/PKG-INFO +1 -1
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/_version.py +2 -2
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/instance_validator.py +8 -4
- {json_structure-0.1.21 → json_structure-0.2.0}/.gitignore +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/README.md +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/pyproject.toml +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/__init__.py +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/error_codes.py +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/json_source_locator.py +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/schema_exporter.py +0 -0
- {json_structure-0.1.21 → json_structure-0.2.0}/src/json_structure/schema_validator.py +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.2.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 0)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -480,15 +480,19 @@ class JSONStructureInstanceValidator:
|
|
|
480
480
|
self.validate_instance(instance[prop], prop_schema, f"{path}/{prop}")
|
|
481
481
|
if "additionalProperties" in schema:
|
|
482
482
|
addl = schema["additionalProperties"]
|
|
483
|
-
# $schema
|
|
484
|
-
|
|
483
|
+
# $schema and $uses are reserved properties allowed in instances at root level
|
|
484
|
+
reserved_instance_props = {"$schema", "$uses"}
|
|
485
485
|
if addl is False:
|
|
486
486
|
for key in instance.keys():
|
|
487
|
-
|
|
487
|
+
# Only allow reserved instance props at root level (path == '#')
|
|
488
|
+
is_reserved_at_root = path == "#" and key in reserved_instance_props
|
|
489
|
+
if key not in props and not is_reserved_at_root:
|
|
488
490
|
self.errors.append(f"Additional property '{key}' not allowed at {path}")
|
|
489
491
|
elif isinstance(addl, dict):
|
|
490
492
|
for key in instance.keys():
|
|
491
|
-
|
|
493
|
+
# Only allow reserved instance props at root level (path == '#')
|
|
494
|
+
is_reserved_at_root = path == "#" and key in reserved_instance_props
|
|
495
|
+
if key not in props and not is_reserved_at_root:
|
|
492
496
|
self.validate_instance(instance[key], addl, f"{path}/{key}")
|
|
493
497
|
# Extended object constraint: "has" keyword. [Metaschema: ObjectValidationAddIn]
|
|
494
498
|
if "has" in schema:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|