-
Notifications
You must be signed in to change notification settings - Fork 48
v0.5 #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v0.5 #129
Conversation
|
Hey any plan to release an RC or Beta for this? |
|
Yeah, will release an RC today |
|
Would love if the RC can include #127 as well. Thanks a lot! |
|
I'd also love to test the RC version |
|
Also keen :) |
|
Sorry for the delay guys, just got busy. I will try to release a RC today for sure. |
|
So far no RC? I have a client project blocked by this atm :(, gotta rollback everything to older versions |
|
Hey Guys, I just released Here are the docs - https://rc.honohub.dev |
|
Legend thank you! Was |
|
Hey mate, hope you had a nice weekend :) Same error here, only the Thanks for the quick answer and for your work! |
|
@MathurAditya724 I noticed you do repetitive manual labor for RC publishing in PR, here you go I automate it for you and all the contributors: |
|
I still get all 3 errors when trying to run with wrangler on RC3. It also does not like the way I've defined my ErrorResponse but that might be a zod v4 registry thing, or maybe even just a me-issue. Basically I have a shared error response schema for easy reuse, but using it causes the first hono route schema to not generate correctly... I know that's confusing, I'm happy to upload the simplest reproduction I can make if you are interested... |
|
Thank you for this awesome project! I am trying to use Sorry, maybe standard-community/standard-openapi#2 is needed first to get zod v4 dependencies to work. $ npm i hono-openapi@0.5.0-rc.3
npm error While resolving: undefined@undefined
npm error Found: zod@4.0.14
npm error node_modules/zod
npm error zod@"^4.0.14" from the root project
npm error peerOptional zod@"^3.25.0 || ^4.0.0" from @standard-community/standard-json@0.3.0-rc.3
npm error node_modules/@standard-community/standard-json
npm error peer @standard-community/standard-json@"^0.3.0-rc.3" from hono-openapi@0.5.0-rc.3
npm error node_modules/hono-openapi
npm error hono-openapi@"0.5.0-rc.3" from the root project
npm error peer @standard-community/standard-json@"^0.3.0-rc.1" from @standard-community/standard-openapi@0.2.0-rc.1
npm error node_modules/@standard-community/standard-openapi
npm error peer @standard-community/standard-openapi@"^0.2.0-rc.1" from hono-openapi@0.5.0-rc.3
npm error node_modules/hono-openapi
npm error hono-openapi@"0.5.0-rc.3" from the root project
npm error 2 more (@standard-community/standard-openapi, zod-openapi)
npm error
npm error Could not resolve dependency:
npm error peerOptional zod@"^3.23.8" from hono-openapi@0.5.0-rc.3
npm error node_modules/hono-openapi
npm error hono-openapi@"0.5.0-rc.3" from the root project |
|
Just released |
Thanks for the initiative, really appreciate it. Just wanted to know, will it be better if we use pkg.new CI thing? |
Here's a reproduction for the:
|
I am not seeing this error, maybe it was happening previously because of cache. Can you try to do a clean install? |
|
I will be merging this in an hour, so if anyone can test it out before that or facing some issues let me know. I have already released RC 4 for testing. This will be getting released as v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a major v0.5 release that simplifies the package structure by removing NX, adds support for Standard Schema V1 and Zod v4, introduces response middleware for better type inference, and includes various optimizations.
Key changes include:
- Complete architectural refactor from NX-based monorepo to simplified single package
- Migration to Standard Schema V1 compliance for universal validation library support
- New response middleware system for improved type safety
Reviewed Changes
Copilot reviewed 72 out of 75 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/handler.ts | Core OpenAPI spec generation logic with caching and improved path filtering |
| src/middlewares.ts | New validator and response description middleware with Standard Schema support |
| src/types.ts | Type definitions for the new architecture including response handlers |
| src/utils.ts | Utility functions for path conversion, operation ID generation, and schema merging |
| package.json | Updated to single package configuration with Standard Schema dependencies |
Comments suppressed due to low confidence (2)
src/handler.ts:1
- The
@ts-expect-errorcomment indicates a type mismatch. Consider properly typing the mergeParameters function or adding appropriate type assertions to resolve this issue.
import type { Context, Env, Hono } from "hono";
src/handler.ts:1
- The
@ts-expect-errorcomment indicates a type issue with the paths object assignment. Consider properly typing the paths object structure or using appropriate type assertions.
import type { Context, Env, Hono } from "hono";
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // @ts-expect-error | ||
| paths[path][method] = mergeSpecs( | ||
| route, | ||
| ...pathContext, | ||
| paths[path]?.[method], | ||
| specs, | ||
| ); |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @ts-expect-error comment indicates a type issue that should be resolved. Consider properly typing the paths object or using a more specific type assertion to improve code maintainability and type safety.
| // @ts-expect-error | |
| paths[path][method] = mergeSpecs( | |
| route, | |
| ...pathContext, | |
| paths[path]?.[method], | |
| specs, | |
| ); | |
| (paths[path] as OpenAPIV3_1.PathItemObject)[method] = mergeSpecs( | |
| route, | |
| ...pathContext, | |
| paths[path]?.[method], | |
| specs, | |
| ); |
| */ | ||
| export function validator< | ||
| Schema extends StandardSchemaV1, | ||
| Target extends keyof ValidationTargets, | ||
| E extends Env, | ||
| P extends string, | ||
| In = StandardSchemaV1.InferInput<Schema>, | ||
| Out = StandardSchemaV1.InferOutput<Schema>, | ||
| I extends Input = { | ||
| in: HasUndefined<In> extends true | ||
| ? { | ||
| [K in Target]?: In extends ValidationTargets[K] | ||
| ? In | ||
| : { [K2 in keyof In]?: ValidationTargets[K][K2] }; | ||
| } | ||
| : { | ||
| [K in Target]: In extends ValidationTargets[K] | ||
| ? In | ||
| : { [K2 in keyof In]: ValidationTargets[K][K2] }; | ||
| }; | ||
| out: { [K in Target]: Out }; | ||
| }, | ||
| V extends I = I, | ||
| >( | ||
| target: Target, | ||
| schema: Schema, | ||
| hook?: Hook<StandardSchemaV1.InferOutput<Schema>, E, P, Target>, | ||
| options?: ResolverReturnType["options"], | ||
| ): MiddlewareHandler<E, P, V> { | ||
| const middleware = sValidator(target, schema, hook); | ||
|
|
||
| // @ts-expect-error not typed well | ||
| return Object.assign(middleware, { | ||
| [uniqueSymbol]: { | ||
| target, | ||
| ...resolver(schema, options), | ||
| options, | ||
| }, | ||
| }); | ||
| } | ||
|
|
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @ts-expect-error comment suggests incomplete typing. Consider properly typing the middleware return value or the Object.assign operation to improve type safety.
| */ | |
| export function validator< | |
| Schema extends StandardSchemaV1, | |
| Target extends keyof ValidationTargets, | |
| E extends Env, | |
| P extends string, | |
| In = StandardSchemaV1.InferInput<Schema>, | |
| Out = StandardSchemaV1.InferOutput<Schema>, | |
| I extends Input = { | |
| in: HasUndefined<In> extends true | |
| ? { | |
| [K in Target]?: In extends ValidationTargets[K] | |
| ? In | |
| : { [K2 in keyof In]?: ValidationTargets[K][K2] }; | |
| } | |
| : { | |
| [K in Target]: In extends ValidationTargets[K] | |
| ? In | |
| : { [K2 in keyof In]: ValidationTargets[K][K2] }; | |
| }; | |
| out: { [K in Target]: Out }; | |
| }, | |
| V extends I = I, | |
| >( | |
| target: Target, | |
| schema: Schema, | |
| hook?: Hook<StandardSchemaV1.InferOutput<Schema>, E, P, Target>, | |
| options?: ResolverReturnType["options"], | |
| ): MiddlewareHandler<E, P, V> { | |
| const middleware = sValidator(target, schema, hook); | |
| // @ts-expect-error not typed well | |
| return Object.assign(middleware, { | |
| [uniqueSymbol]: { | |
| target, | |
| ...resolver(schema, options), | |
| options, | |
| }, | |
| }); | |
| } | |
| */ | |
| // Augmented middleware type with uniqueSymbol property | |
| type AugmentedMiddlewareHandler< | |
| E extends Env, | |
| P extends string, | |
| V extends Input, | |
| Target extends keyof ValidationTargets, | |
| Schema extends StandardSchemaV1 | |
| > = MiddlewareHandler<E, P, V> & { | |
| [uniqueSymbol]: { | |
| target: Target; | |
| vendor: Schema["~standard"]["vendor"]; | |
| validate: Schema["~standard"]["validate"]; | |
| toJSONSchema: () => ReturnType<typeof toJsonSchema>; | |
| toOpenAPISchema: () => ReturnType<typeof toOpenAPISchema>; | |
| options?: ResolverReturnType["options"]; | |
| }; | |
| }; | |
| export function validator< | |
| Schema extends StandardSchemaV1, | |
| Target extends keyof ValidationTargets, | |
| E extends Env, | |
| P extends string, | |
| In = StandardSchemaV1.InferInput<Schema>, | |
| Out = StandardSchemaV1.InferOutput<Schema>, | |
| I extends Input = { | |
| in: HasUndefined<In> extends true | |
| ? { | |
| [K in Target]?: In extends ValidationTargets[K] | |
| ? In | |
| : { [K2 in keyof In]?: ValidationTargets[K][K2] }; | |
| } | |
| : { | |
| [K in Target]: In extends ValidationTargets[K] | |
| ? In | |
| : { [K2 in keyof In]: ValidationTargets[K][K2] }; | |
| }; | |
| out: { [K in Target]: Out }; | |
| }, | |
| V extends I = I, | |
| >( | |
| target: Target, | |
| schema: Schema, | |
| hook?: Hook<StandardSchemaV1.InferOutput<Schema>, E, P, Target>, | |
| options?: ResolverReturnType["options"], | |
| ): AugmentedMiddlewareHandler<E, P, V, Target, Schema> { | |
| const middleware = sValidator(target, schema, hook); | |
| return Object.assign(middleware, { | |
| [uniqueSymbol]: { | |
| target, | |
| ...resolver(schema, options), | |
| options, | |
| }, | |
| }) as AugmentedMiddlewareHandler<E, P, V, Target, Schema>; | |
| } | |
| // @ts-expect-error | ||
| options: { | ||
| ...DEFAULT_OPTIONS, | ||
| ...options, | ||
| }, |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @ts-expect-error comment suggests a type issue with the options object. Consider properly typing the DEFAULT_OPTIONS or the SpecContext options property.
| // @ts-expect-error | |
| options: { | |
| ...DEFAULT_OPTIONS, | |
| ...options, | |
| }, | |
| options: { | |
| ...DEFAULT_OPTIONS, | |
| ...options, | |
| } as Partial<GenerateSpecOptions>, |
| // @ts-expect-error | ||
| schema: value, | ||
| required: schema.required?.includes(key), |
Copilot
AI
Sep 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @ts-expect-error comment suggests a type mismatch when assigning the schema value. Consider properly typing the parameter definition or using appropriate type assertions.
| // @ts-expect-error | |
| schema: value, | |
| required: schema.required?.includes(key), | |
| schema: value as OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject, | |
| required: schema.required?.includes(key), |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>


Resolves #130, Resolves #125, Resolves #122, Resolves #116, Resolves #115, Resolves #114, Resolves #99, Resolves #97, Resolves #86, Resolves #82, Resolves #81, Resolves #78, Resolves #76, Resolves #67, Resolves #65, Resolves #61