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

Feature: Multi-Modules - Refactor Item-Validation #40

Open
ansibleguy opened this issue Dec 20, 2023 · 0 comments
Open

Feature: Multi-Modules - Refactor Item-Validation #40

ansibleguy opened this issue Dec 20, 2023 · 0 comments
Labels
enhancement New feature or request prio-low Low Priority

Comments

@ansibleguy
Copy link
Owner

Link to API

Description

I came across some module-code that implements Ansible parameter-validation for items inside a dict

Example:

            extended_query=dict(type='dict', options=dict(
                attributes=dict(type='list', elements='str', required=True),
                where=dict(
                    type='list',
                    elements='dict',
                    options={
                        'attribute': dict(type='str'),
                        'is': dict(type='str', choices=["==", "!=", ">", "<", "in", "eq", "not", "more", "less"]),
                        'value': dict(type='raw'),
                        'or': dict(type='list', elements='dict', options={
                            'attribute': dict(type='str', required=True),
                            'is': dict(type='str', choices=["==", "!=", ">", "<", "in", "eq", "not", "more", "less"], required=True),
                            'value': dict(type='raw', required=True),
                        }),
                    },
                    required_together=[('attribute', 'is', 'value')],
                    mutually_exclusive=[('attribute', 'or')],
                    required_one_of=[('attribute', 'or')],
                ),
            )),

This could make the validation in multi modules simpler and therefor cleaner.

@ansibleguy ansibleguy added enhancement New feature or request triage and removed triage labels Dec 20, 2023
@ansibleguy ansibleguy added the prio-low Low Priority label Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio-low Low Priority
Projects
None yet
Development

No branches or pull requests

1 participant