Skip to content

Feature/meta#311

Merged
hueniverse merged 6 commits intohapijs:masterfrom
joshuafcole:feature/meta
May 22, 2014
Merged

Feature/meta#311
hueniverse merged 6 commits intohapijs:masterfrom
joshuafcole:feature/meta

Conversation

@joshuafcole
Copy link

Closes #241

  • Adds support for storing arbitrary metadata on Joi schemas via any.meta(obj)
  • Meta can be retrieved in the standard fashion through any.describe()
  • Adds support for shallowly describing objects if that's needed object.describe([shallow=false])

@joshuafcole
Copy link
Author

After thinking about it I decided it probably made the most sense to

  • Merge multiple meta calls, preferring the newest (similar to how tags works)
  • Deep clone meta on any.clone() to maintain the fully immutable nature of schemas

I can revert those changes if you think they add unnecessary overhead.

@joshuafcole
Copy link
Author

Any thoughts on this? If improvements need to be made I would be happy to do so. If you'd like to throw it out and reimplement it differently that's also quite alright. I'd just like to have some idea of when I can rely on this feature (or similar) landing in Joi; or alternatively begin planning alternate solutions if it won't.

@hueniverse hueniverse added this to the 4.3.0 milestone May 22, 2014
@hueniverse hueniverse self-assigned this May 22, 2014
@hueniverse hueniverse merged commit 0104850 into hapijs:master May 22, 2014
hueniverse pushed a commit that referenced this pull request May 22, 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

feature New functionality or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thoughts on something like any.meta(obj)?

3 participants