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

[Bug]: validation shouldn't fail when values contain array with null #822

Open
wosc opened this issue Mar 28, 2024 · 1 comment
Open

[Bug]: validation shouldn't fail when values contain array with null #822

wosc opened this issue Mar 28, 2024 · 1 comment
Labels
kind/bug Indicates an issue

Comments

@wosc
Copy link

wosc commented Mar 28, 2024

Actual Behavior

This issue is somewhat similar to #551, only with a list in the input ({'names': [None]} instead of {'name': None}), and this time RecursionExceeded is raised instead of UnmarshallerError.

Expected Behavior

Should not raise an exception.

Steps to Reproduce

Here's a test case, modelled after the one in #555 (that fixed #551). This also shows that somehow the issue is limited to the 3.0 code path, because it works just fine with 3.1

    @pytest.mark.parametrize('factory', [
        oas30_write_schema_unmarshallers_factory,
        oas31_schema_unmarshallers_factory])
    def test_object_with_array_of_null(self, factory):
        schema = {}
        spec = SchemaPath.from_dict(schema)
        unmarshaller = factory.create(spec)
        result = unmarshaller.unmarshal({'foo': [None]})
        assert result == {'foo': [None]}

OpenAPI Core Version

0.19.0

OpenAPI Core Integration

pyramid-openapi3

Affected Area(s)

unmarshalling

References

No response

Anything else we need to know?

No response

Would you like to implement a fix?

No

@wosc wosc added the kind/bug Indicates an issue label Mar 28, 2024
@hannu-oura
Copy link

I was also able to replicate this issue with altering the test case here:

https://github.com/python-openapi/openapi-core/blob/master/tests/integration/unmarshalling/test_unmarshallers.py#L582

By adding another case ("array", [None])

Also ends up in RecursionError: maximum recursion depth exceeded in comparison

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Indicates an issue
Projects
None yet
Development

No branches or pull requests

2 participants