redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

How to validate transformed errors with the schema

Open berdyshev opened this issue 6 months ago • 1 comments

What should be the errorResponseSchema when the transformErrorResponse is used?

Here is the example of my configuration and there is a type error for the errorResponseSchema however it works in the actual app (sorry, I didn't integrate the actual API into the demo app).

If I will replace it with errorResponseSchema, the TS won't complain but the schema validation will fail with the missing data property.

berdyshev avatar May 15 '25 17:05 berdyshev

errorResponseSchema is for after transformation, if any. For validation before transformation, use rawErrorResponseSchema.

Annoyingly our docblocks plugin seems to be acting up, so the docs are missing the description for that property.

EskiMojo14 avatar May 15 '25 18:05 EskiMojo14