X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4ad0f6c37186b968c64d2256239ece6ee8da0a64..fb1d42add817ea57e391c9aeb8e6b9e4d35ad2fd:/app/controllers/orvos/v1/schema_controller.rb?ds=sidebyside diff --git a/app/controllers/orvos/v1/schema_controller.rb b/app/controllers/orvos/v1/schema_controller.rb index f8412ba8c3..166ab5fad0 100644 --- a/app/controllers/orvos/v1/schema_controller.rb +++ b/app/controllers/orvos/v1/schema_controller.rb @@ -87,6 +87,8 @@ class Orvos::V1::SchemaController < ApplicationController } ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |k| + next if k == ApiClientAuthorization + next if k == ApiClient object_properties = {} k.columns. select { |col| col.name != 'id' }. @@ -117,7 +119,10 @@ class Orvos::V1::SchemaController < ApplicationController }, items: { type: "array", - description: "The list of #{k.to_s.pluralize}." + description: "The list of #{k.to_s.pluralize}.", + items: { + "$ref" => k.to_s + } }, next_link: { type: "string", @@ -154,11 +159,11 @@ class Orvos::V1::SchemaController < ApplicationController id: "orvos.#{k.to_s.underscore.pluralize}.get", path: "#{k.to_s.underscore.pluralize}/{uuid}", httpMethod: "GET", - description: "Gets a #{k.to_s}'s metadata by ID.", + description: "Gets a #{k.to_s}'s metadata by UUID.", parameters: { uuid: { type: "string", - description: "The ID for the #{k.to_s} in question.", + description: "The UUID of the #{k.to_s} in question.", required: true, location: "path" } @@ -200,12 +205,84 @@ class Orvos::V1::SchemaController < ApplicationController } }, response: { - "$ref" => "#{k.to_s.pluralize}List" + "$ref" => "#{k.to_s}List" }, scopes: [ "https://api.clinicalfuture.com/auth/orvos", "https://api.clinicalfuture.com/auth/orvos.readonly" ] + }, + create: { + id: "orvos.#{k.to_s.underscore.pluralize}.create", + path: "#{k.to_s.underscore.pluralize}", + httpMethod: "POST", + description: "Create a new #{k.to_s}.", + parameters: { + k.to_s.underscore => { + type: "object", + required: true, + location: "query", + properties: object_properties + } + }, + request: { + "$ref" => k.to_s + }, + response: { + "$ref" => k.to_s + }, + scopes: [ + "https://api.clinicalfuture.com/auth/orvos" + ] + }, + update: { + id: "orvos.#{k.to_s.underscore.pluralize}.update", + path: "#{k.to_s.underscore.pluralize}/{uuid}", + httpMethod: "PUT", + description: "Update attributes of an existing #{k.to_s}.", + parameters: { + uuid: { + type: "string", + description: "The UUID of the #{k.to_s} in question.", + required: true, + location: "path" + }, + k.to_s.underscore => { + type: "object", + required: true, + location: "query", + properties: object_properties + } + }, + request: { + "$ref" => k.to_s + }, + response: { + "$ref" => k.to_s + }, + scopes: [ + "https://api.clinicalfuture.com/auth/orvos" + ] + }, + delete: { + id: "orvos.#{k.to_s.underscore.pluralize}.delete", + path: "#{k.to_s.underscore.pluralize}/{uuid}", + httpMethod: "DELETE", + description: "Delete an existing #{k.to_s}.", + parameters: { + uuid: { + type: "string", + description: "The UUID of the #{k.to_s} in question.", + required: true, + location: "path" + } + }, + response: { + "$ref" => k.to_s + }, + scopes: [ + "https://api.clinicalfuture.com/auth/orvos" + ] } } }