Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow any type for choices field #6

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ansible_specdoc/objects.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This module contains various classes to be used in Ansible modules.
"""

import copy
from dataclasses import dataclass, field
from typing import List, Optional, Dict, Any

Expand Down Expand Up @@ -38,7 +38,7 @@ class SpecField:
editable: bool = False
conflicts_with: Optional[List[str]] = field(default_factory=lambda: [])
no_log: bool = False
choices: Optional[List[str]] = None
choices: Optional[List[Any]] = None
doc_hide: bool = False
aliases: Optional[List[str]] = None

Expand All @@ -55,7 +55,7 @@ def doc_dict(self) -> Optional[Dict[str, Any]]:
Returns the docs dict for this field.
"""

result = self.__dict__
result = copy.deepcopy(self.__dict__)
if self.suboptions is not None:
result['suboptions'] = {
k: v.doc_dict for k, v in self.suboptions.items() if not v.doc_hide
Expand Down