v3.2.0
Minor Changes
-
#314
2408999Thanks @G4brym! - Addtagssupport to auto endpoint_metafor OpenAPI tag grouping -
#323
d9b7297Thanks @G4brym! - AddhandleErrorhook,defaultOrderByDirection, fix validation error format and D1 update with extra columns-
Add
handleError(error)protected method onOpenAPIRouteto transform errors before chanfana formats them. Enables custom error wrapping (e.g., bypassing chanfana's formatter to use Hono'sonError). -
Add
defaultOrderByDirectionproperty toListEndpoint(defaults to"asc"). Allows configuring the default sort direction whenorderByFieldsis used. -
Breaking: Validation errors from
validateRequest()now returnInputValidationExceptionformat instead of raw Zod issues. This makes the actual response match the OpenAPI schema that chanfana documents. If you parse validation error responses, update your code to use the new shape:Before:
{ "errors": [ { "code": "invalid_type", "expected": "string", "received": "number", "message": "Invalid input: expected string, received number", "path": ["body", "name"] } ], "success": false, "result": {} }After:
{ "errors": [ { "code": 7001, "message": "Invalid input: expected string, received number", "path": ["body", "name"] } ], "success": false, "result": {} }Key differences:
codeis now the numeric7001(was a string like"invalid_type"), and Zod-specific fields (expected,received) are no longer included. -
D1UpdateEndpoint.update()now automatically filtersupdatedDatato only include columns defined in the Zod schema. Previously, DB tables with extra columns not in the schema would causevalidateColumnName()to throw.
-