Skip to content

SysML2.NET.Validation with generated FluentValidation validators for … - #444

Merged
zeynepatsoprasteria merged 2 commits into
developmentfrom
405-feature-psm-request-dtovalidator
Nov 13, 2026
Merged

zeynepatsoprasteria merged 2 commits into
developmentfrom
405-feature-psm-request-dtovalidator

Conversation

@zeynepatsoprasteria

Copy link
Copy Markdown
Contributor

…PSM request DTOs.

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the SysML2.NET code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Implement #405 to generate validation project for request DTOs.

@zeynepatsoprasteria zeynepatsoprasteria linked an issue Nov 12, 2026 that may be closed by this pull request
4 of 5 tasks
/// <remarks>
/// The generated validator constructor invokes this method once, after registering its generated rules.
/// </remarks>
protected virtual void AddCustomValidation()

@antoineatsoprasteria antoineatsoprasteria Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This virtual method has to be called directly from the constructor, remove redundant call on each constructor of subclasses. To not have the SQ issue, call a private non virtual method that will call the virtual one

<Authors>Sam Gerené</Authors>
<RequireLicenseAcceptance>true</RequireLicenseAcceptance>
<PackageReleaseNotes>
[Add] FluentValidation validators for the PSM request DTOs (#405)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

don't add package release notes

Comment thread Directory.Packages.props Outdated
</ItemGroup>
<ItemGroup Label="Libraries">
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.7.0" />
<PackageVersion Include="FluentValidation" Version="11.12.0" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's not the latest version. Bump to the latest one and only target Net10 on the validation project

</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\SysML2.NET\SysML2.NET.csproj" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Make reference to the SysML2.NET.Extensions instead

/// </summary>
public TagRequestValidator()
{
this.RuleFor(dto => dto.Name).NotNull();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For string, verify that it's not empty neither

public DataVersionRequestValidator()
{
this.RuleFor(dto => dto.Identity).SetValidator(new DataIdentityRequestValidator());
this.RuleFor(dto => dto.Payload).SetInheritanceValidator(validators =>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note for later, we will also have the need to add custom validation to add all CORE validator

@sonarqubecloud

Copy link
Copy Markdown

@zeynepatsoprasteria
zeynepatsoprasteria merged commit 699fafa into development Nov 13, 2026
8 checks passed
@zeynepatsoprasteria
zeynepatsoprasteria deleted the 405-feature-psm-request-dtovalidator branch November 13, 2026 13: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.

[Feature]: PSM (Request) DTOValidator

2 participants