diff --git a/test/sanity/validate-modules/validate-modules b/test/sanity/validate-modules/validate-modules index 01e04e4bb9..1e76fb3518 100755 --- a/test/sanity/validate-modules/validate-modules +++ b/test/sanity/validate-modules/validate-modules @@ -39,6 +39,7 @@ from module_args import get_argument_spec from schema import doc_schema, option_schema from utils import CaptureStd +from voluptuous.humanize import humanize_error import yaml import yaml.reader @@ -373,6 +374,8 @@ class ModuleValidator(Validator): try: doc_schema(doc) except Exception as e: + for error in e.errors: + error.data = doc errors.extend(e.errors) options = doc.get('options', {}) @@ -382,12 +385,13 @@ class ModuleValidator(Validator): except Exception as e: for error in e.errors: error.path[:0] = ['options', key] + error.data = option errors.extend(e.errors) for error in errors: path = [str(p) for p in error.path] self.errors.append('DOCUMENTATION.%s: %s' % - ('.'.join(path), error.error_message)) + ('.'.join(path), humanize_error(error.data, error))) def _validate_docs(self): doc_info = self._get_docs()