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

EES-5731: Add character limit validation to data block chart title and alt text. #5497

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

tomjonesdev
Copy link
Collaborator

This PR adds character limit validation and dynamic character counts to data block chart titles and alt text. This is to help ensure data is presented in a concise format, and maintain standards and consistency across the service.

Comment on lines +69 to +79
RuleForEach(x => x.Charts).ChildRules(chart =>
{
chart
.RuleFor(request => request.Title)
.NotEmpty()
.MaximumLength(220);

chart.RuleFor(request => request.Alt)
.NotEmpty()
.MaximumLength(220);
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done in separate ticket, but I think there is an opportunity for clean up in these request objects: we can remove Charts from DataBlockCreateRequest. It is only used in tests.

This also makes me wonder if there is anything else in both request objects that aren't being used and can be removed.

Alternatively we could just add the same validation to DataBlockCreateRequest - if we're assuming that we may want to create a datablock that already has a chart in the future, but I'm inclined to think this won't happen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a moment to realise that Create is only used by the system when a new block is created, and not triggered by the user clicking "Save" (that's for Update), so I agree that it should be done...in a separate ticket. Maybe bring it up in the dev team meeting on Monday? Concern is that it's no small task to review all request objects for mismatches and update the FE/BE accordingly, there's no simple way to identify them automatically (afaik), and I imagine there's not much value when considering the work needed.

Based on this, I think adding the same validation to Create would be a mistake as we'd be muddying the logic further by implementing logic which isn't used/relevant.

@duncan-at-hiveit duncan-at-hiveit merged commit 0c82113 into dev Jan 7, 2025
10 checks passed
@duncan-at-hiveit duncan-at-hiveit deleted the EES-5731 branch January 7, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants