Skip to content

Commit

Permalink
jsonify return for yaml safe load
Browse files Browse the repository at this point in the history
  • Loading branch information
jriddle-linode committed Aug 5, 2024
1 parent c8a1d2d commit 7c07277
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ansible_specdoc/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 7c07277

Please sign in to comment.