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

[Request] Allow mixing patch version #2173

Closed
Outpox opened this issue Oct 8, 2019 · 2 comments
Closed

[Request] Allow mixing patch version #2173

Outpox opened this issue Oct 8, 2019 · 2 comments
Assignees
Labels
documentation Non-code related changes support Questions, discussions, and general support
Milestone

Comments

@Outpox
Copy link

Outpox commented Oct 8, 2019

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 10+
  • module version: 16.1.6
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What problem are you trying to solve?

Hey there,

I'm using Joi to validate projects configuration and have been facing a small issue lately.
My main project contains a schema and is using Joi@16.1.5. I've got a library as another project that contains its own schema with Joi@16.1.7.
I'm attempting to import my library's schema into the main project but I'm facing the following error:
Error: Cannot mix different versions of joi schemas

Do you have a new or modified API suggestion to solve the problem?

This is very clear to me but I'm kinda surprised that mixing version that differs in PATCH is not allowed and wanted to know if you'd be open to be more permissive about this.

When facing this issue I found compile() that should let me avoid this but I still wanted to ask.

Also I would like to suggest adding the incompatible versions in the error message. I can open a PR for this if you want.

@Outpox Outpox added the feature New functionality or improvement label Oct 8, 2019
@hueniverse hueniverse self-assigned this Oct 8, 2019
@hueniverse hueniverse added support Questions, discussions, and general support and removed feature New functionality or improvement labels Oct 8, 2019
@hueniverse
Copy link
Contributor

Adding the conflicting version numbers to the error seems like a good idea. However, mixing versions is just not possible as with joi v16, there is so much complicated internal state that is not covered by semver releases. I recently changed the entire implementation of the shadow cache in a patch release. This makes it extremely risky to allow some leeway in even patching matching.

@hueniverse hueniverse added this to the 16.1.8 milestone Oct 8, 2019
@hueniverse hueniverse added the documentation Non-code related changes label Oct 8, 2019
justsml added a commit to justsml/joi that referenced this issue Oct 22, 2019
* 'master' of github.com:hapijs/joi:
  Update API.md
  Improve compile version conflict error message. Closes hapijs#2173
  Closes hapijs#2172
  Fix docs malformed code block ending at section `object.pattern.match`
  End code block
  Fix docs missing code block ending at section `date.less(date)`
  Fix function signature. Fixes hapijs#2170.
  Delete .npmrc
  Delete .editorconfig
  Delete feature_request.md
  Delete bug_report.md
  Delete CONTRIBUTING.md
  16.1.7
  Fix date format validation. Closes hapijs#2168
  16.1.6
  Closes hapijs#2165
  16.1.5
  Clarify error(). Closes hapijs#2158
  Closes hapijs#2161
  Fix handling of shadow values. Closes hapijs#2156
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Non-code related changes support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

2 participants