[ARVADOS] created: cac20b7dd2177edebc0a4f8087032d1143bd524e

Git user git at public.curoverse.com
Fri Jun 9 11:59:05 EDT 2017


        at  cac20b7dd2177edebc0a4f8087032d1143bd524e (commit)


commit cac20b7dd2177edebc0a4f8087032d1143bd524e
Author: radhika <radhika at curoverse.com>
Date:   Fri Jun 9 11:56:45 2017 -0400

    11821: add include_trash for collections.index and recursive for groups.contents to discovery doc

diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb
index e3c10b7..5c09b1f 100644
--- a/services/api/app/controllers/arvados/v1/collections_controller.rb
+++ b/services/api/app/controllers/arvados/v1/collections_controller.rb
@@ -3,6 +3,16 @@ require "arvados/keep"
 class Arvados::V1::CollectionsController < ApplicationController
   include DbCurrentTime
 
+  def self._index_requires_parameters
+    (super rescue {}).
+      merge({
+        include_trash: {
+          type: 'boolean', required: false, description: "Include collections whose is_trashed attribute is true."
+        },
+      })
+  end
+
+
   def create
     if resource_attrs[:uuid] and (loc = Keep::Locator.parse(resource_attrs[:uuid]))
       resource_attrs[:portable_data_hash] = loc.to_s
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index 4c33be6..fc80a65 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -6,6 +6,9 @@ class Arvados::V1::GroupsController < ApplicationController
               uuid: {
                 type: 'string', required: false, default: nil
               },
+              recursive: {
+                type: 'boolean', required: false, description: 'Include contents from child groups recursively.'
+              },
             })
     params.delete(:select)
     params
diff --git a/services/api/test/functional/arvados/v1/schema_controller_test.rb b/services/api/test/functional/arvados/v1/schema_controller_test.rb
index 7101821..57dffca 100644
--- a/services/api/test/functional/arvados/v1/schema_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/schema_controller_test.rb
@@ -61,4 +61,38 @@ class Arvados::V1::SchemaControllerTest < ActionController::TestCase
       refute_includes(discovery_doc['resources'][r]['methods'].keys(), 'create')
     end
   end
+
+  test "groups contents parameters" do
+    get :index
+    assert_response :success
+
+    discovery_doc = JSON.parse(@response.body)
+
+    group_index_params = discovery_doc['resources']['groups']['methods']['index']['parameters']
+    group_contents_params = discovery_doc['resources']['groups']['methods']['contents']['parameters']
+
+    assert_equal group_contents_params.keys.sort, (group_index_params.keys - ['select'] + ['uuid', 'recursive']).sort
+
+    recursive_param = group_contents_params['recursive']
+    assert_equal 'boolean', recursive_param['type']
+    assert_equal false, recursive_param['required']
+    assert_equal 'query', recursive_param['location']
+  end
+
+  test "collections index parameters" do
+    get :index
+    assert_response :success
+
+    discovery_doc = JSON.parse(@response.body)
+
+    specimens_index_params = discovery_doc['resources']['specimens']['methods']['index']['parameters']  # no changes from super
+    coll_index_params = discovery_doc['resources']['collections']['methods']['index']['parameters']
+
+    assert_equal coll_index_params.keys.sort, (specimens_index_params.keys + ['include_trash']).sort
+
+    include_trash_param = coll_index_params['include_trash']
+    assert_equal 'boolean', include_trash_param['type']
+    assert_equal false, include_trash_param['required']
+    assert_equal 'query', include_trash_param['location']
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list