mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-24 03:00:12 +00:00
Get rid of unused exceptions
This commit is contained in:
parent
9b2a4d8147
commit
bbeb43c300
3 changed files with 1 additions and 32 deletions
|
@ -6,19 +6,6 @@ class OpenAPIError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class OpenAPIMediaTypeError(OpenAPIError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@attr.s(hash=True)
|
|
||||||
class InvalidContentType(OpenAPIMediaTypeError):
|
|
||||||
mimetype = attr.ib()
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "Content for following mimetype not found: {0}".format(
|
|
||||||
self.mimetype)
|
|
||||||
|
|
||||||
|
|
||||||
class OpenAPIParameterError(OpenAPIError):
|
class OpenAPIParameterError(OpenAPIError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -67,7 +54,3 @@ class MissingResponseContent(OpenAPIResponseError):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Missing response content"
|
return "Missing response content"
|
||||||
|
|
||||||
|
|
||||||
class OpenAPISchemaError(OpenAPIError):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -1,19 +1,8 @@
|
||||||
"""OpenAPI core validation request shortcuts module"""
|
"""OpenAPI core validation request shortcuts module"""
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from openapi_core.exceptions import (
|
|
||||||
OpenAPIMediaTypeError, OpenAPIParameterError, OpenAPIRequestBodyError,
|
|
||||||
OpenAPISchemaError,
|
|
||||||
)
|
|
||||||
from openapi_core.validation.request.validators import RequestValidator
|
from openapi_core.validation.request.validators import RequestValidator
|
||||||
|
|
||||||
ERRORS_BODY = (
|
|
||||||
OpenAPIRequestBodyError, OpenAPIMediaTypeError, OpenAPISchemaError,
|
|
||||||
)
|
|
||||||
ERRORS_PARAMETERS = (
|
|
||||||
OpenAPIParameterError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_request(validator, request, failsafe=None):
|
def validate_request(validator, request, failsafe=None):
|
||||||
if failsafe is None:
|
if failsafe is None:
|
||||||
|
|
|
@ -4,7 +4,6 @@ import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from openapi_core.extensions.models.models import Model
|
from openapi_core.extensions.models.models import Model
|
||||||
from openapi_core.exceptions import OpenAPISchemaError
|
|
||||||
from openapi_core.spec.paths import SpecPath
|
from openapi_core.spec.paths import SpecPath
|
||||||
from openapi_core.unmarshalling.schemas.factories import (
|
from openapi_core.unmarshalling.schemas.factories import (
|
||||||
SchemaUnmarshallersFactory,
|
SchemaUnmarshallersFactory,
|
||||||
|
@ -55,8 +54,6 @@ class TestSchemaValidate(object):
|
||||||
|
|
||||||
assert result is None
|
assert result is None
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
reason="validation does not care about custom formats atm")
|
|
||||||
def test_string_format_custom_missing(self, validator_factory):
|
def test_string_format_custom_missing(self, validator_factory):
|
||||||
custom_format = 'custom'
|
custom_format = 'custom'
|
||||||
spec = {
|
spec = {
|
||||||
|
@ -66,7 +63,7 @@ class TestSchemaValidate(object):
|
||||||
schema = SpecPath.from_spec(spec)
|
schema = SpecPath.from_spec(spec)
|
||||||
value = 'x'
|
value = 'x'
|
||||||
|
|
||||||
with pytest.raises(OpenAPISchemaError):
|
with pytest.raises(FormatterNotFoundError):
|
||||||
validator_factory(schema).validate(value)
|
validator_factory(schema).validate(value)
|
||||||
|
|
||||||
@pytest.mark.parametrize('value', [False, True])
|
@pytest.mark.parametrize('value', [False, True])
|
||||||
|
|
Loading…
Reference in a new issue