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

ArkType validator middleware #325

Merged
merged 8 commits into from
Jan 4, 2024
Merged

ArkType validator middleware #325

merged 8 commits into from
Jan 4, 2024

Conversation

MonsterDeveloper
Copy link
Contributor

A validator middleware using ArkType. Built after the zValidator.

Example usage:

import { type } from 'arktype'
import { arktypeValidator } from '@hono/arktype-validator'

const schema = type({
  name: 'string',
  age: 'number'
})

app.post('/author', arktypeValidator('json', schema), (c) => {
  const data = c.req.valid('json')
  return c.json({
    success: true,
    message: `${data.name} is ${data.age}`,
  })
})

Copy link

changeset-bot bot commented Dec 23, 2023

🦋 Changeset detected

Latest commit: c8471bb

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

This PR includes changesets to release 1 package
Name Type
@hono/arktype-validator Major

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

@yusukebe
Copy link
Member

Hi @MonsterDeveloper

Cool! I didn't know ArkType, but it's simple and seems to be great. I've left one minor comment. Please check it out.

@yusukebe
Copy link
Member

@MonsterDeveloper

And two things:

  1. Please add the CI to there: https://github.com/honojs/middleware/tree/main/.github/workflows
  2. Add a build command below here:
    "build:react-renderer": "yarn workspace @hono/react-renderer build",

@MonsterDeveloper
Copy link
Contributor Author

@yusukebe done!

@yusukebe
Copy link
Member

yusukebe commented Jan 3, 2024

@MonsterDeveloper

Thank you! I'll check it again later and release it if everything is ok.

@yusukebe
Copy link
Member

yusukebe commented Jan 4, 2024

Hi @MonsterDeveloper

I've tried this ArkType Validator Middleware again. Feels great! Let's land it!

@yusukebe yusukebe merged commit b84c6c8 into honojs:main Jan 4, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request Jan 4, 2024
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