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

Change object.rename() override option to not delete existing if nothing match #1886

Closed
hueniverse opened this issue Jun 14, 2019 · 0 comments
Assignees
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Milestone

Comments

@hueniverse
Copy link
Contributor

Previously, this:

const schema = Joi.object().rename('a', 'b', { override: true });
const object = { b: 1 };

Would result in b being removed from the object because no a was found. This is unexpected behavior. If there is a real use case for this, we need another flag that means "only allow b from the rename, otherwise remove" which is by itself very odd. A better logic would be to forbid b unless it is from the rename.

Either way, I am changing this and if there is real need for the existing behavior, we can look into the proper way to support it.

@hueniverse hueniverse added the bug Bug or defect label Jun 14, 2019
@hueniverse hueniverse added this to the 16.0.0 milestone Jun 14, 2019
@hueniverse hueniverse self-assigned this Jun 14, 2019
@hueniverse hueniverse added the breaking changes Change that can breaking existing code label Jun 14, 2019
@hueniverse hueniverse added the v16 label Aug 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Projects
None yet
Development

No branches or pull requests

1 participant