Skip to content

Commit

Permalink
fix validation for orderBy/continuationToken
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad committed Jan 14, 2025
1 parent e214490 commit 3f50c36
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions docs/schema/V1/schema.verified.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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!]!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ public sealed class SearchDialogsPayload
public List<SearchDialog>? 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<SearchDialogSortType> OrderBy { get; set; } = [];

public List<ISearchDialogError> Errors { get; set; } = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3f50c36

Please sign in to comment.