Skip to content

Commit

Permalink
Merge pull request #209 from atc-net/hotfix/improve-validation-rule-C…
Browse files Browse the repository at this point in the history
…R0208-for-customPagination

Hotfix - Improve validation rule CR0208 for custom-pagination of T
  • Loading branch information
davidkallesen authored Oct 7, 2024
2 parents f96f3d0 + 532b68c commit 858b460
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public string Generate()
sb.AppendLine(8, "this WebApplication app,");
sb.AppendLine(8, "string applicationName)");
sb.AppendLine(4, "{");
sb.AppendLine(8, "ArgumentNullException.ThrowIfNull(app);");
sb.AppendLine();
sb.AppendLine(8, "if (!app.Environment.IsDevelopment())");
sb.AppendLine(8, "{");
sb.AppendLine(12, "return app;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ private void ValidateOperations(
{
if (operationValue.IsOperationIdPluralized(operationKey))
{
if (!responseModelSchema.IsModelOfTypeArray(modelSchemas))
if (!responseModelSchema.IsModelOfTypeArray(modelSchemas) &&
!responseModelSchema.IsTypeCustomPagination())
{
logItems.Add(logItemFactory.Create(logCategory, ValidationRuleNameConstants.Operation08, $"OperationId '{operationValue.OperationId}' is not singular - Response model is defined as a single item."));
}
Expand Down

0 comments on commit 858b460

Please sign in to comment.