Skip to content

Support warning & information severity for validation results in the pipeline#1793

Draft
Copilot wants to merge 4 commits intocopilot/add-validationresultseverity-parameterfrom
copilot/support-warning-severity-validation
Draft

Support warning & information severity for validation results in the pipeline#1793
Copilot wants to merge 4 commits intocopilot/add-validationresultseverity-parameterfrom
copilot/support-warning-severity-validation

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Added

  • Validation severity support with .WithSeverity(ValidationResultSeverity) and .WithState(object) extensions for FluentValidation rules
  • ValidationResult.Information() factory method for informational validation results
  • [TreatWarningsAsErrors] attribute for controller methods/classes - warnings block execution when applied
  • ignoreWarnings parameter on Command.execute() - overrides attribute setting to allow warnings through
  • treatWarningsAsErrors readonly property on generated TypeScript commands/queries
  • HTTP header X-Ignore-Warnings support in CommandActionFilter and QueryActionFilter

Example validator usage:

public class CreateUserValidator : CommandValidator<CreateUser>
{
    public CreateUserValidator()
    {
        RuleFor(x => x.Email)
            .NotEmpty()
            .WithSeverity(ValidationResultSeverity.Error);
            
        RuleFor(x => x.Age)
            .GreaterThanOrEqualTo(18)
            .WithMessage("Users under 18 require parental consent")
            .WithSeverity(ValidationResultSeverity.Warning)
            .WithState(new { RequiresConsent = true });
    }
}

[TreatWarningsAsErrors]
public async Task<UserCreated> CreateUser([FromBody] CreateUser command)
{
    // Warnings will block execution due to attribute
}

Example frontend usage:

const command = new CreateUser();
command.email = 'user@example.com';
command.age = 16;

// Ignore warnings - only errors block execution
const result = await command.execute(undefined, true);

Validation filtering behavior:

  • Default: Only Error severity blocks execution
  • With [TreatWarningsAsErrors]: Warning and Error block execution
  • With ignoreWarnings=true: Only Error blocks (overrides attribute)

Changed

  • FluentValidationFilter now captures severity and custom state from validation errors instead of defaulting all to Error
  • Proxy generator detects [TreatWarningsAsErrors] attribute on controller methods and classes
Original prompt

This section details on the original issue you should resolve

<issue_title>Support warning & information severity for validation results in the pipeline</issue_title>
<issue_description>The validation pipeline is limited in many ways, we need to be able to support the new severity model properly.

The goal is to be able to have validation warnings and information. Information is just information we want to communicate. While warnings could be potential errors and we would like to have the option of saying stopping on warnings as well, but be able to ignore warnings.

We need to support this for both Controller based commands & queries as well as Model Bound commands in queries found in the Arc.Core project.

The default behavior should be that only Errors will stop an action to be performed. That being said, it should be possible to adorn an action to say "TreatWarningsAsErrors" but then have an explicit way of saying one ignores it.

This involves:

  • Add a hook for validators to be able to add severity
  • Add a hook for validators to be able to add state
  • Add and honor attribute for actions saying [TreatWarningsAsErrors]
  • Add a property on the generated frontend commands / queries saying if it has treatWarningsAsErrors turned on
  • Add an optional / nullable boolean for the execute() method in the frontend for ignoring warnings.

Continue the work of this PR: #1789</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 17, 2026 14:06
Co-authored-by: einari <134365+einari@users.noreply.github.com>
…arnings

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for warning and information severity in validation Support warning & information severity for validation results in the pipeline Feb 17, 2026
Copilot AI requested a review from einari February 17, 2026 14:16
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.

2 participants

Comments