From 3f50c36738e92db6bbca8410fde9b059c039ebf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Skogstad?= Date: Tue, 14 Jan 2025 16:42:58 +0100 Subject: [PATCH] fix validation for orderBy/continuationToken --- docs/schema/V1/schema.verified.graphql | 3 +-- .../EndUser/SearchDialogs/ObjectTypes.cs | 3 +-- .../EndUser/SearchDialogs/SearchDialogInputValidator.cs | 5 ----- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/schema/V1/schema.verified.graphql b/docs/schema/V1/schema.verified.graphql index cbf83f051..19e165ec9 100644 --- a/docs/schema/V1/schema.verified.graphql +++ b/docs/schema/V1/schema.verified.graphql @@ -237,9 +237,8 @@ type SearchDialogValidationError implements SearchDialogError { type SearchDialogsPayload { items: [SearchDialog!] hasNextPage: Boolean! - "Use this token to fetch the next page of dialogs, must be used in combination with OrderBy" + "Use this token to fetch the next page of dialogs, must be used in combination with OrderBy from the previous response" continuationToken: String - "Use this OrderBy to fetch the next page of dialogs, must be used in combination with ContinuationToken" orderBy: [SearchDialogSortType!]! errors: [SearchDialogError!]! } diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs index ed9bff97a..35944b563 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/ObjectTypes.cs @@ -34,10 +34,9 @@ public sealed class SearchDialogsPayload public List? Items { get; set; } public bool HasNextPage { get; set; } - [GraphQLDescription("Use this token to fetch the next page of dialogs, must be used in combination with OrderBy")] + [GraphQLDescription("Use this token to fetch the next page of dialogs, must be used in combination with OrderBy from the previous response")] public string? ContinuationToken { get; set; } - [GraphQLDescription("Use this OrderBy to fetch the next page of dialogs, must be used in combination with ContinuationToken")] public List OrderBy { get; set; } = []; public List Errors { get; set; } = []; diff --git a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/SearchDialogInputValidator.cs b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/SearchDialogInputValidator.cs index b8ab89847..83a6996e7 100644 --- a/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/SearchDialogInputValidator.cs +++ b/src/Digdir.Domain.Dialogporten.GraphQL/EndUser/SearchDialogs/SearchDialogInputValidator.cs @@ -12,11 +12,6 @@ public SearchDialogInputValidator() .When(x => x.ContinuationToken != null) .WithMessage("OrderBy must be set when ContinuationToken is set."); - RuleFor(x => x.ContinuationToken) - .NotNull() - .When(x => x.OrderBy != null) - .WithMessage("ContinuationToken must be set when OrderBy is set."); - RuleFor(x => x.OrderBy) .NotEmpty() .When(x => x.OrderBy != null);