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

Add Effect Schema validator #589

Merged
merged 10 commits into from
Jul 11, 2024
Merged

Add Effect Schema validator #589

merged 10 commits into from
Jul 11, 2024

Conversation

gunta
Copy link
Contributor

@gunta gunta commented Jun 21, 2024

Introduces a new very basic package for Effect Schema validation.

Copy link

changeset-bot bot commented Jun 21, 2024

🦋 Changeset detected

Latest commit: b446bce

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

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

packages/schema-validator/package.json Outdated Show resolved Hide resolved
.changeset/poor-clouds-fix.md Show resolved Hide resolved
@yusukebe
Copy link
Member

Hi @gunta

I've left comments. Check them!

@gunta
Copy link
Contributor Author

gunta commented Jul 9, 2024

@yusukebe Fixed! Also added github workflow.

@yusukebe
Copy link
Member

Hi @gunta

I've refactored the code and corrected the settings. The biggest point is you don't need to write as now:

app.post('/user', effectValidator('json', User), (c) => {
  const user = c.req.valid('json') // you don't need `as S.Schema.Type<typeof User>`

  return c.json({
    success: true,
    message: `${user.name} is ${user.age}`
  })
})

Perhaps this PR is already good. I'll merge it into the main and release the first version. If you have any problems, please create a PR or an issue again. Thank you for your contribution!

@yusukebe yusukebe merged commit 95eb48c into honojs:main Jul 11, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Jul 11, 2024
@gunta gunta deleted the add-effect-schema branch July 16, 2024 10:33
@richburdon
Copy link

@gunta this looks great. when i try to use it though, the build artifacts don't seem to have been included in the npm publish?

❯ l node_modules/@hono/effect-validator/
total 8
-rw-r--r-- 1 1468 2024-07-20 16:50 README.md
-rw-r--r-- 1 1252 2024-07-20 16:50 package.json

@yusukebe
Copy link
Member

@richburdon

Ooops. I'm fixing it now.

@yusukebe
Copy link
Member

Hi @richburdon

Fixed it in the latest version @hono/[email protected]. Try it!

@richburdon
Copy link

Hi @yusukebe, working great -- ありがとうございます。

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.

3 participants