jentic-openapi-validator-redocly 1.0.0a30__tar.gz → 1.0.0a32__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.
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/PKG-INFO +30 -16
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/README.md +27 -13
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/pyproject.toml +3 -3
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/src/jentic/apitools/openapi/validator/backends/redocly/__init__.py +13 -3
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/LICENSE +0 -0
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/NOTICE +0 -0
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/src/jentic/apitools/openapi/validator/backends/redocly/py.typed +0 -0
- {jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/src/jentic/apitools/openapi/validator/backends/redocly/rulesets/redocly.yaml +0 -0
{jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/PKG-INFO
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jentic-openapi-validator-redocly
|
|
3
|
-
Version: 1.0.
|
|
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.
|
|
11
|
-
Requires-Dist: jentic-openapi-validator~=1.0.
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
|
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`:
|
|
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
|
|
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
|
{jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/README.md
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# jentic-openapi-validator-redocly
|
|
2
2
|
|
|
3
|
-
A [Redocly](https://redocly.com/docs/cli/) validator backend for the Jentic OpenAPI Tools ecosystem. This package
|
|
3
|
+
A [Redocly](https://redocly.com/docs/cli/) validator backend for the Jentic OpenAPI Tools ecosystem. This package
|
|
4
|
+
provides OpenAPI document validation using Redocly CLI with comprehensive error reporting and flexible configuration
|
|
5
|
+
options.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
@@ -17,13 +19,14 @@ pip install jentic-openapi-validator-redocly
|
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
**Prerequisites:**
|
|
22
|
+
|
|
20
23
|
- Node.js and npm (for Redocly CLI)
|
|
21
24
|
- Python 3.11+
|
|
22
25
|
|
|
23
26
|
The Redocly CLI will be automatically downloaded via npx on first use, or you can install it globally:
|
|
24
27
|
|
|
25
28
|
```bash
|
|
26
|
-
npm install -g @redocly/cli
|
|
29
|
+
npm install -g @redocly/cli@2.14.3
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
## Quick Start
|
|
@@ -69,7 +72,7 @@ print(f"Document is valid: {result.valid}")
|
|
|
69
72
|
validator = RedoclyValidatorBackend(redocly_path="/usr/local/bin/redocly")
|
|
70
73
|
|
|
71
74
|
# Use specific version via npx
|
|
72
|
-
validator = RedoclyValidatorBackend(redocly_path="npx --yes @redocly/cli@2.
|
|
75
|
+
validator = RedoclyValidatorBackend(redocly_path="npx --yes @redocly/cli@2.14.3")
|
|
73
76
|
```
|
|
74
77
|
|
|
75
78
|
### Custom Rulesets
|
|
@@ -140,13 +143,15 @@ validator = RedoclyValidatorBackend(
|
|
|
140
143
|
```
|
|
141
144
|
|
|
142
145
|
**Security Benefits:**
|
|
146
|
+
|
|
143
147
|
- Prevents path traversal attacks (`../../etc/passwd`)
|
|
144
148
|
- Restricts access to allowed directories only (when `allowed_base_dir` is set)
|
|
145
149
|
- Validates file extensions (`.yaml`, `.yml`, `.json`) - **always enforced**, even when `allowed_base_dir=None`
|
|
146
150
|
- Checks symlinks don't escape boundaries (when `allowed_base_dir` is set)
|
|
147
151
|
- Validates both document and ruleset paths
|
|
148
152
|
|
|
149
|
-
**Note:** File extension validation (`.yaml`, `.yml`, `.json`) is always performed for filesystem paths, regardless of
|
|
153
|
+
**Note:** File extension validation (`.yaml`, `.yml`, `.json`) is always performed for filesystem paths, regardless of
|
|
154
|
+
whether `allowed_base_dir` is set. When `allowed_base_dir=None`, only the base directory containment check is skipped.
|
|
150
155
|
|
|
151
156
|
## Advanced Usage
|
|
152
157
|
|
|
@@ -221,7 +226,8 @@ result = validator.validate("file:///path/to/openapi.yaml")
|
|
|
221
226
|
|
|
222
227
|
### Integration Tests
|
|
223
228
|
|
|
224
|
-
The integration tests require Redocly CLI to be available. They will be automatically skipped if Redocly is not
|
|
229
|
+
The integration tests require Redocly CLI to be available. They will be automatically skipped if Redocly is not
|
|
230
|
+
installed.
|
|
225
231
|
|
|
226
232
|
**Run the integration test:**
|
|
227
233
|
|
|
@@ -236,36 +242,44 @@ uv run --package jentic-openapi-validator-redocly pytest packages/jentic-openapi
|
|
|
236
242
|
```python
|
|
237
243
|
class RedoclyValidatorBackend(BaseValidatorBackend):
|
|
238
244
|
def __init__(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
self,
|
|
246
|
+
redocly_path: str = "npx --yes @redocly/cli@2.14.3",
|
|
247
|
+
ruleset_path: str | None = None,
|
|
248
|
+
timeout: float = 600.0,
|
|
249
|
+
allowed_base_dir: str | Path | None = None,
|
|
244
250
|
) -> None
|
|
245
251
|
```
|
|
246
252
|
|
|
247
253
|
**Parameters:**
|
|
254
|
+
|
|
248
255
|
- `redocly_path`: Path to Redocly CLI executable
|
|
249
256
|
- `ruleset_path`: Path to a custom ruleset file (optional)
|
|
250
257
|
- `timeout`: Maximum execution time in seconds
|
|
251
|
-
- `allowed_base_dir`: Optional base directory for path security validation. When set, all document and ruleset paths are
|
|
258
|
+
- `allowed_base_dir`: Optional base directory for path security validation. When set, all document and ruleset paths are
|
|
259
|
+
validated to be within this directory, providing defense against path traversal attacks. When `None` (default), only
|
|
260
|
+
file extension validation is performed (no base directory containment check). Recommended for web services or
|
|
261
|
+
untrusted input (optional)
|
|
252
262
|
|
|
253
263
|
**Methods:**
|
|
254
264
|
|
|
255
265
|
- `accepts() -> list[Literal["uri", "dict"]]`: Returns supported document format identifiers
|
|
256
|
-
- `validate(document: str | dict, *, base_url: str | None = None, target: str | None = None) -> ValidationResult`:
|
|
266
|
+
- `validate(document: str | dict, *, base_url: str | None = None, target: str | None = None) -> ValidationResult`:
|
|
267
|
+
Validates an OpenAPI document
|
|
257
268
|
|
|
258
269
|
**Exceptions:**
|
|
270
|
+
|
|
259
271
|
- `FileNotFoundError`: Custom ruleset file doesn't exist
|
|
260
272
|
- `RuntimeError`: Redocly execution fails
|
|
261
273
|
- `SubprocessExecutionError`: Redocly times out or fails to start
|
|
262
274
|
- `TypeError`: Unsupported document type
|
|
263
|
-
- `PathTraversalError`: Document or ruleset path attempts to escape allowed_base_dir (only when `allowed_base_dir` is
|
|
275
|
+
- `PathTraversalError`: Document or ruleset path attempts to escape allowed_base_dir (only when `allowed_base_dir` is
|
|
276
|
+
set)
|
|
264
277
|
- `InvalidExtensionError`: Document or ruleset path has disallowed file extension (always checked for filesystem paths)
|
|
265
278
|
|
|
266
279
|
## Exit Codes
|
|
267
280
|
|
|
268
281
|
Redocly CLI uses the following exit codes:
|
|
282
|
+
|
|
269
283
|
- **0**: No validation errors found
|
|
270
284
|
- **1**: Validation errors found (document has issues)
|
|
271
285
|
- **2+**: Command-line or configuration errors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jentic-openapi-validator-redocly"
|
|
3
|
-
version = "1.0.0-alpha.
|
|
3
|
+
version = "1.0.0-alpha.32"
|
|
4
4
|
description = "Jentic OpenAPI Redocly Validator Backend"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Jentic", email = "hello@jentic.com" }]
|
|
@@ -8,8 +8,8 @@ license = "Apache-2.0"
|
|
|
8
8
|
license-files = ["LICENSE", "NOTICE"]
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
11
|
-
"jentic-openapi-common~=1.0.0-alpha.
|
|
12
|
-
"jentic-openapi-validator~=1.0.0-alpha.
|
|
11
|
+
"jentic-openapi-common~=1.0.0-alpha.32",
|
|
12
|
+
"jentic-openapi-validator~=1.0.0-alpha.32",
|
|
13
13
|
"lsprotocol~=2025.0.0",
|
|
14
14
|
"jsonpointer~=3.0.0"
|
|
15
15
|
]
|
|
@@ -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.
|
|
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.
|
|
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(
|
|
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")
|
{jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/LICENSE
RENAMED
|
File without changes
|
{jentic_openapi_validator_redocly-1.0.0a30 → jentic_openapi_validator_redocly-1.0.0a32}/NOTICE
RENAMED
|
File without changes
|
|
File without changes
|