Custom JSON Schema & integrated OpenAPI (#172, #173)
This was quite a biggie. Since bknd fully relies on JSON Schema, the available libraries to work with it weren't all that pleasant to work with. Either they only include a validator (@cfworker/json-schema
, json-schema-library
) or are tied to another use-case (@sinclair/typebox
, zod
) adding JSON Schema as an after thought.
But implementing native MCP support and visual workflows that are even more reliant on JSON Schema, this wasn't acceptable anymore. That's why I went ahead creating my own implementation: jsonv-ts
It has a zod-inspired API but strictly targeting JSON Schema as the main priority. It also includes a validator that is currently passing 74% of the ~2000 tests provided by the official test suite – but since it produces clean JSON Schema, any validator can be used. Additional integrated features are:
- Automatic and customizable coercion (required for
SearchParams
) - Property-level customizable, additional validation
- Hono middleware to validate targets such as query, json, form, parameters, etc.
- Automatic OpenAPI generation for routes that use the middleware
Not everything JSON Schema related has been moved over yet, only all route validations and one of the most complex schema which is the recursive repository query. So now every instance has full OpenAPI specs with the current user automatically authenticated:
CleanShot.2025-05-27.at.16.45.43.mp4
API: Custom Storage Support (#174)
You can now instantiate an Api
instance with a custom storage
option to store the auth state in whatever storage you'd like (localStorage
compatible API):
export type ApiOptions = {
storage?: {
getItem: (key: string) => string | undefined | null | Promise<string | undefined | null>;
setItem: (key: string, value: string) => void | Promise<void>;
removeItem: (key: string) => void | Promise<void>;
};
// ...
}
This option may also be passed via ClientProvider:
<ClientProvider storage={window.localStorage} />
Helpful for using a custom client side storage such as local storage or browser storage (when used in a chrome extension).
Other Changes
- admin: data/auth route-driven settings and collapsible components by @dswbx in #168
- remove batching workaround for Turso AWS endpoints by @dswbx in #171
Full Changelog: v0.12.0...v0.13.0