You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that, when sending an incorrect request (e.g. an object with a string where a number is expected), MediaType.cast and MediaType.unmarshal will raise InvalidMediaTypeValue in all cases, which is actually misleading: the media type is correct (e.g. application/json), but the validation raises an incorrect error. Was that on purpose?
The text was updated successfully, but these errors were encountered:
Hi @berislavlopac
media type itself is correct but passed value (schema) is incorrect, isn't it? I called the general exceptions for media type value errors as InvalidMediaTypeValue but if you think it's misleading I'm open for naming suggestions.
I think that wrapping the CastError inside a media type exception is confusing, as the same problem can happen when a validation is triggered from other places, not just from MediaType. In any case, it seems to me that the exact chain of errors gets lost in this pattern; perhaps it might help to raise using from to preserve the chain?
I can't use from because it's not supported in Python 2 that's why CastError is wrapped inside a media type exception. The plan is to move cast outside of schema models and get rid of media type and parameters exception wrapping.
I have noticed that, when sending an incorrect request (e.g. an object with a string where a number is expected),
MediaType.cast
andMediaType.unmarshal
will raiseInvalidMediaTypeValue
in all cases, which is actually misleading: the media type is correct (e.g.application/json
), but the validation raises an incorrect error. Was that on purpose?The text was updated successfully, but these errors were encountered: