express-zod-api
Advanced tools
Changelog
v20.19.0
level
made optional as well as the logger
option for createConfig()
;debug
level by default, or warn
when NODE_ENV=production
.BuiltinLogger
when its color
option is not set in config:
.child()
method is 50x times faster now by only detecting the color support once;Changelog
v20.18.0
ensureHttpError()
method that converts any Error
into HttpError
:
InputValidationError
to BadRequest
(status code 400
) and others to InternalServerError
(500
).getStatusCodeFromError()
— use the ensureHttpError().statusCode
instead.defaultResultHandler
, defaultEndpointsFactory
and Last Resort Handler only;NODE_ENV
is set to production
(displayed on startup);statusCode
used;5XX
, or treated that way by ensureHttpError()
;createHttpError()
and using its expose
option;import createHttpError from "http-errors";
// NODE_ENV=production
// Throwing HttpError from Endpoint or Middleware that is using defaultResultHandler or defaultEndpointsFactory:
createHttpError(401, "Token expired"); // —> "Token expired"
createHttpError(401, "Token expired", { expose: false }); // —> "Unauthorized"
createHttpError(500, "Something is broken"); // —> "Internal Server Error"
createHttpError(501, "We didn't make it yet", { expose: true }); // —> "We didn't make it yet"
Changelog
v20.17.0
cause
property to DocumentationError
;>= 500
) and in full (not just the message
).Changelog
v20.16.0
originalError
property on both InputValidationError
and OutputValidationError
:
cause
property instead; const error = new InputValidationError(new z.ZodError([]));
- logger.error(error.originalError.message);
+ logger.error(error.cause.message);
Changelog
v20.15.3
- type GetV1UserRetrieveInput = {} & {
+ type GetV1UserRetrieveInput = {
/** a numeric string containing the id of the user */
id: string;
};
Changelog
v20.15.2
splitResponse
option is disabled on Integration
primitive response types could have been duplicated.- type GetV1AvatarSendResponse = string | string;
+ type GetV1AvatarSendResponse = string;
Changelog
v20.15.1
serializer
property on Documentation
and Integration
constructor argument:
z.lazy()
;Changelog
v20.15.0
z.map()
, z.set()
, z.bigint()
;z.never()
, z.void()
, z.promise()
, z.symbol()
, z.nan()
;z.date()
;ez.dateOut()
;ez.dateIn()
, ez.upload()
, ez.raw()
;