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

anyof does not respect nullable: True #595

Closed
socketpair opened this issue Jan 14, 2023 · 2 comments
Closed

anyof does not respect nullable: True #595

socketpair opened this issue Jan 14, 2023 · 2 comments

Comments

@socketpair
Copy link

socketpair commented Jan 14, 2023

validator = Validator({
    'last_version': {
        'type': 'dict',
        'required': True,
        'nullable': True,  # <----- !!!
        'anyof_schema': [
            {
                'qwe': {
                    'type': 'integer',
                    'required': True,
                    'nullable': False,
                },
            },
            {
                'asd': {
                    'type': 'integer',
                    'required': True,
                    'nullable': False,
                },
            },
        ],

    },
})
if not validator.validate({'last_version': None}):
    raise ValueError(f'Data validation error: {validator.errors}.')

This example shows:

Data validation error: {'last_version': ['no definitions validate', {'anyof definition 0': ['null value not allowed'], 'anyof definition 1': ['null value not allowed']}]}

I think, this schema MUST allow None value.

@dkbarn
Copy link

dkbarn commented Feb 26, 2023

Duplicate of #582

@funkyfuture
Copy link
Member

and it was solved with 35d9f7b.

@socketpair socketpair changed the title anyof does not respect nullabel: True anyof does not respect nullable: True Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants