From 4824b333588a99c7b8f04838b3a855b7b465ab03 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 27 Jul 2024 13:28:55 +0200 Subject: [PATCH] Ameliore generation doc API --- tools/create_api_map.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/create_api_map.py b/tools/create_api_map.py index cdf03c733..924564206 100644 --- a/tools/create_api_map.py +++ b/tools/create_api_map.py @@ -854,7 +854,13 @@ def _gen_csv_line(doc_line: dict) -> str: samples: list[str] = doc_line.get("samples", []) csv_lines: list[str] = [] for sample in samples: - url, content = sample.split(";", maxsplit=1) + fragments = sample.split(";", maxsplit=1) + if len(fragments) == 2: + url, content = fragments + elif len(fragments) == 1: + url, content = fragments[0], "" + else: + raise ValueError(f"Error: sample invalide: {sample}") csv_line = f'"{entry_name}";"{url}";"{permission}";"{method}";' if content: csv_line += f'"{content}"'