diff --git a/ansible_specdoc/objects.py b/ansible_specdoc/objects.py index 388bc76..f60c2ff 100644 --- a/ansible_specdoc/objects.py +++ b/ansible_specdoc/objects.py @@ -5,6 +5,7 @@ from __future__ import annotations import copy +import json from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Tuple, Union @@ -213,7 +214,7 @@ def ansible_doc(self) -> Dict[str, Any]: "description": self.description, "type": str(self.type), "returned": self.returned, - "sample": self.sample, + "sample": json.loads("".join(self.sample)), } if self.elements is not None: diff --git a/tests/test_cli.py b/tests/test_cli.py index ce4aaca..91edebe 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -163,6 +163,7 @@ def test_docs_file_injection(): assert f'DOCUMENTATION = r"""\n{docs}"""' in output assert f'EXAMPLES = r"""\n{examples}"""' in output assert f'RETURN = r"""\n{returns}"""' in output + assert '{' not in returns @staticmethod def test_docs_file_clear():