jentic-openapi-validator-redocly 1.0.0a30__py3-none-any.whl → 1.0.0a32__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.
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import logging
3
+ import os
3
4
  import shlex
4
5
  import tempfile
5
6
  from collections.abc import Sequence
@@ -33,7 +34,7 @@ ruleset_file = rulesets_files_dir.joinpath("redocly.yaml")
33
34
  class RedoclyValidatorBackend(BaseValidatorBackend):
34
35
  def __init__(
35
36
  self,
36
- redocly_path: str = "npx --yes @redocly/cli@2.11.1",
37
+ redocly_path: str = "npx --yes @redocly/cli@2.14.3",
37
38
  ruleset_path: str | None = None,
38
39
  timeout: float = 600.0,
39
40
  allowed_base_dir: str | Path | None = None,
@@ -43,7 +44,7 @@ class RedoclyValidatorBackend(BaseValidatorBackend):
43
44
  Initialize the RedoclyValidatorBackend.
44
45
 
45
46
  Args:
46
- redocly_path: Path to the redocly CLI executable (default: "npx --yes @redocly/cli@2.11.1").
47
+ redocly_path: Path to the redocly CLI executable (default: "npx --yes @redocly/cli@2.14.3").
47
48
  Uses shell-safe parsing to handle quoted arguments properly.
48
49
  ruleset_path: Path to a custom ruleset file. If None, uses bundled default ruleset.
49
50
  timeout: Maximum time in seconds to wait for Redocly CLI execution (default: 600.0)
@@ -162,10 +163,19 @@ class RedoclyValidatorBackend(BaseValidatorBackend):
162
163
  str(self.max_problems),
163
164
  validated_doc_path,
164
165
  ]
166
+ env = os.environ.copy()
167
+ env.update(
168
+ {
169
+ "REDOCLY_TELEMETRY": "off",
170
+ "REDOCLY_SUPPRESS_UPDATE_NOTICE": "true",
171
+ }
172
+ )
165
173
 
166
174
  # Open the temp output file for writing and redirect stdout to it
167
175
  with open(output_path, "w", encoding="utf-8") as output_file:
168
- result = run_subprocess(cmd, timeout=self.timeout, stdout=output_file)
176
+ result = run_subprocess(
177
+ cmd, env=env, timeout=self.timeout, stdout=output_file
178
+ )
169
179
 
170
180
  if result is None:
171
181
  raise RuntimeError("Redocly validation failed - no result returned")
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jentic-openapi-validator-redocly
3
- Version: 1.0.0a30
3
+ Version: 1.0.0a32
4
4
  Summary: Jentic OpenAPI Redocly Validator Backend
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-common~=1.0.0a30
11
- Requires-Dist: jentic-openapi-validator~=1.0.0a30
10
+ Requires-Dist: jentic-openapi-common~=1.0.0a32
11
+ Requires-Dist: jentic-openapi-validator~=1.0.0a32
12
12
  Requires-Dist: lsprotocol~=2025.0.0
13
13
  Requires-Dist: jsonpointer~=3.0.0
14
14
  Requires-Python: >=3.11
@@ -17,7 +17,9 @@ Description-Content-Type: text/markdown
17
17
 
18
18
  # jentic-openapi-validator-redocly
19
19
 
20
- A [Redocly](https://redocly.com/docs/cli/) validator backend for the Jentic OpenAPI Tools ecosystem. This package provides OpenAPI document validation using Redocly CLI with comprehensive error reporting and flexible configuration options.
20
+ A [Redocly](https://redocly.com/docs/cli/) validator backend for the Jentic OpenAPI Tools ecosystem. This package
21
+ provides OpenAPI document validation using Redocly CLI with comprehensive error reporting and flexible configuration
22
+ options.
21
23
 
22
24
  ## Features
23
25
 
@@ -34,13 +36,14 @@ pip install jentic-openapi-validator-redocly
34
36
  ```
35
37
 
36
38
  **Prerequisites:**
39
+
37
40
  - Node.js and npm (for Redocly CLI)
38
41
  - Python 3.11+
39
42
 
40
43
  The Redocly CLI will be automatically downloaded via npx on first use, or you can install it globally:
41
44
 
42
45
  ```bash
43
- npm install -g @redocly/cli
46
+ npm install -g @redocly/cli@2.14.3
44
47
  ```
45
48
 
46
49
  ## Quick Start
@@ -86,7 +89,7 @@ print(f"Document is valid: {result.valid}")
86
89
  validator = RedoclyValidatorBackend(redocly_path="/usr/local/bin/redocly")
87
90
 
88
91
  # Use specific version via npx
89
- validator = RedoclyValidatorBackend(redocly_path="npx --yes @redocly/cli@2.11.1")
92
+ validator = RedoclyValidatorBackend(redocly_path="npx --yes @redocly/cli@2.14.3")
90
93
  ```
91
94
 
92
95
  ### Custom Rulesets
@@ -157,13 +160,15 @@ validator = RedoclyValidatorBackend(
157
160
  ```
158
161
 
159
162
  **Security Benefits:**
163
+
160
164
  - Prevents path traversal attacks (`../../etc/passwd`)
161
165
  - Restricts access to allowed directories only (when `allowed_base_dir` is set)
162
166
  - Validates file extensions (`.yaml`, `.yml`, `.json`) - **always enforced**, even when `allowed_base_dir=None`
163
167
  - Checks symlinks don't escape boundaries (when `allowed_base_dir` is set)
164
168
  - Validates both document and ruleset paths
165
169
 
166
- **Note:** File extension validation (`.yaml`, `.yml`, `.json`) is always performed for filesystem paths, regardless of whether `allowed_base_dir` is set. When `allowed_base_dir=None`, only the base directory containment check is skipped.
170
+ **Note:** File extension validation (`.yaml`, `.yml`, `.json`) is always performed for filesystem paths, regardless of
171
+ whether `allowed_base_dir` is set. When `allowed_base_dir=None`, only the base directory containment check is skipped.
167
172
 
168
173
  ## Advanced Usage
169
174
 
@@ -238,7 +243,8 @@ result = validator.validate("file:///path/to/openapi.yaml")
238
243
 
239
244
  ### Integration Tests
240
245
 
241
- The integration tests require Redocly CLI to be available. They will be automatically skipped if Redocly is not installed.
246
+ The integration tests require Redocly CLI to be available. They will be automatically skipped if Redocly is not
247
+ installed.
242
248
 
243
249
  **Run the integration test:**
244
250
 
@@ -253,36 +259,44 @@ uv run --package jentic-openapi-validator-redocly pytest packages/jentic-openapi
253
259
  ```python
254
260
  class RedoclyValidatorBackend(BaseValidatorBackend):
255
261
  def __init__(
256
- self,
257
- redocly_path: str = "npx --yes @redocly/cli@2.11.1",
258
- ruleset_path: str | None = None,
259
- timeout: float = 600.0,
260
- allowed_base_dir: str | Path | None = None,
262
+ self,
263
+ redocly_path: str = "npx --yes @redocly/cli@2.14.3",
264
+ ruleset_path: str | None = None,
265
+ timeout: float = 600.0,
266
+ allowed_base_dir: str | Path | None = None,
261
267
  ) -> None
262
268
  ```
263
269
 
264
270
  **Parameters:**
271
+
265
272
  - `redocly_path`: Path to Redocly CLI executable
266
273
  - `ruleset_path`: Path to a custom ruleset file (optional)
267
274
  - `timeout`: Maximum execution time in seconds
268
- - `allowed_base_dir`: Optional base directory for path security validation. When set, all document and ruleset paths are validated to be within this directory, providing defense against path traversal attacks. When `None` (default), only file extension validation is performed (no base directory containment check). Recommended for web services or untrusted input (optional)
275
+ - `allowed_base_dir`: Optional base directory for path security validation. When set, all document and ruleset paths are
276
+ validated to be within this directory, providing defense against path traversal attacks. When `None` (default), only
277
+ file extension validation is performed (no base directory containment check). Recommended for web services or
278
+ untrusted input (optional)
269
279
 
270
280
  **Methods:**
271
281
 
272
282
  - `accepts() -> list[Literal["uri", "dict"]]`: Returns supported document format identifiers
273
- - `validate(document: str | dict, *, base_url: str | None = None, target: str | None = None) -> ValidationResult`: Validates an OpenAPI document
283
+ - `validate(document: str | dict, *, base_url: str | None = None, target: str | None = None) -> ValidationResult`:
284
+ Validates an OpenAPI document
274
285
 
275
286
  **Exceptions:**
287
+
276
288
  - `FileNotFoundError`: Custom ruleset file doesn't exist
277
289
  - `RuntimeError`: Redocly execution fails
278
290
  - `SubprocessExecutionError`: Redocly times out or fails to start
279
291
  - `TypeError`: Unsupported document type
280
- - `PathTraversalError`: Document or ruleset path attempts to escape allowed_base_dir (only when `allowed_base_dir` is set)
292
+ - `PathTraversalError`: Document or ruleset path attempts to escape allowed_base_dir (only when `allowed_base_dir` is
293
+ set)
281
294
  - `InvalidExtensionError`: Document or ruleset path has disallowed file extension (always checked for filesystem paths)
282
295
 
283
296
  ## Exit Codes
284
297
 
285
298
  Redocly CLI uses the following exit codes:
299
+
286
300
  - **0**: No validation errors found
287
301
  - **1**: Validation errors found (document has issues)
288
302
  - **2+**: Command-line or configuration errors
@@ -1,9 +1,9 @@
1
- jentic/apitools/openapi/validator/backends/redocly/__init__.py,sha256=HJWMFUCDf5YDWz1zFLoHLg4Hn2mL36E7FmSgYboVYSk,14053
1
+ jentic/apitools/openapi/validator/backends/redocly/__init__.py,sha256=qOwhF9k7ygaifb4gQ-osdpjlrduaid54SsogvI7oR0A,14402
2
2
  jentic/apitools/openapi/validator/backends/redocly/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  jentic/apitools/openapi/validator/backends/redocly/rulesets/redocly.yaml,sha256=4YWOtk4-uXmH7Im58adZJr-VR1mJG2bFaOR1DdF1cM8,30
4
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
5
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/licenses/NOTICE,sha256=pAOGW-rGw9KNc2cuuLWZkfx0GSTV4TicbgBKZSLPMIs,168
6
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
7
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/entry_points.txt,sha256=wOFM-VNEwo-czDoLgOTePKT_bi0WXB9rDsb204dcFjs,131
8
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/METADATA,sha256=YR6L9-eoMktP7zJCiSr1QdGQish6wydmNgEstoyo9VI,9109
9
- jentic_openapi_validator_redocly-1.0.0a30.dist-info/RECORD,,
4
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
5
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/licenses/NOTICE,sha256=pAOGW-rGw9KNc2cuuLWZkfx0GSTV4TicbgBKZSLPMIs,168
6
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
7
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/entry_points.txt,sha256=wOFM-VNEwo-czDoLgOTePKT_bi0WXB9rDsb204dcFjs,131
8
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/METADATA,sha256=HFSCv1jzX93lgHydzfHYxSNZhq3XXNp_NETFewrZ2dg,9151
9
+ jentic_openapi_validator_redocly-1.0.0a32.dist-info/RECORD,,