mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 12:33:59 -07:00
Added test for 'RETURN' field in validate-modules (#23322)
* Added test for 'RETURN' field in validate-modules * print the field being tested. Useful when the RETURN structure is complex. * Fixed schema after CI traceback fail * Fixed list_string_types * Fixed line in 319 code for RETURN
This commit is contained in:
parent
93de128844
commit
4e4fc9cb4c
3 changed files with 34 additions and 3 deletions
|
@ -41,7 +41,7 @@ from ansible.utils.plugin_docs import BLACKLIST, get_docstring
|
|||
|
||||
from module_args import get_argument_spec
|
||||
|
||||
from schema import doc_schema, option_schema, metadata_schema
|
||||
from schema import doc_schema, option_schema, metadata_schema, return_schema
|
||||
|
||||
from utils import CaptureStd, parse_yaml
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
@ -696,9 +696,13 @@ class ModuleValidator(Validator):
|
|||
else:
|
||||
self.warnings.append((312, 'No RETURN provided'))
|
||||
else:
|
||||
_, errors, traces = parse_yaml(doc_info['RETURN']['value'],
|
||||
data, errors, traces = parse_yaml(doc_info['RETURN']['value'],
|
||||
doc_info['RETURN']['lineno'],
|
||||
self.name, 'RETURN')
|
||||
|
||||
if data:
|
||||
for ret_key in data:
|
||||
self._validate_docs_schema(data[ret_key], return_schema(data[ret_key]), 'RETURN.%s' % ret_key, 319)
|
||||
self.errors.extend([(313, error) for error in errors])
|
||||
self.traces.extend(traces)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue