jentic-openapi-validator 1.0.0a32__py3-none-any.whl → 1.0.0a34__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.
@@ -52,13 +52,30 @@ class OpenAPISpecValidatorBackend(BaseValidatorBackend):
52
52
  diagnostics: list[JenticDiagnostic] = []
53
53
  try:
54
54
  for error in validator.iter_errors():
55
+ # Determine a meaningful code for the diagnostic.
56
+ # Note: error.validator and error.validator_value can be <unset> sentinel
57
+ # objects that are truthy but stringify to '<unset>'. We must check the
58
+ # string representation to detect this.
59
+ code: str
60
+ validator_str = str(error.validator) if error.validator is not None else ""
61
+ validator_value_str = (
62
+ str(error.validator_value) if error.validator_value is not None else ""
63
+ )
64
+
65
+ if validator_str and validator_str != "<unset>":
66
+ code = validator_str
67
+ elif validator_value_str and validator_value_str != "<unset>":
68
+ code = validator_value_str
69
+ else:
70
+ code = "osv-validation-error"
71
+
55
72
  diagnostic = JenticDiagnostic(
56
73
  range=lsp.Range(
57
74
  start=lsp.Position(line=0, character=0),
58
75
  end=lsp.Position(line=0, character=0),
59
76
  ),
60
77
  severity=lsp.DiagnosticSeverity.Error,
61
- code=f"{error.validator or str(error.validator_value)}",
78
+ code=code,
62
79
  source="openapi-spec-validator",
63
80
  message=error.message,
64
81
  )
@@ -1,7 +1,7 @@
1
1
  from dataclasses import dataclass, field
2
2
  from typing import TypeAlias
3
3
 
4
- from lsprotocol.types import Diagnostic
4
+ from lsprotocol.types import Diagnostic, DiagnosticSeverity
5
5
 
6
6
 
7
7
  __all__ = ["JenticDiagnostic", "ValidationResult", "DataFieldValue"]
@@ -61,7 +61,7 @@ class ValidationResult:
61
61
 
62
62
  Attributes:
63
63
  diagnostics: List of all diagnostics from validation
64
- valid: True if no diagnostics were found, False otherwise (computed automatically)
64
+ valid: True if no Error-severity diagnostics were found, False otherwise (computed automatically)
65
65
  """
66
66
 
67
67
  diagnostics: list[JenticDiagnostic] = field(default_factory=list)
@@ -69,14 +69,14 @@ class ValidationResult:
69
69
 
70
70
  def __post_init__(self):
71
71
  """Compute the valid attribute after initialization."""
72
- self.valid = len(self.diagnostics) == 0
72
+ self.valid = not any(d.severity == DiagnosticSeverity.Error for d in self.diagnostics)
73
73
 
74
74
  def __bool__(self) -> bool:
75
75
  """
76
76
  Allow ValidationResult to be used in boolean context.
77
77
 
78
78
  Returns:
79
- True if validation passed (no diagnostics), False otherwise
79
+ True if validation passed (no Error-severity diagnostics), False otherwise
80
80
 
81
81
  Example:
82
82
  >>> result = validator.validate(document)
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jentic-openapi-validator
3
- Version: 1.0.0a32
3
+ Version: 1.0.0a34
4
4
  Summary: Jentic OpenAPI Validator
5
5
  Author: Jentic
6
6
  Author-email: Jentic <hello@jentic.com>
7
7
  License-Expression: Apache-2.0
8
8
  License-File: LICENSE
9
9
  License-File: NOTICE
10
- Requires-Dist: jentic-openapi-parser~=1.0.0a32
10
+ Requires-Dist: jentic-openapi-parser~=1.0.0a34
11
11
  Requires-Dist: openapi-spec-validator~=0.7.2
12
12
  Requires-Dist: lsprotocol~=2025.0.0
13
- Requires-Dist: jentic-openapi-validator-redocly~=1.0.0a32 ; extra == 'redocly'
14
- Requires-Dist: jentic-openapi-validator-spectral~=1.0.0a32 ; extra == 'spectral'
13
+ Requires-Dist: jentic-openapi-validator-redocly~=1.0.0a34 ; extra == 'redocly'
14
+ Requires-Dist: jentic-openapi-validator-spectral~=1.0.0a34 ; extra == 'spectral'
15
15
  Requires-Python: >=3.11
16
16
  Project-URL: Homepage, https://github.com/jentic/jentic-openapi-tools
17
17
  Provides-Extra: redocly
@@ -4,15 +4,15 @@ jentic/apitools/openapi/validator/backends/default/rules/__init__.py,sha256=9ZMt
4
4
  jentic/apitools/openapi/validator/backends/default/rules/security.py,sha256=Ew6goVzHKgGyBxPCx6pNHEdzOttrdsL5kwFO1ZW_qiM,7131
5
5
  jentic/apitools/openapi/validator/backends/default/rules/server.py,sha256=jzwZKi5tl6IMreOEizpcDCFG6uqGU5377MoXU2zkG0s,4195
6
6
  jentic/apitools/openapi/validator/backends/default/rules/structural.py,sha256=FrIK9MwI8xEG13J6NprXilDP-rerV7kHKdxHEyLIs7k,3327
7
- jentic/apitools/openapi/validator/backends/openapi_spec.py,sha256=tEboIwNHxe8BXkK65iBAAiL0SV04kvjRyDmOx5mOqpM,4468
7
+ jentic/apitools/openapi/validator/backends/openapi_spec.py,sha256=Lib0mbs9ZURw02PnhblBk403cYduRArVyOTeCBPALGw,5296
8
8
  jentic/apitools/openapi/validator/backends/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  jentic/apitools/openapi/validator/core/__init__.py,sha256=OOJD1Z8Zn8ya537_62xaAhdHypy8J8iFHvx0U0DpP5o,181
10
- jentic/apitools/openapi/validator/core/diagnostics.py,sha256=3TXAxIHly_o5lKw_YcNEwOH2BinOHBK90X32-ioFGFc,3233
10
+ jentic/apitools/openapi/validator/core/diagnostics.py,sha256=RxDCZjt11pv00e8GIwstxPJgL8RwwgRyInxNYVj34Ho,3330
11
11
  jentic/apitools/openapi/validator/core/openapi_validator.py,sha256=5X5VmPhseDhw2uFlABrwU0jA1nWAnoWl4YfsZxdE1nU,10119
12
12
  jentic/apitools/openapi/validator/core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- jentic_openapi_validator-1.0.0a32.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
14
- jentic_openapi_validator-1.0.0a32.dist-info/licenses/NOTICE,sha256=pAOGW-rGw9KNc2cuuLWZkfx0GSTV4TicbgBKZSLPMIs,168
15
- jentic_openapi_validator-1.0.0a32.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
16
- jentic_openapi_validator-1.0.0a32.dist-info/entry_points.txt,sha256=zIjHHOn2NeSIYzj-HvxuXZY74uRXJOE0Vi4aFV09gjg,237
17
- jentic_openapi_validator-1.0.0a32.dist-info/METADATA,sha256=QWZ0OCuHP252tAkgWg03fdsogDd7tUQXtCQFaZN2dLU,8314
18
- jentic_openapi_validator-1.0.0a32.dist-info/RECORD,,
13
+ jentic_openapi_validator-1.0.0a34.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
14
+ jentic_openapi_validator-1.0.0a34.dist-info/licenses/NOTICE,sha256=pAOGW-rGw9KNc2cuuLWZkfx0GSTV4TicbgBKZSLPMIs,168
15
+ jentic_openapi_validator-1.0.0a34.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
16
+ jentic_openapi_validator-1.0.0a34.dist-info/entry_points.txt,sha256=zIjHHOn2NeSIYzj-HvxuXZY74uRXJOE0Vi4aFV09gjg,237
17
+ jentic_openapi_validator-1.0.0a34.dist-info/METADATA,sha256=OwhXUEYuysv46hN9haL6dNEEFqYLPY_9INd0QTjQc6o,8314
18
+ jentic_openapi_validator-1.0.0a34.dist-info/RECORD,,