Skip to content

Commit

Permalink
chore: Improve error message when sunsetat has value (#1259)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced validation logic for dialog creation and update processes,
ensuring that if a sunset date is set, the dialog must be marked as
deprecated.
  
- **Bug Fixes**
- Improved error messaging for validation rules related to the
`Deprecated` and `SunsetAt` properties.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
MagnusSandgren authored Oct 9, 2024
1 parent 5a751af commit 75e0421
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ public CreateDialogDialogApiActionEndpointDtoValidator()
.MaximumLength(Constants.DefaultMaxUriLength);
RuleFor(x => x.Deprecated)
.Equal(true)
.WithMessage($"'{{PropertyName}}' must be equal to 'True' when {nameof(CreateDialogDialogApiActionEndpointDto.SunsetAt)} is set.")
.When(x => x.SunsetAt.HasValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public UpdateDialogDialogApiActionEndpointDtoValidator()
.MaximumLength(Constants.DefaultMaxUriLength);
RuleFor(x => x.Deprecated)
.Equal(true)
.WithMessage($"'{{PropertyName}}' must be equal to 'True' when {nameof(UpdateDialogDialogApiActionEndpointDto.SunsetAt)} is set.")
.When(x => x.SunsetAt.HasValue);
}
}
Expand Down

0 comments on commit 75e0421

Please sign in to comment.