Imagine you’re building a dating app. You’ve hit a major milestone: one million users. Congratulations! But then, requirements change. In the early days, you kept things simple. To track whether a user had children, you used a single column called kids that stored a simple string, like: ‘yes- they live with me’ or ‘no.’

const updatePreferencesSchema = Joi.object({
kids: Joi.string().valid(
"Yes- they live with me",
"Yes- they don't live with me",
"no"
).optional()
});

However, as your app matures, your product team wants better data. They want to know if a user has kids or if their current kids live away from home. You need to transform that single string into a nested object:

const updatePreferencesSchema = Joi.object({
kids: Joi.object({
hasKids: Joi.boole...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help