validation
napt.validation
Recipe validation module.
This module provides validation functions for checking recipe syntax and configuration without making network calls or downloading files. This is useful for quick feedback during recipe development and in CI/CD pipelines.
Validation Checks:
- YAML syntax is valid
- Required top-level fields present (apiVersion, name, id, discovery)
- apiVersion is supported
- discovery.strategy exists and is registered
- Strategy-specific configuration is valid
- intune.detection fields are valid (types, values, unknown field warnings)
- psadt.app_vars only contains user-settable keys
- logging section fields are valid
Example
Validate a recipe and handle results:
validate_config
Validates a merged configuration dict.
Checks required fields, types, strategy registration, and section-level
validation. Used by both validate_recipe (CLI) and
load_effective_config (pipeline commands) so that one set of rules
applies everywhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
The merged configuration dictionary to validate. |
required |
recipe_path
|
str
|
Optional path string for error context. |
''
|
Returns:
| Type | Description |
|---|---|
ValidationResult
|
Validation status, errors, warnings, and app count. |
Source code in napt/validation.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
validate_recipe
Loads, merges, and validates a recipe file.
Parses the YAML file, merges it through the config hierarchy, and
validates the merged result. This is the entry point for napt validate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe_path
|
Path
|
Path to the recipe YAML file to validate. |
required |
Returns:
| Type | Description |
|---|---|
ValidationResult
|
Validation status, errors, warnings, and app count. |
Example
Validate a recipe and check results:
Source code in napt/validation.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | |