From 29f9613f8d7a3ec8ea664c664f921e25bf41d3a7 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Wed, 22 May 2024 18:17:57 +0000 Subject: [PATCH] docs: use multiple json examples --- docs/gen_tool_specs_types.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/gen_tool_specs_types.py b/docs/gen_tool_specs_types.py index 6564a6b6f5..b632728021 100644 --- a/docs/gen_tool_specs_types.py +++ b/docs/gen_tool_specs_types.py @@ -41,12 +41,13 @@ def print_type(module: str | None, type_name: str | None, f: TextIOWrapper): f.write(yaml.dump(type_json_schema, indent=2, default_flow_style=False, sort_keys=False)) f.write("```\n\n") - if hasattr(type, "model_json_example"): - type_json_example = type.model_json_example() + if hasattr(type, "model_json_examples"): + type_json_examples = type.model_json_examples() f.write("#### JSON example\n\n") - f.write("```json\n") - f.write(json.dumps(to_json(type_json_example), indent=2, sort_keys=False)) - f.write("\n```\n\n") + for type_json_example in type_json_examples: + f.write("```json\n") + f.write(json.dumps(to_json(type_json_example), indent=2, sort_keys=False)) + f.write("\n```\n\n") with mkdocs_gen_files.open(t8n_types_file, "w") as f: