Update dependency chanfana to v3#17
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
January 23, 2026 20:46
c719597 to
64a920b
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
2 times, most recently
from
February 17, 2026 17:55
20ed3e6 to
6ac622b
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
2 times, most recently
from
February 26, 2026 23:04
3e11e79 to
c4b3e56
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
March 5, 2026 16:44
c4b3e56 to
39255c3
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
March 18, 2026 10:16
39255c3 to
57c1290
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
April 1, 2026 15:56
57c1290 to
cfc8d89
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
May 12, 2026 14:04
cfc8d89 to
8ddaa99
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
June 2, 2026 00:04
8ddaa99 to
95299ce
Compare
renovate
Bot
force-pushed
the
renovate/chanfana-3.x
branch
from
July 12, 2026 14:56
95299ce to
5f03fe6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^2.0.2→^3.0.0Release Notes
cloudflare/chanfana (chanfana)
v3.3.0Compare Source
Minor Changes
#316
d30cc36Thanks @G4brym! - Add customizable pagination and ordering parameter names to ListEndpoint viapageFieldName,perPageFieldName,orderByFieldName, andorderByDirectionFieldNameclass properties.Breaking change for subclasses overriding
optionFields:optionFieldsis now a computed getter derived from the four*FieldNameproperties. Subclasses that previously overrodeoptionFieldsdirectly should instead override the individual field name properties.#317
39c89d2Thanks @G4brym! - AddvalidateResponserouter option to validate and sanitize response bodies against their Zod schemas at runtime.When enabled, responses are parsed through
z.object().parseAsync(), which strips unknown fields and validates required fields/types. This prevents accidental data leaks (e.g., internal fields likepasswordHashreaching the client) and catches handler bugs where the response doesn't match the declared schema.Behavior:
200response schemaResponseobjects withapplication/jsoncontent are cloned, validated, and reconstructed with corrected headers500 Internal Server Error(code7013) and log the full error viaconsole.errorNew exports:
ResponseValidationException— thrown when a handler's response doesn't match its declared schema (status 500, code 7013,isVisible: false)#315
47d304aThanks @G4brym! - AddSerializerContextparameter to auto endpoint serializer function, providing access to filters and options for context-aware serialization.The serializer signature changes from
(obj: object) => objectto(obj: object, context?: SerializerContext) => object. TheSerializerContexttype contains:filters—Array<FilterCondition>: the active filter conditions for the current requestoptions— pagination and ordering options (page,per_page,order_by,order_by_direction)Context passed per endpoint type:
ListEndpoint/ReadEndpoint{ filters, options }UpdateEndpoint/DeleteEndpoint{ filters }CreateEndpoint{ filters: [] }New exports:
SerializerContext— type for the serializer's second parameterPatch Changes
#335
028c256Thanks @andrewheberle! - Fix: Error from Zod transform is returning 500 instead of 400#328
662ff72Thanks @G4brym! - Include CHANGELOG.md in the npm package so AI agents and tools can read the project's change history. Also add a changelog page to the documentation site.v3.2.1Compare Source
Patch Changes
#325
c182e59Thanks @G4brym! - ExportOrderByDirectiontype alias ("asc" | "desc") so consumers can import it directly instead of inlining literal unions#325
c182e59Thanks @G4brym! - AddpassthroughErrorsoption to bypass chanfana's error handling and let errors propagate raw to the framework's error handlerv3.2.0Compare Source
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 columnsAdd
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.v3.1.0Compare Source
Minor Changes
#297
59df713Thanks @G4brym! - ### Breaking ChangesStr(),Num(),Int(),Bool(),DateTime(),DateOnly(),Email(),Uuid(),Hostname(),Ipv4(),Ipv6(),Ip(),Regex(),Enumeration(), andconvertParams()have been removed. Use native Zod schemas directly (e.g.,Str()→z.string(),Email()→z.email(),DateTime()→z.iso.datetime())legacyTypeIntoZod,Arr(), andObj()are no longer exported.contentJson()now requires a Zod schema instead of plain objectsconstraintsMessagesproperty to map constraint violations to user-friendly errorsprimaryKeysare used in WHERE clauses for securityper_pagecapped at 100 — Configurable viamaxPerPageclass propertyraiseUnknownParametersnow enforced — Was previously accepted but not functional; now activeNew Features
UnauthorizedException(401),ForbiddenException(403),MethodNotAllowedException(405),ConflictException(409),UnprocessableEntityException(422),TooManyRequestsException(429),InternalServerErrorException(500),BadGatewayException(502),ServiceUnavailableException(503),GatewayTimeoutException(504)d1/base.tsmodule withvalidateSqlIdentifier(),validateTableName(),validateColumnName(),buildSafeFilters(),buildPrimaryKeyFilters(),getD1Binding(),handleDbError(), and query clause builders. All exported fromchanfanaRetry-AfterHTTP header — Automatically set on responses forTooManyRequestsExceptionandServiceUnavailableExceptionwhenretryAfteris providedgetUnvalidatedData()— New method onOpenAPIRouteto access raw request data before Zod applies defaults/transformations, useful for partial updates with Zod 4basePath()auto-detection — Chanfana now detects Hono'sbasePath()automatically; passing bothbasePath()andbaseoption now throws a descriptive errorapp.onErrorasHTTPExceptioninstances instead of being caught internallyBug Fixes
buildPrimaryKeyFilters()throws when no primary key filters matchhandleDbError()clones constraint exceptions instead of re-throwing the same objecthandleDbError— Consistent error handling andconstraintsMessagessupport%and_in search values no longer cause unintended pattern matching0,false, and""are now correctly applied as defaultsBigInt()directly instead ofparseInt()to avoid precision loss.jsonin URLimport typeto value import for properinstanceofchecksInputValidationExceptionto documented 400 responseshandleValidationError()andD1EndpointConfiginterface removedImprovements
D1 parallel queries — List endpoint runs data and count queries concurrently with
Promise.all()Configurable
maxPerPage—D1ListEndpoint.maxPerPageis a class property that can be overriddenNormalized ORDER BY direction — Returns lowercase
"asc"/"desc"for consistencysanitizeOperationId()— Ensures operationIds are valid by removing special charactersRouter constructor validation —
OpenAPIHandlerthrows if router argument is missingComprehensive JSDoc — Added to all exception classes, D1 endpoint methods, and OpenAPI handler methods
Error responses include
result: {}— Consistent shape with success responses#306
9470a04Thanks @G4brym! - ### HonobasePath()supportChanfana now properly handles Hono's
basePath()for route matching, OpenAPI schema generation, and documentation URLs.New features:
basePath(): When a Hono instance is created withbasePath()(e.g.,new Hono().basePath("/api")), Chanfana automatically detects the base path and uses it for schema generation and doc routes. No need to passbaseseparately.baseoption appliesbasePath()for Hono: UsingfromHono(new Hono(), { base: "/api" })now calls Hono'sbasePath()internally, so routes actually match at the prefixed path — not just in the OpenAPI schema.optionsexposed via proxy: The router proxy now exposes theoptionsproperty for runtime access to the configuredRouterOptions.New validations:
basePath()andbasethrows an error: Using both Hono'sbasePath()and chanfana'sbaseoption (e.g.,fromHono(new Hono().basePath("/api"), { base: "/v1" })) now throws a descriptive error with migration guidance.baseoption must start with/and must not end with/. Invalid formats now throw a clear error.Bug fixes:
No changes to itty-router behavior.
b671b4dThanks @G4brym! - ### Hono error handler integrationChanfana errors (validation errors, API exceptions) now flow through Hono's
onErrorhandler automatically when usingfromHono(). Previously, these errors were caught internally and formatted into responses before Hono could see them.How it works:
The Hono adapter converts chanfana errors into Hono
HTTPExceptioninstances with the same JSON response body chanfana normally produces. This means:onErrorhandler receives the error for logging, monitoring, or custom formattingonErroris configured, Hono's default handler callsHTTPException.getResponse()and returns the formatted response as usual — no behavior change for users withoutonErrorUsage:
No changes to itty-router behavior.
Implementation details:
wrapHandler()hook toOpenAPIHandlerbase class for adapter-specific handler wrappingHonoOpenAPIHandleroverrideswrapHandler()to convert errors toHTTPExceptionvia dynamic import (no runtime cost for itty-router users)formatChanfanaError()utility for consistent error formatting across code pathsPatch Changes
1b889cfThanks @G4brym! - Include source code, AI coding skills, and documentation in the npm package so AI tools can browse implementation details after installing chanfana. Addedllms.txtas a lightweight entry point following the llmstxt.org convention.v3.0.0Compare Source
Major release v3.0.0
Migration guide here: https://chanfana.pages.dev/migration-to-chanfana-3#migration-steps
What's Changed
getUnvalidatedData()MethodFull Changelog: cloudflare/chanfana@v2.8.3...v3.0.0
v2.8.3Compare Source
What's Changed
Full Changelog: cloudflare/chanfana@v2.8.2...v2.8.3
v2.8.2Compare Source
What's Changed
Full Changelog: cloudflare/chanfana@v2.8.1...v2.8.2
v2.8.1Compare Source
What's Changed
npx chanfana [-o <path-to-output-schema.json>] [wrangler-options]Full Changelog: cloudflare/chanfana@v2.8.0...v2.8.1
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.