< Summary - Heimdall API

Information
Class: ArturRios.Heimdall.Command.Input.Validation.CreateScopeCommandValidator
Assembly: ArturRios.Heimdall.Command
File(s): /home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Command/Input/Validation/CreateScopeCommandValidator.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 34
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%

File(s)

/home/runner/work/heimdall-api/heimdall-api/src/Application/ArturRios.Heimdall.Command/Input/Validation/CreateScopeCommandValidator.cs

#LineLine coverage
 1using ArturRios.Heimdall.Shared.Messages;
 2using FluentValidation;
 3
 4namespace ArturRios.Heimdall.Command.Input.Validation;
 5
 6/// <summary>
 7///     Input validation for <see cref="CreateScopeCommand" /> (UC-01, step 2 / AF-01b). Only checks
 8///     the shape of the request — including the field lengths the columns impose, so an overlong
 9///     value is a named 400 here rather than the persistence layer's unclassified data-access
 10///     failure; business rules that require data access (name uniqueness, owner eligibility) are
 11///     enforced by the handler.
 12/// </summary>
 13public class CreateScopeCommandValidator : AbstractValidator<CreateScopeCommand>
 14{
 1615    public CreateScopeCommandValidator()
 16    {
 1617        RuleFor(command => command.Name)
 1618            .NotEmpty()
 1619            .WithMessage(ScopeMessages.NameRequired)
 1620            .MaximumLength(200)
 1621            .WithMessage(ScopeMessages.NameTooLong);
 22
 23        // FluentValidation's MaximumLength rule skips a null argument, so only a non-null overlong
 24        // description is rejected — matching how the Application and ScopePermission validators
 25        // treat their optional descriptions.
 1626        RuleFor(command => command.Description)
 1627            .MaximumLength(500)
 1628            .WithMessage(ScopeMessages.DescriptionTooLong);
 29
 1630        RuleFor(command => command.OwnerIds)
 1631            .NotEmpty()
 1632            .WithMessage(ScopeMessages.AtLeastOneOwnerRequired);
 1633    }
 34}

Methods/Properties

.ctor()