The Not-So-Flexible Validation Component: A Comedy of Errors in Sitecore Content Hub


Ah, the summer of 2024—a time for sun, fun, and the release of the much-anticipated Validation component in Sitecore Content Hub. Promising to be the central hub for all your validation needs, this component aimed to gather all validation rules in one place, ensuring data integrity and consistency across your digital assets. We were all set for a smooth ride, expecting a component as flexible as a yoga master. But, as it turns out, this component is more like that one friend who insists they’re flexible but can barely touch their toes.

In this exploration, we will dive into the nuances of the Validation component, exploring its setup, configuration, and—let's be honest—its rather surprising limitations.

Default Configuration: The Basics

To start, we embraced the default configuration, which, in theory, should be a breeze:

{ "definitionName": "M.Asset" }

This simple setup was supposed to be our ticket to hassle-free validation. Spoiler alert: it was anything but.

Configuration Steps: Setting the Stage

Add the Validation Component to Your Page

First, we dutifully placed the Validation component on our desired page within Sitecore Content Hub. Like an eager host setting up for a party, we expected this component to handle all our validation needs with the grace of a seasoned maître d'. Instead, it felt more like hiring a bouncer who’s really good at pointing out problems but not so great at fixing them.

Always Visible Setting: Not So Always

The component features an "always visible" option, presumably to keep validation messages on display at all times. In reality, this setting is more like that one co-worker who’s always around when you don’t need them and mysteriously absent when you do. Despite setting it to true, validation messages only pop up during edit and save operations. So much for always being visible!

Handling Validation Messages: A Visual Buffet

In an unexpected twist, both new and old validation messages decided to show up, occupying the bottom right corner like uninvited guests at a dinner party. There's no clear method to send the old messages packing, leaving us with a cluttered interface that’s anything but user-friendly.

Validating Fields: The Tale of Unmet Expectations

We thought we’d get fancy and try validating non-mandatory fields or setting restrictions on mandatory ones. For instance, limiting the Title field to a maximum of five characters seemed like a simple enough task:

{ "definitionName": "M.Asset", "rules": [ { "fieldName": "Title", "validationType": "TextLength", "parameters": { "maxLength": 5, "errorMessage": "Title should not exceed 5 characters." } } ] }

The result? Crickets. Nada. Zilch. It turns out this component is about as responsive as a magic 8-ball that only says, “Ask again later.” We can only assume the documentation is missing a crucial piece or the component itself is still finding its way.

Removing All Settings: The Naked Truth

For a truly enlightening experience, we stripped the component down to its bare essentials, leaving an empty configuration:

{}

Amazingly, even with no settings, the component still insisted on validating mandatory fields on asset details. It’s like the one guest who won’t leave even after you’ve turned off the lights and locked the doors. Clearly, there are some default behaviors at play here, whether we like it or not.

Conclusion: A Not-So-Flexible Friend

In our journey through the initial setup and exploration of the new Validation component in Sitecore Content Hub DAM, our key takeaways? The component does not add anything useful for us, and we'd recommend steering clear for now.

Key Observations:

  1. Visibility: The "Always Visible" setting isn’t reliable.
  2. Validation Messages: Old and new messages coexist, cluttering the interface.
  3. Field Validations: Attempts to validate fields or set restrictions have been fruitless, likely due to incomplete documentation or implementation.

Sitecore has confirmed via email that this component is not as configurable as we'd hoped. It’s more of a passive observer, merely collecting and listing errors in one central place.

Future Steps: Navigating the Road Ahead

  • Documentation: Keep an eye out for updates or more comprehensive documentation from Sitecore.
  • Feedback: We've provided feedback on the documentation page and emailed the relevant contacts, hoping for some improvements.
  • Information: For the latest details, check out Sitecore's documentation.

In the end, the Validation component might not be the flexible, all-knowing solution we anticipated. But hey, sometimes you need a few unexpected surprises to keep things interesting—or at least to give you a good story to tell.

Comments