一键导入
servicestack-validation
Applies FluentValidation and ServiceStack validation filters correctly.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Applies FluentValidation and ServiceStack validation filters correctly.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Designs stable, discoverable APIs using routes, metadata, and versioning conventions.
Implements authentication using ServiceStack Auth Providers and session handling.
Applies role-, permission-, and ownership-based authorization using ServiceStack idioms.
Implements AutoQuery services, custom filters, and permission-aware querying.
Designs request/response DTOs using DTO-first, message-based ServiceStack conventions.
Controls OpenAPI / metadata exposure without compromising ServiceStack-first design.
| name | servicestack-validation |
| description | Applies FluentValidation and ServiceStack validation filters correctly. |
ServiceStack uses FluentValidation to provide a declarative way to validate Request DTOs.
AbstractValidator<TRequestDto>.RuleFor syntax.ServiceInterface project (usually).public class GetCustomerValidator : AbstractValidator<GetCustomer>
{
public GetCustomerValidator()
{
RuleFor(r => r.Id).GreaterThan(0);
}
}
Validators are automatically registered in the IoC container if you use the ValidationFeature.
// AppHost.Configure
Plugins.Add(new ValidationFeature());
container.RegisterValidators(typeof(MyServices).Assembly);
ValidationFeature installs a global request filter that automatically executes validators before the service.ResponseStatus inside your Response DTO.While automatic validation is preferred, you can manually validate if needed:
var results = validator.Validate(request);
if (!results.IsValid)
throw results.ToException();
.WithErrorCode() for custom error codes that clients can easily switch on.