Created
July 15, 2021 22:08
-
-
Save abadger/3d47ae0ead289943758a07cc5555a99d to your computer and use it in GitHub Desktop.
Start of a patch to the docs schema for module argspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/antsibull/schemas/docs/module.py b/antsibull/schemas/docs/module.py | |
index d795550..ebaf2ba 100644 | |
--- a/antsibull/schemas/docs/module.py | |
+++ b/antsibull/schemas/docs/module.py | |
@@ -12,7 +12,15 @@ from .base import BaseModel, DocSchema, OptionsSchema | |
from .plugin import PluginExamplesSchema, PluginMetadataSchema, PluginReturnSchema | |
-class InnerModuleOptionsSchema(OptionsSchema): | |
+class ArgSpecModifiersSchema(BaseModel): | |
+ mutually_exclusive: t.Sequence[p.conlist(item_type=str, min_items=2)] = [] | |
+ required_together: t.Sequence[p.conlist(item_type=str, min_items=2)] = [] | |
+ required_one_of: t.Sequence[p.conlist(item_type=str, min_items=2)] = [] | |
+ required_if: t.Squence[p.conlist(item_type=str, min_items=3, max_items=4)] | |
+ required_by: t.Mapping[str: t.Any] # Need to fix this. This is the voluptuous definition Schema({str: Any(list_string_types, tuple_string_types, *string_types)}) | |
+ | |
+ | |
+class InnerModuleOptionsSchema(OptionsSchema, ArgSpecModifiersSchema): | |
suboptions: t.Dict[str, 'InnerModuleOptionsSchema'] = {} | |
@p.root_validator(pre=True) | |
@@ -26,11 +34,11 @@ class InnerModuleOptionsSchema(OptionsSchema): | |
InnerModuleOptionsSchema.update_forward_refs() | |
-class ModuleOptionsSchema(OptionsSchema): | |
+class ModuleOptionsSchema(OptionsSchema, ArgSpecModifiersSchema): | |
suboptions: t.Dict[str, 'InnerModuleOptionsSchema'] = {} | |
-class OuterModuleDocSchema(DocSchema): | |
+class OuterModuleDocSchema(DocSchema, ArgSpecModifiersSchema): | |
options: t.Dict[str, ModuleOptionsSchema] = {} | |
has_action: bool = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment