Skip to content

Commit

Permalink
relates to #178: adapt countDocuments per spec, improve tests (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Senic authored Mar 1, 2023
1 parent 1ac29a3 commit e6c9f3f
Show file tree
Hide file tree
Showing 7 changed files with 435 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
"""
{
"status": {
"counted_documents": 2
"count": 2
}
}
"""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/** Enum with it's json property name which is returned in api response inside status */
public enum CommandStatus {
/** The element has the count of document */
@JsonProperty("counted_documents")
@JsonProperty("count")
COUNTED_DOCUMENT,
/** The element has the count of deleted documents */
@JsonProperty("deletedCount")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
import io.stargate.sgv2.jsonapi.api.model.command.Filterable;
import io.stargate.sgv2.jsonapi.api.model.command.ReadCommand;
import io.stargate.sgv2.jsonapi.api.model.command.clause.filter.FilterClause;
import javax.annotation.Nullable;
import javax.validation.Valid;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

@Schema(
description =
"Command that returns count of documents in a collection based on the collection.")
@JsonTypeName("countDocuments")
public record CountDocumentsCommands(
@Valid @JsonProperty("filter") FilterClause filterClause, @Valid @Nullable Options options)
implements ReadCommand, Filterable {

public record Options() {}
}
public record CountDocumentsCommands(@Valid @JsonProperty("filter") FilterClause filterClause)
implements ReadCommand, Filterable {}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public CollectionResource(CommandProcessor commandProcessor) {
UpdateOneCommand.class
}),
examples = {
@ExampleObject(ref = "count"),
@ExampleObject(ref = "countDocuments"),
@ExampleObject(ref = "deleteOne"),
@ExampleObject(ref = "deleteMany"),
@ExampleObject(ref = "findOne"),
Expand Down
Loading

0 comments on commit e6c9f3f

Please sign in to comment.