Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Test failure with openapi-schema-validator 0.4.2 #189

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

Closed
musicinmybrain opened this issue Jan 31, 2023 · 1 comment · Fixed by #190
Closed

Test failure with openapi-schema-validator 0.4.2 #189

musicinmybrain opened this issue Jan 31, 2023 · 1 comment · Fixed by #190

Comments

@musicinmybrain
Copy link
Contributor

==================================================== FAILURES ====================================================
___________________ TestSpecValidatorIterErrors.test_parameter_custom_format_checker_not_found ___________________

self = <test_exceptions.TestSpecValidatorIterErrors object at 0x7f950b421d90>
validator_v30 = <Proxy at 0x7f950b6cf540 wrapping <openapi_spec_validator.validation.validators.SpecValidator object at 0x7f950bbdd190...bHandler object at 0x7f950bae7910>, 'file': <jsonschema_spec.handlers.urllib.UrllibHandler object at 0x7f950bae7890>})>

    def test_parameter_custom_format_checker_not_found(self, validator_v30):
        spec = {
            "openapi": "3.0.0",
            "info": {
                "title": "Test Api",
                "version": "0.0.1",
            },  
            "paths": {
                "/test/": {
                    "get": {
                        "responses": {
                            "default": {
                                "description": "default response",
                            },  
                        },  
                        "parameters": [
                            {
                                "name": "param1",
                                "in": "query",
                                "schema": {
                                    "type": "string",
                                    "format": "custom",
                                    "default": "customvalue",
                                },
                            },
                        ],
                    },
                },
            },
        }

        errors = validator_v30.iter_errors(spec)

        errors_list = list(errors)
>       assert len(errors_list) == 1
E       assert 0 == 1
E        +  where 0 = len([])

errors     = <generator object SpecValidator.iter_errors at 0x7f950b52b040>
errors_list = []
self       = <test_exceptions.TestSpecValidatorIterErrors object at 0x7f950b421d90>
spec       = {'info': {'title': 'Test Api', 'version': '0.0.1'}, 'openapi': '3.0.0', 'paths': {'/test/': {'get': {'parameters': [{'in': 'query', 'name': 'param1', 'schema': {...}}], 'responses': {'default': {'description': 'default response'}}}}}}
validator_v30 = <Proxy at 0x7f950b6cf540 wrapping <openapi_spec_validator.validation.validators.SpecValidator object at 0x7f950bbdd190...bHandler object at 0x7f950bae7910>, 'file': <jsonschema_spec.handlers.urllib.UrllibHandler object at 0x7f950bae7890>})>

tests/integration/validation/test_exceptions.py:457: AssertionError
@p1c2u
Copy link
Collaborator

p1c2u commented Feb 1, 2023

Hi @musicinmybrain

Thank you for reporting the problem. The test was reproducing the issue that FormatError was raised when there was no format checker for such format. Test test should be fixed now.

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

Successfully merging a pull request may close this issue.

2 participants