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

Idea: Joi should be in the peerDependencies section #27

Closed
mrjono1 opened this issue Dec 28, 2020 · 5 comments
Closed

Idea: Joi should be in the peerDependencies section #27

mrjono1 opened this issue Dec 28, 2020 · 5 comments

Comments

@mrjono1
Copy link
Owner

mrjono1 commented Dec 28, 2020

I'm pretty sure that Joi should be a peer dependency instead of a normal dependency.

I haven't had a use case like this before so I will investigate if this is the case I may do a major version bump for this change.

@mrjono1
Copy link
Owner Author

mrjono1 commented Dec 28, 2020

It will probably mean that this library should have more tests using multiple versions of joi

@hazmah0
Copy link

hazmah0 commented Dec 28, 2020

I was thinking about this briefly as well a few days ago when I was trying this package out. The project I was working on had a dependency to a package, lets call it A, and this package A was using version 14.x of Joi internally.

When I added joi-to-typescript to convert the Joi schemas to TS types I saw the following output:
[object Object] - Skipped - no Joi Schemas found

And the reason for this is because I always ended up in this if statement below:

if (!Joi.isSchema(joiSchema)) {
  continue;
}

Since this package is using methods like isSchema and describe which only exists in newer versions of Joi I think it would make sense to add Joi as a peer dependency to express compatibility more clearly.

@mrjono1
Copy link
Owner Author

mrjono1 commented Dec 29, 2020

@hazmah0 that sounds like another issue, this library has only been tested with joi version 17 and greater.
at version 17 Joi changed direction a bit (being split from hapi)
When I started this library I had lots of issues with versions of Joi less than 17 due to internal structure changes, it may work but I don't want to support old Joi versions.

@mrjono1
Copy link
Owner Author

mrjono1 commented Dec 29, 2020

sorry I didn't finish reading your comment you explained the issues I found with versions of joi less than 17

@mrjono1 mrjono1 closed this as completed Mar 1, 2021
@mrjono1
Copy link
Owner Author

mrjono1 commented Jan 30, 2022

This has now been completed https://github.com/mrjono1/joi-to-typescript/releases/tag/3.0.0

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

No branches or pull requests

2 participants