sdcvalidator 4.4.0__tar.gz → 4.4.1__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.
Files changed (32) hide show
  1. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/PKG-INFO +1 -1
  2. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/pyproject.toml +1 -1
  3. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/__init__.py +10 -2
  4. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/xsd11_restriction.py +8 -4
  5. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/PKG-INFO +1 -1
  6. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_xsd11_restriction.py +23 -0
  7. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/LICENSE +0 -0
  8. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/README.md +0 -0
  9. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/setup.cfg +0 -0
  10. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/cli.py +0 -0
  11. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/constants.py +0 -0
  12. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/converters.py +0 -0
  13. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/error_classifier.py +0 -0
  14. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/error_mapper.py +0 -0
  15. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/exceptions.py +0 -0
  16. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/instance_modifier.py +0 -0
  17. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/mcp_server.py +0 -0
  18. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/schema_checker.py +0 -0
  19. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator/validator.py +0 -0
  20. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/SOURCES.txt +0 -0
  21. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/dependency_links.txt +0 -0
  22. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/entry_points.txt +0 -0
  23. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/requires.txt +0 -0
  24. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/src/sdcvalidator.egg-info/top_level.txt +0 -0
  25. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_converters.py +0 -0
  26. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_error_classifier.py +0 -0
  27. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_error_mapper.py +0 -0
  28. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_instance_modifier.py +0 -0
  29. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_mcp_server.py +0 -0
  30. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_recovery.py +0 -0
  31. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_schema_checker.py +0 -0
  32. {sdcvalidator-4.4.0 → sdcvalidator-4.4.1}/tests/test_validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdcvalidator
3
- Version: 4.4.0
3
+ Version: 4.4.1
4
4
  Summary: SDC4 structural validator with ExceptionalValue recovery — thin wrapper over xmlschema
5
5
  Author: Semantic Data Charter Foundation
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sdcvalidator"
7
- version = "4.4.0"
7
+ version = "4.4.1"
8
8
  description = "SDC4 structural validator with ExceptionalValue recovery — thin wrapper over xmlschema"
9
9
  license = "Apache-2.0"
10
10
  requires-python = ">=3.10"
@@ -14,7 +14,7 @@ Thin wrapper over xmlschema with two-tier error classification and the SDC4
14
14
  "quarantine-and-tag" recovery pattern (ISO 21090 ExceptionalValues).
15
15
  """
16
16
 
17
- __version__ = "4.4.0"
17
+ __version__ = "4.4.1"
18
18
 
19
19
  # etree_tostring is re-exported from xmlschema so callers can serialize the
20
20
  # ElementTree returned by validate_with_recovery() without importing xmlschema
@@ -43,8 +43,14 @@ from .schema_checker import (
43
43
  assert_sdc4_schema_compliance,
44
44
  SDC4SchemaValidationError,
45
45
  )
46
+ from .xsd11_restriction import (
47
+ build_xsd11_schema,
48
+ is_substitution_group_restriction_false_positive,
49
+ )
46
50
 
47
- # Intentionally NOT exporting XMLSchema11 — SDCStudio's fallback import handles this.
51
+ # Intentionally NOT exporting XMLSchema11 — callers that need a schema builder
52
+ # should use build_xsd11_schema, which is a drop-in for XMLSchema11(...) and
53
+ # accepts the valid XSD 1.1 substitution-group restriction xmlschema false-rejects.
48
54
 
49
55
  __all__ = [
50
56
  "__version__",
@@ -62,4 +68,6 @@ __all__ = [
62
68
  "validate_sdc4_schema_compliance",
63
69
  "assert_sdc4_schema_compliance",
64
70
  "SDC4SchemaValidationError",
71
+ "build_xsd11_schema",
72
+ "is_substitution_group_restriction_false_positive",
65
73
  ]
@@ -134,11 +134,15 @@ def is_substitution_group_restriction_false_positive(error) -> bool:
134
134
 
135
135
 
136
136
  def build_xsd11_schema(
137
- source: Union[str, Path, "XMLSchema11"], validation: str = "strict"
137
+ source: Union[str, Path, "XMLSchema11"], validation: str = "strict", **kwargs
138
138
  ) -> XMLSchema11:
139
139
  """Build an ``XMLSchema11`` while tolerating only the known-valid XSD 1.1
140
140
  substitution-group restriction that xmlschema false-rejects.
141
141
 
142
+ A drop-in for the ``XMLSchema11(source, validation=..., **kwargs)`` constructor:
143
+ extra keyword arguments (``uri_mapper``, ``base_url``, ``locations``, ...) are
144
+ forwarded unchanged to ``XMLSchema11``.
145
+
142
146
  Strict mode is preserved for every other case: a clean schema builds once in
143
147
  strict mode; a schema that fails strict only because of the substitution-group
144
148
  false positive is rebuilt in lax mode and returned; any genuine error keeps
@@ -149,14 +153,14 @@ def build_xsd11_schema(
149
153
  build-time check is bypassed.
150
154
  """
151
155
  if validation != "strict":
152
- return XMLSchema11(source, validation=validation)
156
+ return XMLSchema11(source, validation=validation, **kwargs)
153
157
 
154
158
  try:
155
- return XMLSchema11(source, validation="strict")
159
+ return XMLSchema11(source, validation="strict", **kwargs)
156
160
  except XMLSchemaParseError as strict_error:
157
161
  if not is_substitution_group_restriction_false_positive(strict_error):
158
162
  raise
159
- schema = XMLSchema11(source, validation="lax")
163
+ schema = XMLSchema11(source, validation="lax", **kwargs)
160
164
  genuine = [
161
165
  e for e in schema.all_errors
162
166
  if not is_substitution_group_restriction_false_positive(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdcvalidator
3
- Version: 4.4.0
3
+ Version: 4.4.1
4
4
  Summary: SDC4 structural validator with ExceptionalValue recovery — thin wrapper over xmlschema
5
5
  Author: Semantic Data Charter Foundation
6
6
  License-Expression: Apache-2.0
@@ -202,3 +202,26 @@ def test_recognizer_ignores_non_restriction_errors():
202
202
  class Other(Exception):
203
203
  message = "something else entirely"
204
204
  assert is_substitution_group_restriction_false_positive(Other()) is False
205
+
206
+
207
+ def test_kwargs_are_forwarded(tmp_path):
208
+ """Extra keyword arguments (uri_mapper, base_url, ...) reach XMLSchema11."""
209
+ path = _write(tmp_path, "valid.xsd", ABSTRACT_HEAD_RM.format(derived=VALID_DERIVED))
210
+ called = {}
211
+
212
+ def uri_mapper(uri):
213
+ called["hit"] = True
214
+ return uri
215
+
216
+ schema = build_xsd11_schema(path, uri_mapper=uri_mapper)
217
+ assert "root" in schema.elements
218
+ # An unsupported kwarg must surface as an error, proving passthrough.
219
+ with pytest.raises(TypeError):
220
+ build_xsd11_schema(path, not_a_real_kwarg=123)
221
+
222
+
223
+ def test_public_exports():
224
+ """The builder and recognizer are importable from the package top level."""
225
+ import sdcvalidator
226
+ assert hasattr(sdcvalidator, "build_xsd11_schema")
227
+ assert hasattr(sdcvalidator, "is_substitution_group_restriction_false_positive")
File without changes
File without changes
File without changes