X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/18358de3cd35ef29e8826f45897a3373a79de291..dca6cfe9750d8d1be4f3b63895b8cb73cc6c4cfe:/services/api/app/controllers/arvados/v1/schema_controller.rb?ds=sidebyside diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb index 23706afeed..1db5eff259 100644 --- a/services/api/app/controllers/arvados/v1/schema_controller.rb +++ b/services/api/app/controllers/arvados/v1/schema_controller.rb @@ -1,29 +1,10 @@ class Arvados::V1::SchemaController < ApplicationController + skip_before_filter :find_objects_for_index skip_before_filter :find_object_by_uuid skip_before_filter :render_404_if_no_object - skip_before_filter :require_auth_scope_all + skip_before_filter :require_auth_scope - def show - classes = Rails.cache.fetch 'arvados_v1_schema' do - Rails.application.eager_load! - classes = {} - ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |k| - classes[k] = k.columns.collect do |col| - if k.serialized_attributes.has_key? col.name - { name: col.name, - type: k.serialized_attributes[col.name].object_class.to_s } - else - { name: col.name, - type: col.type } - end - end - end - classes - end - render json: classes - end - - def discovery_rest_description + def index expires_in 24.hours, public: true discovery = Rails.cache.fetch 'arvados_v1_rest_discovery' do Rails.application.eager_load! @@ -37,7 +18,7 @@ class Arvados::V1::SchemaController < ApplicationController generatedAt: Time.now.iso8601, title: "Arvados API", description: "The API to interact with Arvados.", - documentationLink: "https://redmine.clinicalfuture.com/projects/arvados/", + documentationLink: "http://doc.arvados.org/api/index.html", protocol: "rest", baseUrl: root_url + "/arvados/v1/", basePath: "/arvados/v1/", @@ -88,7 +69,13 @@ class Arvados::V1::SchemaController < ApplicationController schemas: {}, resources: {} } - + + if Rails.application.config.websocket_address + discovery[:websocketUrl] = Rails.application.config.websocket_address + elsif ENV['ARVADOS_WEBSOCKETS'] + discovery[:websocketUrl] = (root_url.sub /^http/, 'ws') + "/websocket" + end + ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |k| begin ctl_class = "Arvados::V1::#{k.to_s.pluralize}Controller".constantize @@ -194,7 +181,7 @@ class Arvados::V1::SchemaController < ApplicationController description: %|List #{k.to_s.pluralize}. - The list method returns a + The list method returns a resource list of matching #{k.to_s.pluralize}. For example: @@ -229,16 +216,31 @@ class Arvados::V1::SchemaController < ApplicationController format: "int32", minimum: 0, location: "query", + }, + filters: { + type: "array", + description: "Conditions for filtering #{k.to_s.underscore.pluralize}.", + location: "query" }, where: { type: "object", - description: "Conditions for filtering #{k.to_s.underscore.pluralize}.", + description: "Conditions for filtering #{k.to_s.underscore.pluralize}. (Deprecated. Use filters instead.)", location: "query" }, order: { type: "string", description: "Order in which to return matching #{k.to_s.underscore.pluralize}.", location: "query" + }, + select: { + type: "array", + description: "Select which fields to return", + location: "query" + }, + distinct: { + type: "boolean", + description: "Return each distinct object", + location: "query" } }, response: {