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

Support for a new validator (joi) #95

Closed
wants to merge 3 commits into from
Closed

Support for a new validator (joi) #95

wants to merge 3 commits into from

Conversation

malezjaa
Copy link

Support for joi. Code was tested with nextjs and nuxt.

Example using joi.

export const env = createEnv({
  client: {
    NEXT_PUBLIC_GREETING: Joi.string(),
  },
  server: {
    SECRET: Joi.string(),
  },
  experimental__runtimeEnv: {
    NEXT_PUBLIC_GREETING: "hi",
  },
  validator: "joi",
});

@vercel
Copy link

vercel bot commented Jun 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
t3-env ❌ Failed (Inspect) Jun 26, 2023 4:02pm
t3-env-nextjs 🔄 Building (Inspect) Jun 26, 2023 4:02pm

@vercel
Copy link

vercel bot commented Jun 26, 2023

@malezjaa is attempting to deploy a commit to the t3-oss Team on Vercel.

A member of the Team first needs to authorize it.

@chungweileong94
Copy link
Contributor

Hmm... Correct me if I'm wrong, but it doesn't seem like it will work without both zod & joi being installed.

@malezjaa
Copy link
Author

That's right, it won't work using two validators. However, I don't see the point of using two libraries at once.

@chungweileong94
Copy link
Contributor

chungweileong94 commented Jun 29, 2023

Yeah, that's the point, there might be some structure needs to be made to support different validators.
I don't think the package should import the validator package directly, or it should at least import from an adapter or some sort, else it won't work unless user install all the validators🤔

There are some discussion in this issue #6, which you can refer to.

@chungweileong94
Copy link
Contributor

The fact that the core is importing both zod & joi at the same time also means that user will have install both packages.

@malezjaa
Copy link
Author

So, you mean the possibility for the user to import the adapter? Something like unstorage?

@chungweileong94
Copy link
Contributor

Never use unstorage before, but something like that.

@malezjaa malezjaa closed this by deleting the head repository Jun 29, 2023
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