nac-validate 2.0.0b2__tar.gz → 2.0.0b3__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.
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/PKG-INFO +1 -1
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/validator.py +18 -8
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/pyproject.toml +1 -1
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/uv.lock +1 -1
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/dependabot.yml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/workflows/release.yml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.github/workflows/test.yml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.gitignore +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.pre-commit-config.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/.pre-commit-hooks.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/CHANGELOG.md +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/LICENSE +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/README.md +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/__main__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/main.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/cli/options.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/constants.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/exceptions.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/models.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/nac_validate/output_formatter.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/scripts/license-headers.sh +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/additional_data/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/additional_data_schema/schema.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/empty.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_env/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file1.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file2.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/result.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_non_strict/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_semantic_error/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_syntax_error/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_vault/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/rules/rule_101.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/rules_schema/rule_101.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/schema/schema.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/test_integration.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_cli.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_output_formatter.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/unit/test_validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nac-validate
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b3
|
|
4
4
|
Summary: A CLI tool to perform syntactic and semantic validation of YAML files.
|
|
5
5
|
Project-URL: homepage, https://github.com/netascode/nac-validate
|
|
6
6
|
Project-URL: repository, https://github.com/netascode/nac-validate
|
|
@@ -5,6 +5,7 @@ import importlib.util
|
|
|
5
5
|
import logging
|
|
6
6
|
import sys
|
|
7
7
|
import warnings
|
|
8
|
+
from collections.abc import Sequence
|
|
8
9
|
from inspect import signature
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
from typing import Any
|
|
@@ -183,7 +184,9 @@ class Validator:
|
|
|
183
184
|
"""
|
|
184
185
|
self.data = data
|
|
185
186
|
|
|
186
|
-
def _load_data_from_paths(
|
|
187
|
+
def _load_data_from_paths(
|
|
188
|
+
self, input_paths: Sequence[Path | str]
|
|
189
|
+
) -> dict[str, Any]:
|
|
187
190
|
"""Load and merge YAML data from file system paths.
|
|
188
191
|
|
|
189
192
|
Args:
|
|
@@ -192,6 +195,7 @@ class Validator:
|
|
|
192
195
|
Returns:
|
|
193
196
|
Merged YAML data dictionary
|
|
194
197
|
"""
|
|
198
|
+
input_paths = [Path(p) for p in input_paths]
|
|
195
199
|
logger.info("Loading yaml files from %s", input_paths)
|
|
196
200
|
self.data = load_yaml_files(input_paths)
|
|
197
201
|
return self.data
|
|
@@ -298,11 +302,14 @@ class Validator:
|
|
|
298
302
|
|
|
299
303
|
def validate_syntax(
|
|
300
304
|
self,
|
|
301
|
-
input_paths:
|
|
305
|
+
input_paths: Sequence[Path | str] | None = None,
|
|
302
306
|
strict: bool = True,
|
|
303
307
|
rich_output: bool = True,
|
|
304
308
|
) -> None:
|
|
305
309
|
"""Run syntactic validation"""
|
|
310
|
+
resolved_paths: list[Path] | None = (
|
|
311
|
+
[Path(p) for p in input_paths] if input_paths is not None else None
|
|
312
|
+
)
|
|
306
313
|
self.errors.clear()
|
|
307
314
|
self.structured_syntax_errors.clear()
|
|
308
315
|
self.file_count = 0
|
|
@@ -310,8 +317,8 @@ class Validator:
|
|
|
310
317
|
if self.data is not None:
|
|
311
318
|
if self.schema is not None:
|
|
312
319
|
source = (
|
|
313
|
-
str(
|
|
314
|
-
if
|
|
320
|
+
str(resolved_paths[0])
|
|
321
|
+
if resolved_paths and len(resolved_paths) > 0
|
|
315
322
|
else "<pre-loaded>"
|
|
316
323
|
)
|
|
317
324
|
try:
|
|
@@ -341,9 +348,9 @@ class Validator:
|
|
|
341
348
|
)
|
|
342
349
|
)
|
|
343
350
|
else:
|
|
344
|
-
if not
|
|
351
|
+
if not resolved_paths:
|
|
345
352
|
return
|
|
346
|
-
for input_path in
|
|
353
|
+
for input_path in resolved_paths:
|
|
347
354
|
if input_path.is_file():
|
|
348
355
|
self._validate_syntax_file(input_path, strict)
|
|
349
356
|
if input_path.suffix in YAML_SUFFIXES:
|
|
@@ -387,7 +394,10 @@ class Validator:
|
|
|
387
394
|
return self._get_violation_count(result) > 0
|
|
388
395
|
|
|
389
396
|
def validate_semantics(
|
|
390
|
-
self,
|
|
397
|
+
self,
|
|
398
|
+
input_paths: Sequence[Path | str],
|
|
399
|
+
rich_output: bool = True,
|
|
400
|
+
compact: bool = False,
|
|
391
401
|
) -> None:
|
|
392
402
|
"""Run semantic validation"""
|
|
393
403
|
if not self.rules:
|
|
@@ -468,7 +478,7 @@ class Validator:
|
|
|
468
478
|
file=sys.stderr,
|
|
469
479
|
)
|
|
470
480
|
|
|
471
|
-
def write_output(self, input_paths:
|
|
481
|
+
def write_output(self, input_paths: Sequence[Path | str], path: Path) -> None:
|
|
472
482
|
"""Write loaded YAML data to output file."""
|
|
473
483
|
if self.data is None:
|
|
474
484
|
self._load_data_from_paths(input_paths)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/additional_data/data.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/data.yaml
RENAMED
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_empty/empty.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file1.yaml
RENAMED
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/file2.yaml
RENAMED
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_merge/result.yaml
RENAMED
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_non_strict/data.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_syntax_error/data.yaml
RENAMED
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/data_vault/data.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{nac_validate-2.0.0b2 → nac_validate-2.0.0b3}/tests/integration/fixtures/rules_schema/rule_101.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|