Skip to content

Commit 858b460

Browse files
Merge pull request #209 from atc-net/hotfix/improve-validation-rule-CR0208-for-customPagination
Hotfix - Improve validation rule CR0208 for custom-pagination of T
2 parents f96f3d0 + 532b68c commit 858b460

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Atc.Rest.ApiGenerator.Framework.Minimal/ContentGenerators/ContentGeneratorServerWebApplicationExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public string Generate()
3939
sb.AppendLine(8, "this WebApplication app,");
4040
sb.AppendLine(8, "string applicationName)");
4141
sb.AppendLine(4, "{");
42+
sb.AppendLine(8, "ArgumentNullException.ThrowIfNull(app);");
43+
sb.AppendLine();
4244
sb.AppendLine(8, "if (!app.Environment.IsDevelopment())");
4345
sb.AppendLine(8, "{");
4446
sb.AppendLine(12, "return app;");

src/Atc.Rest.ApiGenerator.OpenApi/Validators/OpenApiDocumentValidator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ private void ValidateOperations(
502502
{
503503
if (operationValue.IsOperationIdPluralized(operationKey))
504504
{
505-
if (!responseModelSchema.IsModelOfTypeArray(modelSchemas))
505+
if (!responseModelSchema.IsModelOfTypeArray(modelSchemas) &&
506+
!responseModelSchema.IsTypeCustomPagination())
506507
{
507508
logItems.Add(logItemFactory.Create(logCategory, ValidationRuleNameConstants.Operation08, $"OperationId '{operationValue.OperationId}' is not singular - Response model is defined as a single item."));
508509
}

0 commit comments

Comments
 (0)