Skip to content
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

feat(zod-openapi): Make it possible to do method chaining even for do… #260

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

Karibash
Copy link
Contributor

…c methods

I implemented it so that doc methods can also do method chaining.
I am not so sure if I implemented it properly because the type is too complicated.

Copy link

changeset-bot bot commented Nov 16, 2023

🦋 Changeset detected

Latest commit: d4f9480

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/zod-openapi Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Karibash Karibash force-pushed the feature/zod-openapi-method-chain branch from f082af5 to 9e910c4 Compare November 16, 2023 16:45
@Karibash Karibash force-pushed the feature/zod-openapi-method-chain branch from 9e910c4 to 904fb48 Compare November 16, 2023 17:09
Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Karibash

Yeah, it's complicated as you said. I've left the comments.

doc = <P extends string>(
path: P,
config: OpenAPIObjectConfig
): OpenAPIHono<E, S & ToSchema<'get', P, {}, OpenAPIObject>, BasePath> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The below is OK.

OpenAPIHono<E, S & ToSchema<'get', P, {}, {}>, BasePath>

Copy link
Contributor Author

@Karibash Karibash Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yusukebe
Since this method does not use the jsonT method, it looks like your suggestion is more correct.
Please check the following commit for the fix.
d4f9480

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this method does not use the jsonT method

Yes, you are right. It does not use jsonT()! Your fix is good.

doc31 = <P extends string>(
path: P,
config: OpenAPIObjectConfig
): OpenAPIHono<E, S & ToSchema<'get', P, {}, OpenAPIObject>, BasePath> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@Karibash Karibash force-pushed the feature/zod-openapi-method-chain branch from 3915c72 to d4f9480 Compare November 17, 2023 14:58
@yusukebe
Copy link
Member

@Karibash

Thanks! Looks good to me. I'll merge this now.

@yusukebe yusukebe merged commit ba83a26 into honojs:main Nov 17, 2023
@github-actions github-actions bot mentioned this pull request Nov 17, 2023
@Karibash Karibash deleted the feature/zod-openapi-method-chain branch November 18, 2023 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants