File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # 🧪 Campaign Configuration Validator
2+
3+ This Python script is designed to validate campaign configuration JSON file
4+
5+ ## 🛠 Requirements
6+
7+ - Python 3.13
8+ - ` rules_validation_api ` must be installed and accessible
9+ - campaign configuration JSON file to verify
10+
11+ ## Steps to verify
12+ - Get to the rules_validation_api folder
13+ - ` python app.py --config_path <path_to_config> `
14+
15+ ## Results
16+ - ` On success ` :
17+ "Valid config" is printed
18+ - ` On failure ` :
19+ "Errors will be printed"
20+
21+
Original file line number Diff line number Diff line change 1- import json
21import sys
2+ import json
3+ import argparse
34from pathlib import Path
45
56from rules_validation_api .validators .rules_validator import RulesValidation
67
78
89def main () -> None :
9- with Path .open (Path ("campaign_config.json" )) as file :
10- json_data = json .load (file ) # this validates json
10+ parser = argparse .ArgumentParser (description = "Validate campaign configuration." )
11+ parser .add_argument ("--config_path" , required = True , help = "Path to the campaign config JSON file" )
12+ args = parser .parse_args ()
13+
14+ with Path (args .config_path ).open () as file :
15+ json_data = json .load (file )
1116 RulesValidation (** json_data )
1217 sys .stdout .write ("Valid Config\n " )
1318
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments