[ARVADOS] updated: 2.1.0-1350-g4791d2ccd
Git user
git at public.arvados.org
Thu Sep 16 13:55:22 UTC 2021
Summary of changes:
doc/api/methods.html.textile.liquid | 19 +++++++++++++------
.../api/app/controllers/application_controller.rb | 4 ++--
services/api/lib/load_param.rb | 3 +--
services/api/test/integration/select_test.rb | 16 ++++++++++++----
4 files changed, 28 insertions(+), 14 deletions(-)
via 4791d2ccd9394d0818321f0bd5bd7de6fa1dabaa (commit)
via 4f7f3c036658a1e9826636d924326487afc40fc0 (commit)
from 89d309ae02a0b47be4b201b78449afd4267effef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 4791d2ccd9394d0818321f0bd5bd7de6fa1dabaa
Author: Tom Clegg <tom at curii.com>
Date: Thu Sep 16 09:54:38 2021 -0400
18122: Update "distinct" docs (default is false) and tidy up code.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/doc/api/methods.html.textile.liquid b/doc/api/methods.html.textile.liquid
index adbb0af7c..724f445b5 100644
--- a/doc/api/methods.html.textile.liquid
+++ b/doc/api/methods.html.textile.liquid
@@ -82,8 +82,8 @@ table(table table-bordered table-condensed).
|order |array |Attributes to use as sort keys to determine the order resources are returned, each optionally followed by @asc@ or @desc@ to indicate ascending or descending order. (If not specified, it will be ascending).
Example: @["head_uuid asc","modified_at desc"]@
Default: @["modified_at desc", "uuid asc"]@|query|
-|distinct|boolean|@true@: (default) do not return duplicate objects
- at false@: permitted to return duplicates|query|
+|distinct|boolean|When returning multiple records whose whose selected attributes (see @select@) are equal, return them as a single response entry.
+Default is @false at .|query|
|select |array |Attributes of each object to return in the response (by default, all available attributes are returned, except collections, which do not return @manifest_text@ unless explicitly selected).
Example: @["uuid","name","modified_at"]@|query|
|count|string|@"exact"@ (default): Include an @items_available@ response field giving the number of distinct matching items that can be retrieved (irrespective of @limit@ and @offset@ arguments).
diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb
index 9db8b4471..f986e88cd 100644
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@ -305,7 +305,7 @@ class ApplicationController < ActionController::Base
@objects = @objects.order(@orders.join ", ") if @orders.any?
@objects = @objects.limit(@limit)
@objects = @objects.offset(@offset)
- @objects = @objects.distinct(@distinct) if not @distinct.nil?
+ @objects = @objects.distinct() if @distinct
end
# limit_database_read ensures @objects (which must be an
@@ -654,7 +654,7 @@ class ApplicationController < ActionController::Base
where: { type: 'object', required: false },
order: { type: 'array', required: false },
select: { type: 'array', required: false },
- distinct: { type: 'boolean', required: false },
+ distinct: { type: 'boolean', required: false, default: false },
limit: { type: 'integer', required: false, default: DEFAULT_LIMIT },
offset: { type: 'integer', required: false, default: 0 },
count: { type: 'string', required: false, default: 'exact' },
diff --git a/services/api/lib/load_param.rb b/services/api/lib/load_param.rb
index 203c9c078..9a360c538 100644
--- a/services/api/lib/load_param.rb
+++ b/services/api/lib/load_param.rb
@@ -145,8 +145,7 @@ module LoadParam
end
end
- @distinct = true if (params[:distinct] == true || params[:distinct] == "true")
- @distinct = false if (params[:distinct] == false || params[:distinct] == "false")
+ @distinct = params[:distinct] && true
end
def load_select_param
diff --git a/services/api/test/integration/select_test.rb b/services/api/test/integration/select_test.rb
index 7fbab3b3b..2ee3b3cf9 100644
--- a/services/api/test/integration/select_test.rb
+++ b/services/api/test/integration/select_test.rb
@@ -16,11 +16,17 @@ class SelectTest < ActionDispatch::IntegrationTest
end
test "fewer distinct than total count" do
+ get "/arvados/v1/links",
+ params: {:format => :json, :select => ['link_class']},
+ headers: auth(:active)
+ assert_response :success
+ distinct_unspecified = json_response['items']
+
get "/arvados/v1/links",
params: {:format => :json, :select => ['link_class'], :distinct => false},
headers: auth(:active)
assert_response :success
- links = json_response['items']
+ distinct_false = json_response['items']
get "/arvados/v1/links",
params: {:format => :json, :select => ['link_class'], :distinct => true},
@@ -28,9 +34,11 @@ class SelectTest < ActionDispatch::IntegrationTest
assert_response :success
distinct = json_response['items']
- assert_operator(distinct.count, :<, links.count,
- "distinct count should be less than link count")
- assert_equal links.uniq.count, distinct.count
+ assert_operator(distinct.count, :<, distinct_false.count,
+ "distinct=true count should be less than distinct=false count")
+ assert_equal(distinct_unspecified.count, distinct_false.count,
+ "distinct=false should be the default")
+ assert_equal distinct_false.uniq.count, distinct.count
end
test "select with order" do
commit 4f7f3c036658a1e9826636d924326487afc40fc0
Author: Tom Clegg <tom at curii.com>
Date: Thu Sep 16 09:39:18 2021 -0400
18122: Update API docs.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/doc/api/methods.html.textile.liquid b/doc/api/methods.html.textile.liquid
index fd5291792..adbb0af7c 100644
--- a/doc/api/methods.html.textile.liquid
+++ b/doc/api/methods.html.textile.liquid
@@ -37,6 +37,8 @@ table(table table-bordered table-condensed).
|_. Argument |_. Type |_. Description |_. Location |
|{resource_type}|object|Name is the singular form of the resource type, e.g., for the "collections" resource, this argument is "collection"|body|
|{cluster_id}|string|Optional, the cluster on which to create the object if not the current cluster.|query|
+|select |array |Attributes of the new object to return in the response (by default, all available attributes are returned).
+Example: @["uuid","name","modified_at"]@|query|
h2. delete
@@ -49,6 +51,8 @@ Arguments:
table(table table-bordered table-condensed).
|_. Argument |_. Type |_. Description |_. Location |
{background:#ccffcc}.|uuid|string|The UUID of the object in question.|path|
+|select |array |Attributes of the deleted object to return in the response (by default, all available attributes are returned).
+Example: @["uuid","name","modified_at"]@|query|
h2. get
@@ -61,10 +65,12 @@ Arguments:
table(table table-bordered table-condensed).
|_. Argument |_. Type |_. Description |_. Location |
{background:#ccffcc}.|uuid|string|The UUID of the object in question.|path|
+|select |array |Attributes of the object to return in the response (by default, all available attributes are returned).
+Example: @["uuid","name","modified_at"]@|query|
h2(#index). list
-The @list@ method requests an list of resources of that type. It corresponds to the HTTP request @GET /arvados/v1/resource_type at . All resources support "list" method unless otherwise noted.
+The @list@ method requests an list of resources of that type. It corresponds to the HTTP request @GET /arvados/v1/resource_type at . All resources support the @list@ method unless otherwise noted.
Arguments:
@@ -76,11 +82,10 @@ table(table table-bordered table-condensed).
|order |array |Attributes to use as sort keys to determine the order resources are returned, each optionally followed by @asc@ or @desc@ to indicate ascending or descending order. (If not specified, it will be ascending).
Example: @["head_uuid asc","modified_at desc"]@
Default: @["modified_at desc", "uuid asc"]@|query|
-|select |array |Set of attributes to include in the response.
-Example: @["head_uuid","tail_uuid"]@
-Default: all available attributes. As a special case, collections do not return "manifest_text" unless explicitly selected.|query|
|distinct|boolean|@true@: (default) do not return duplicate objects
@false@: permitted to return duplicates|query|
+|select |array |Attributes of each object to return in the response (by default, all available attributes are returned, except collections, which do not return @manifest_text@ unless explicitly selected).
+Example: @["uuid","name","modified_at"]@|query|
|count|string|@"exact"@ (default): Include an @items_available@ response field giving the number of distinct matching items that can be retrieved (irrespective of @limit@ and @offset@ arguments).
@"none"@: Omit the @items_available@ response field. This option will produce a faster response.|query|
@@ -187,3 +192,5 @@ table(table table-bordered table-condensed).
|_. Argument |_. Type |_. Description |_. Location |
{background:#ccffcc}.|uuid|string|The UUID of the resource in question.|path||
|{resource_type}|object||query||
+|select |array |Attributes of the updated object to return in the response (by default, all available attributes are returned).
+Example: @["uuid","name","modified_at"]@|query|
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list