Skip to content

Retain object reference when no rules specified#478

Merged
Marsup merged 1 commit intomasterfrom
object-shortcut
Nov 7, 2014
Merged

Retain object reference when no rules specified#478
Marsup merged 1 commit intomasterfrom
object-shortcut

Conversation

@hueniverse
Copy link
Contributor

We have a few places in hapi config where we validate an options object containing user-specified values like app. These are shallow copied even when there is no reason to (no other rules specified). This creates a simple shortcut when there is no reason to perform even a shallow copy. Without this, the type must be set to joi.any() which is not as good as joi.object().

@hueniverse hueniverse added the bug Bug or defect label Nov 7, 2014
@Marsup
Copy link
Collaborator

Marsup commented Nov 7, 2014

Nice and useful indeed. Why the bug label though ?

@Marsup Marsup self-assigned this Nov 7, 2014
@Marsup Marsup added this to the 4.8.0 milestone Nov 7, 2014
Marsup added a commit that referenced this pull request Nov 7, 2014
Retain object reference when no rules specified
@Marsup Marsup merged commit 7d4ff2a into master Nov 7, 2014
@Marsup Marsup deleted the object-shortcut branch November 7, 2014 20:16
@Marsup Marsup added feature New functionality or improvement and removed bug Bug or defect labels Nov 7, 2014
@hueniverse
Copy link
Contributor Author

It's a bug because at every other level, joi keeps the existing value unless it needs to do a deep copy. It shallow copies objects but the behavior is not what I expected it to be (and I wrote this shit) when there is nothing to verify.

@Marsup Marsup added bug Bug or defect and removed feature New functionality or improvement labels Nov 7, 2014
@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

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants