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
- parent, when declared, is a string and the file carries the
.override.yamlsuffix (a mismatch either way is a warning) - 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
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
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 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | |
validate_recipe
Validates a recipe file's own schema.
Parses the YAML file, merges it over its parent recipe when it declares
one, and validates the result. Organization and vendor defaults are not
applied. 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, app count, and the parent path when the recipe declares one. |
Example
Validate a recipe and check results:
Source code in napt/validation.py
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | |