Skip to content

Commit

Permalink
update returns to render as yaml (#40)
Browse files Browse the repository at this point in the history
## 📝 Description

**What does this PR do and why is this change necessary?**

Replaces the existing return samples with a yaml style format which will render correctly on Galaxy.

## ✔️ How to Test

**How do I run the relevant unit/integration tests?**

```bash
make test
```

1. Install the tool
```bash
make install
```
2. Go to ansible_linode and use it on a module
```bash
ansible-specdoc -j -i plugins/modules/domain.py
```
3. Open and view the file verfiying the format of the `RETURN` section
  • Loading branch information
jriddle-linode authored Aug 8, 2024
1 parent c8a1d2d commit 7f3e92c
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 7f3e92c

Please sign in to comment.