Parse JSON protocol description and return domain objects. :param Path json_path: path to a JSON CDP schema :param Path output_path: a directory path to create the modules in :returns: a list of CDP domain objects
(json_path, output_path)
| 918 | |
| 919 | |
| 920 | def parse(json_path, output_path): |
| 921 | """Parse JSON protocol description and return domain objects. |
| 922 | |
| 923 | :param Path json_path: path to a JSON CDP schema |
| 924 | :param Path output_path: a directory path to create the modules in |
| 925 | :returns: a list of CDP domain objects |
| 926 | """ |
| 927 | global current_version |
| 928 | with open(json_path, encoding="utf-8") as json_file: |
| 929 | schema = json.load(json_file) |
| 930 | version = schema["version"] |
| 931 | assert (version["major"], version["minor"]) == ("1", "3") |
| 932 | current_version = f"{version['major']}.{version['minor']}" |
| 933 | domains = [] |
| 934 | for domain in schema["domains"]: |
| 935 | domains.append(CdpDomain.from_json(domain)) |
| 936 | return domains |
| 937 | |
| 938 | |
| 939 | def generate_init(init_path, domains): |
no test coverage detected