diff --git a/.gitignore b/.gitignore index e47af66..04da35e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ template/Gemfile.lock grape-starter.md tmp api/ +.vscode diff --git a/.rubocop.yml b/.rubocop.yml index c587b5d..3c34135 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,6 +26,9 @@ Layout/IndentationWidth: Layout/LineLength: Max: 120 +Lint/MissingSuper: + Enabled: false + Metrics/BlockLength: Exclude: - 'spec/**/*' @@ -33,6 +36,9 @@ Metrics/BlockLength: Metrics/AbcSize: Max: 20 +Metrics/ClassLength: + Max: 120 + Metrics/MethodLength: Max: 20 diff --git a/lib/starter/importer/namespace.rb b/lib/starter/importer/namespace.rb index 2f92593..4733f85 100644 --- a/lib/starter/importer/namespace.rb +++ b/lib/starter/importer/namespace.rb @@ -30,7 +30,7 @@ class #{@naming.klass_name} < Grape::API private def namespace - naming.version_klass ? "'#{naming.origin}'" : ":#{naming.resource.downcase}" + @namespace ||= naming.version_klass ? "'#{naming.origin}'" : ":#{naming.resource.downcase}" end def endpoints diff --git a/lib/starter/importer/nested_params.rb b/lib/starter/importer/nested_params.rb new file mode 100644 index 0000000..17ec5dc --- /dev/null +++ b/lib/starter/importer/nested_params.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: false + +module Starter + module Importer + class NestedParams < Parameter + def initialize(name:, definition:) + @name = name + @definition = definition + end + end + end +end diff --git a/lib/starter/importer/parameter.rb b/lib/starter/importer/parameter.rb index c7a4e61..472dd8d 100644 --- a/lib/starter/importer/parameter.rb +++ b/lib/starter/importer/parameter.rb @@ -1,3 +1,4 @@ +# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity # frozen_string_literal: false module Starter @@ -5,34 +6,50 @@ module Importer class Parameter class Error < StandardError; end - attr_accessor :kind, :name, :definition + attr_accessor :kind, :name, :definition, :nested def initialize(definition:, components: {}) + @nested = [] @kind = validate_parameters(definition:, components:) prepare_attributes(definition:, components:) end def to_s + # TODO: handle object/arrays and its properties + return serialized_object if nested.present? + + type = definition['type'] || definition['schema']['type'] + type.scan(/\w+/).each { |x| type.match?('JSON') ? type : type.sub!(x, x.capitalize) } + + if type == 'Array' && definition.key?('items') + sub = definition.dig('items', 'type').to_s.capitalize + type = "#{type}[#{sub}]" + end + entry = definition['required'] ? 'requires' : 'optional' entry << " :#{name}" - entry << ", type: #{definition['schema']['type'].capitalize}" - + entry << ", type: #{type}" doc = documentation entry << ", #{doc}" if doc entry + rescue StandardError => e + print e end private + # initialize helper + # def validate_parameters(definition:, components:) return :direct if definition.key?('name') return :ref if definition.key?('$ref') && components.key?('parameters') + return :body if definition.key?('content') raise Error, 'no valid combination given' end - def prepare_attributes(definition:, components:) + def prepare_attributes(definition:, components:) # rubocop:disable Metrics/MethodLength case kind when :direct @name = definition['name'] @@ -45,7 +62,68 @@ def prepare_attributes(definition:, components:) if (value = @definition.dig('schema', '$ref').presence) @definition['schema'] = components.dig(*value.split('/')[2..]) end + when :body + definition['in'] = 'body' + schema = definition['content'].values.first['schema'] + if schema.key?('$ref') + path = schema['$ref'].split('/')[2..] + + @name, @definition = handle_body(definition:, properties: components.dig(*path)) + @name ||= path.last + else + @name, @definition = handle_body(definition:, properties: schema) + end + end + end + + def handle_body(definition:, properties:) + if object?(definition:, properties:) # a nested object -> JSON + definition['type'] = properties['type'].presence || 'JSON' + return [nil, definition] if properties.nil? || properties['properties'].nil? + + properties['properties'].each do |name, definition| + definition['required'] = properties['required']&.include?(name) || false + @nested << NestedParams.new(name:, definition:) + end + + [nil, definition] + elsif simple_array?(properties:) + name = properties['properties'].keys.first + type = properties.dig('properties', name, 'type') || 'array' + subtype = properties.dig('properties', name, 'items', 'type') + definition['type'] = subtype.nil? ? type : "#{type}[#{subtype}]" + + [name, definition] + else # others + [nil, definition.merge(properties)] + end + end + + # handle_body helper, check/find/define types + # + def object?(definition:, properties:) + definition['content'].keys.first.include?('application/json') || + properties['type'] == 'object' + end + + def simple_array?(properties:) + properties.key?('properties') && + properties['properties'].length == 1 && + properties['properties'].values.first['type'] == 'array' + end + + # to_s helper + # + def serialized_object + definition.tap do |foo| + foo['type'] = foo['type'] == 'object' ? 'JSON' : foo['type'] end + + parent = NestedParams.new(name: name, definition: definition) + + entry = "#{parent} do\n" + nested.each { |n| entry << " #{n}\n" } + entry << ' end' end def documentation @@ -68,3 +146,5 @@ def documentation end end end + +# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity diff --git a/lib/starter/importer/specification.rb b/lib/starter/importer/specification.rb index 87fd8d5..ad56211 100644 --- a/lib/starter/importer/specification.rb +++ b/lib/starter/importer/specification.rb @@ -47,7 +47,7 @@ def segmentize(path) [rest.shift, rest.empty? ? '/' : "/#{rest.join('/')}"] end - def prepare_verbs(spec) + def prepare_verbs(spec) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity path_params = nil spec.each_with_object({}) do |(verb, content), memo| if verb == 'parameters' @@ -56,9 +56,9 @@ def prepare_verbs(spec) end memo[verb] = content - next unless content.key?('parameters') || path_params + next unless content.key?('parameters') || content.key?('requestBody') || path_params - parameters = content['parameters'] || path_params + parameters = ((content['parameters'] || path_params || []) + [content['requestBody']]).compact memo[verb]['parameters'] = parameters.each_with_object({}) do |definition, para| parameter = Parameter.new(definition:, components:) diff --git a/spec/fixtures/pmm.json b/spec/fixtures/pmm.json new file mode 100644 index 0000000..75b8603 --- /dev/null +++ b/spec/fixtures/pmm.json @@ -0,0 +1,4086 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "PMM", + "description": "Provides accesses to PMM", + "contact": { + "name": "Peter Scholz", + "email": "le-fnord@outlook.de" + }, + "version": "0.2.0" + }, + "servers": [ + { + "url": "//localhost:3000/" + } + ], + "tags": [ + { + "name": "Reporting", + "description": "Operations about Reportings" + }, + { + "name": "Predictions", + "description": "Operations about Predictions" + }, + { + "name": "PredictionWorkspace", + "description": "Operations about PredictionWorkspaces" + }, + { + "name": "Calibrations", + "description": "Operations about Calibrations" + }, + { + "name": "CalibrationWorkspace", + "description": "Operations about CalibrationWorkspaces" + }, + { + "name": "Galaxy", + "description": "Operations about Galaxies" + }, + { + "name": "MarkerData", + "description": "Operations about MarkerData" + }, + { + "name": "Importer", + "description": "Operations about Importers" + }, + { + "name": "Carts", + "description": "Operations about Carts" + }, + { + "name": "Health", + "description": "Operations about Healths" + }, + { + "name": "MessageRecipients", + "description": "Operations about MessageRecipients" + }, + { + "name": "Owners", + "description": "Operations about Owners" + }, + { + "name": "Ownership", + "description": "Operations about Ownerships" + } + ], + "paths": { + "/api/v1/reporting/stats": { + "get": { + "tags": [ + "Reporting" + ], + "summary": "Statistics", + "description": "GET request, to get some statistics about your Predictions and Calibrations", + "operationId": "getApiV1ReportingStats", + "responses": { + "200": { + "description": "Statistics", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Statistics" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions": { + "delete": { + "tags": [ + "Predictions" + ], + "summary": "Delete Prediction(s)", + "description": "DELETE request, to delete Prediction(s) identified by ID(s)", + "operationId": "deleteApiV1Predictions", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "items deleted", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/csvexport": { + "get": { + "tags": [ + "Predictions" + ], + "summary": "Export Predictions as CSV", + "description": "Get request, to export predictions as CSV", + "operationId": "getApiV1PredictionsCsvexport", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Export Predictions as CSV", + "content": { + "text/csv": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "text/csv": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/filter": { + "post": { + "tags": [ + "Predictions" + ], + "summary": "Filter Predictions", + "description": "Get request, to filter predictions", + "operationId": "postApiV1PredictionsFilter", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1PredictionsFilter" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "standard response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Prediction" + } + } + } + } + }, + "206": { + "description": "paged response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PagedPredictions" + } + } + } + } + }, + "400": { + "description": "Items count exceeded!", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1PredictionsFilter" + } + }, + "/api/v1/predictions/search-values": { + "get": { + "tags": [ + "Predictions" + ], + "summary": "Search Values", + "description": "GET request, to get all Attribute-Values for whicht the User is authorized.", + "operationId": "getApiV1PredictionsSearchValues", + "responses": { + "200": { + "description": "Search Values", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_AttributeValues" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/creating": { + "post": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Creating Prediction", + "description": "POST request, to create a Prediction", + "operationId": "postApiV1PredictionsCreating", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1PredictionsCreating" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Prediction created ... 👐", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "400": { + "description": "Validation Eror", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1PredictionsCreating" + } + }, + "/api/v1/predictions/workspace-search-values": { + "get": { + "tags": [ + "Predictions" + ], + "summary": "Workspace Search Values", + "description": "GET request, to get all Attribute-Values for whicht the User is authorized.", + "operationId": "getApiV1PredictionsWorkspaceSearchValues", + "responses": { + "200": { + "description": "Workspace Search Values", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_AttributeValues" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/workspace": { + "post": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Workspace for Predictions", + "description": "POST request, to get your Prediction Workspace", + "operationId": "postApiV1PredictionsWorkspace", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1PredictionsWorkspace" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "get all Predictions to work on ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1PredictionsWorkspace" + } + }, + "/api/v1/predictions/{id}/files": { + "get": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Get a List of prediction files", + "description": "GET request, to list all files associated with the prediction", + "operationId": "getApiV1PredictionsIdFiles", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Get a List of prediction files", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_File" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/reconfiguring": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Reconfigure finished workflow", + "description": "PUT request, to reconfigure the finished workflow", + "operationId": "putApiV1PredictionsIdReconfiguring", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Workflow moved to created state to be reconfiguration... 👍", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/unapproving": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Unapprove", + "description": "PUT request, to unapprove a approved a prediction", + "operationId": "putApiV1PredictionsIdUnapproving", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Prediction unapproved ... 👎", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/approving": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Approve", + "description": "PUT request, to approve a prediction", + "operationId": "putApiV1PredictionsIdApproving", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Prediction approved ... 👌", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/starting": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Starting Workflow", + "description": "PUT request, to start the GLX workflow", + "operationId": "putApiV1PredictionsIdStarting", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "202": { + "description": "GLX Workflow started ... 👍", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/workflow/parameters": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Set Workflow Parameters", + "description": "PUT request, to set Workflow Parameters.", + "operationId": "putApiV1PredictionsIdWorkflowParameters", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/putApiV1PredictionsIdWorkflowParameters" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Workflow Parameter set ... 👌", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "putApiV1PredictionsIdWorkflowParameters" + } + }, + "/api/v1/predictions/{id}/check-compare": { + "get": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Check for finished comparation of markers", + "description": "GET request to check for finished comparation, returns 204 if comparation is still in progress", + "operationId": "getApiV1PredictionsIdCheckCompare", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "Check for finished comparation of markers", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/compare": { + "get": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Comparing Markers", + "description": "GET request, to compare Markers", + "operationId": "getApiV1PredictionsIdCompare", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Markers compared ... 🤲", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/predictions/{id}/genotypes": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Assign Genotypelist", + "description": "PUT request, to assign a Genotypelist", + "operationId": "putApiV1PredictionsIdGenotypes", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/putApiV1PredictionsIdGenotypes" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Genotypelist assigned ... 🤝", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "putApiV1PredictionsIdGenotypes" + } + }, + "/api/v1/predictions/{id}/calibrations": { + "put": { + "tags": [ + "PredictionWorkspace" + ], + "summary": "Assign Calibrations", + "description": "PUT request, to assign Calibrations", + "operationId": "putApiV1PredictionsIdCalibrations", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Prediction ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "description": "The Calibration IDs to assign to.", + "items": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Calibration(s) assigned ... 👏", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_PredictionWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations": { + "delete": { + "tags": [ + "Calibrations" + ], + "summary": "Delete Calibration(s)", + "description": "DELETE request, to delete Calibration(s) identified by ID(s)", + "operationId": "deleteApiV1Calibrations", + "parameters": [ + { + "name": "ids", + "in": "query", + "required": true, + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + } + ], + "responses": { + "204": { + "description": "items deleted", + "content": {} + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations/csvexport": { + "get": { + "tags": [ + "Calibrations" + ], + "summary": "Export Calibrations as CSV", + "description": "Get request, to export calibrationss as CSV", + "operationId": "getApiV1CalibrationsCsvexport", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Export Calibrations as CSV", + "content": { + "text/csv": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "text/csv": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations/filter": { + "post": { + "tags": [ + "Calibrations" + ], + "summary": "Filter Calibrations", + "description": "GET request, to filter calibrations", + "operationId": "postApiV1CalibrationsFilter", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1CalibrationsFilter" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "short response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CalibrationShort" + } + } + } + } + }, + "202": { + "description": "long response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Calibration" + } + } + } + } + }, + "206": { + "description": "paged response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PagedCalibrations" + } + } + } + } + }, + "400": { + "description": "Items count exceeded!", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1CalibrationsFilter" + } + }, + "/api/v1/calibrations/search-values": { + "get": { + "tags": [ + "Calibrations" + ], + "summary": "Search Values", + "description": "GET request, to get all available values for all attributes you can searching for", + "operationId": "getApiV1CalibrationsSearchValues", + "parameters": [ + { + "name": "crop", + "in": "query", + "description": "Get Search Values for specific Crop.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Search Values", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_AttributeValues" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations/creating": { + "post": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Creating Calibration", + "description": "POST request, to create a Calibration", + "operationId": "postApiV1CalibrationsCreating", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1CalibrationsCreating" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Calibration edited ... 👐", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + }, + "201": { + "description": "Calibration created ... 👐", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + }, + "400": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1CalibrationsCreating" + } + }, + "/api/v1/calibrations/workspace-search-values": { + "get": { + "tags": [ + "Calibrations" + ], + "summary": "Workspace Search Values", + "description": "GET request, to get all Attribute-Values for which the User is authorized.", + "operationId": "getApiV1CalibrationsWorkspaceSearchValues", + "responses": { + "200": { + "description": "Workspace Search Values", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_AttributeValues" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations/workspace": { + "post": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Workspace for Calibrations", + "description": "POST request, to get your Calibration Workspace", + "operationId": "postApiV1CalibrationsWorkspace", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1CalibrationsWorkspace" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Workspace for Calibrations", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1CalibrationsWorkspace" + } + }, + "/api/v1/calibrations/{id}/reconfiguring": { + "put": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Reconfigure finished workflow", + "description": "PUT request, to reconfigure the finished workflow", + "operationId": "putApiV1CalibrationsIdReconfiguring", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Calibration ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "Workflow moved to created state to be reconfiguration... 👍", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/calibrations/{id}/starting": { + "put": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Starting Workflow", + "description": "PUT request, to start the GLX workflow", + "operationId": "putApiV1CalibrationsIdStarting", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Calibration ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "202": { + "description": "GLX Workflow started ... 👍", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + } + } + } + }, + "/api/v1/calibrations/{id}/phenotypes": { + "put": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Add Phenotypes", + "description": "PUT request, to upload the phenotype file.", + "operationId": "putApiV1CalibrationsIdPhenotypes", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Calibration ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "phenotype_file" + ], + "properties": { + "phenotype_file": { + "type": "string", + "description": "The phenotypes file.", + "format": "binary" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Phenotype File uploaded ... 👌", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": {} + } + } + } + }, + "/api/v1/calibrations/{id}/workflow/files": { + "post": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Add additional files", + "description": "Post request, to upload additional files used by the workflow", + "operationId": "postApiV1CalibrationsIdWorkflowFiles", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Calibration ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "file", + "key" + ], + "properties": { + "key": { + "type": "string", + "description": "The Key, set as name, to find the file later." + }, + "file": { + "type": "string", + "description": "An additional File.", + "format": "binary" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Additional File uploaded ... 👌", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": {} + } + } + } + }, + "/api/v1/calibrations/{id}/workflow/parameters": { + "put": { + "tags": [ + "CalibrationWorkspace" + ], + "summary": "Set Workflow Parameters", + "description": "PUT request, to set Workflow Parameters.", + "operationId": "putApiV1CalibrationsIdWorkflowParameters", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Calibration ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/putApiV1CalibrationsIdWorkflowParameters" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Workflow Parameter set ... 👌", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CalibrationWorkspace" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "putApiV1CalibrationsIdWorkflowParameters" + } + }, + "/api/v1/calibrations/{uuid}": { + "get": { + "tags": [ + "Calibrations" + ], + "summary": "Edit Calibration", + "description": "GET request, to get attributes of Calibration for editing", + "operationId": "getApiV1CalibrationsUuid", + "parameters": [ + { + "name": "uuid", + "in": "path", + "description": "The Calibration UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Edit Calibration", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Parameters" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + }, + "put": { + "tags": [ + "Calibrations" + ], + "summary": "Update Calibration", + "description": "PUT request, to update Calibration", + "operationId": "putApiV1CalibrationsUuid", + "parameters": [ + { + "name": "uuid", + "in": "path", + "description": "The Calibration UUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/putApiV1CalibrationsUuid" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "Calibration updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "putApiV1CalibrationsUuid" + } + }, + "/api/v1/galaxy/workflows/{workflow_id}/parameters/{kind}/{uuid}": { + "get": { + "tags": [ + "Galaxy" + ], + "summary": "Workflow Parameters", + "description": "GET request, to get parameter for a specific workflow", + "operationId": "getApiV1GalaxyWorkflowsWorkflowIdParametersKindUuid", + "parameters": [ + { + "name": "workflow_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "kind", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "prediction", + "calibration" + ] + } + }, + { + "name": "uuid", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "UUID" + } + } + ], + "responses": { + "200": { + "description": "Workflow Parameters", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Parameters" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/galaxy/workflows/{kind}/{crop}": { + "get": { + "tags": [ + "Galaxy" + ], + "summary": "Workflows", + "description": "GET request, to get all Workflows, also shared one", + "operationId": "getApiV1GalaxyWorkflowsKindCrop", + "parameters": [ + { + "name": "kind", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "prediction", + "calibration" + ] + } + }, + { + "name": "crop", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Workflows", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Workflows" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/marker_db/genotypesets": { + "get": { + "tags": [ + "MarkerData" + ], + "summary": "Get Genotypeset", + "description": "GET request, to get GenotypeLists from MarkerDB", + "operationId": "getApiV1MarkerDbGenotypesets", + "parameters": [ + { + "name": "crop", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Get Genotypeset", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GenotypeShort" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/marker_db/crops": { + "get": { + "tags": [ + "MarkerData" + ], + "summary": "Get available Crops", + "description": "GET request, to get all availabel Crops", + "operationId": "getApiV1MarkerDbCrops", + "responses": { + "200": { + "description": "Get available Crops", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_List" + }, + "example": { + "list": [ + "MA", + "ZR" + ] + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/import/predictions": { + "post": { + "tags": [ + "Importer" + ], + "summary": "Import Predictions", + "description": "POST request, to import Predictions", + "operationId": "postApiV1ImportPredictions", + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "file" + ], + "properties": { + "file": { + "type": "string", + "format": "binary" + } + } + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Import Predictions", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "deprecated": true + } + }, + "/api/v1/import/calibrations": { + "post": { + "tags": [ + "Importer" + ], + "summary": "Import Calibrations", + "description": "POST request, to import Calibrations", + "operationId": "postApiV1ImportCalibrations", + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "file" + ], + "properties": { + "file": { + "type": "string", + "format": "binary" + } + } + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Import Calibrations", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Information" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/import/listing": { + "post": { + "tags": [ + "Importer" + ], + "summary": "Import Listing", + "description": "POST request, to import Lists for Markers, Phenotypes and Genotypes", + "operationId": "postApiV1ImportListing", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1ImportListing" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Import Listing", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenotypeShort" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1ImportListing" + } + }, + "/api/v1/carts/create": { + "post": { + "tags": [ + "Carts" + ], + "summary": "Crate new cart", + "description": "POST request, to create a new cart", + "operationId": "postApiV1CartsCreate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1CartsCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "cart craeted", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1CartsCreate" + } + }, + "/api/v1/carts/{crop}": { + "get": { + "tags": [ + "Carts" + ], + "summary": "Getting accessible carts for a crop", + "description": "GET request, to get carts for a crop", + "operationId": "getApiV1CartsCrop", + "parameters": [ + { + "name": "crop", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "get all carts for a crop ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Cart" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/carts": { + "get": { + "tags": [ + "Carts" + ], + "summary": "Getting accessible carts", + "description": "GET request, to get all carts a user can see", + "operationId": "getApiV1Carts", + "responses": { + "200": { + "description": "get all carts ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Cart" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/carts/{id}": { + "put": { + "tags": [ + "Carts" + ], + "summary": "Update cart", + "description": "PUT request, to update a cart", + "operationId": "putApiV1CartsId", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Cart ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/putApiV1CartsId" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Cart updated", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "putApiV1CartsId" + }, + "delete": { + "tags": [ + "Carts" + ], + "summary": "Remove cart", + "description": "DELETE request, to remove a cart", + "operationId": "deleteApiV1CartsId", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Cart ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "items deleted", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/carts/{id}/{calibration_id}": { + "delete": { + "tags": [ + "Carts" + ], + "summary": "Remove calibration from Cart", + "description": "DELETE request, to remove calibration from a cart", + "operationId": "deleteApiV1CartsIdCalibrationId", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The Cart ID", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "calibration_id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "items deleted", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/health": { + "get": { + "tags": [ + "Health" + ], + "summary": "Serve Health information", + "description": "Get request, to check for application health", + "operationId": "getApiV1Health", + "responses": { + "200": { + "description": "Serve Health information", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Health" + } + } + } + } + } + } + }, + "/api/v1/message_recipients/{id}": { + "put": { + "tags": [ + "MessageRecipients" + ], + "summary": "Change Message Recipients Crops", + "description": "PUT request, to change crops of recipient", + "operationId": "putApiV1MessageRecipientsId", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "crops" + ], + "properties": { + "crops": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "crops changed", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Owner" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + }, + "delete": { + "tags": [ + "MessageRecipients" + ], + "summary": "Remove Message Recipient", + "description": "DELETE request, to remove a new recipient", + "operationId": "deleteApiV1MessageRecipientsId", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "204": { + "description": "items deleted", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/message_recipients/create": { + "post": { + "tags": [ + "MessageRecipients" + ], + "summary": "Create Message Recipient", + "description": "POST request, to create a new recipient", + "operationId": "postApiV1MessageRecipientsCreate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1MessageRecipientsCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Recipient created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Owner" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1MessageRecipientsCreate" + } + }, + "/api/v1/message_recipients/send": { + "post": { + "tags": [ + "MessageRecipients" + ], + "summary": "Send Message to Recipients", + "description": "POST request, to send a notification to the given recipients", + "operationId": "postApiV1MessageRecipientsSend", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postApiV1MessageRecipientsSend" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "all recipients notified", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "postApiV1MessageRecipientsSend" + } + }, + "/api/v1/message_recipients/{crop}": { + "get": { + "tags": [ + "MessageRecipients" + ], + "summary": "Getting Message Recipients for a crop", + "description": "GET request, to get all message recipients", + "operationId": "getApiV1MessageRecipientsCrop", + "parameters": [ + { + "name": "crop", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "get all message recipients ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Owner" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/message_recipients": { + "get": { + "tags": [ + "MessageRecipients" + ], + "summary": "Getting Message Recipients", + "description": "GET request, to get all message recipients", + "operationId": "getApiV1MessageRecipients", + "responses": { + "200": { + "description": "get all message recipients ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Owner" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/owners/{id}": { + "patch": { + "tags": [ + "Owners" + ], + "summary": "Change Role or Crops", + "description": "PATCH request, to change role of Owner and assign crops", + "operationId": "patchApiV1OwnersId", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "the ID of the Owner to change", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "properties": { + "role": { + "type": "string" + }, + "crops": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Owner updated", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/owners/roles": { + "get": { + "tags": [ + "Owners" + ], + "summary": "List all Roles", + "description": "GET request, to get all roles as Array[Strings]", + "operationId": "getApiV1OwnersRoles", + "responses": { + "200": { + "description": "List all Roles", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_List" + }, + "example": { + "list": [ + "operator", + "dau" + ] + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/owners": { + "get": { + "tags": [ + "Owners" + ], + "summary": "Lists all Owners", + "description": "GET request, to get all Owners as Array[Objects]", + "operationId": "getApiV1Owners", + "responses": { + "200": { + "description": "found Owners", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V1_Entities_Owner" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/owners/apps": { + "get": { + "tags": [ + "Owners" + ], + "summary": "Getting Applications", + "description": "GET request, to get your Applications", + "operationId": "getApiV1OwnersApps", + "responses": { + "200": { + "description": "get all Applications ... 🗂", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Application" + } + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + }, + "post": { + "tags": [ + "Owners" + ], + "summary": "Creating Application", + "description": "POST request, to create an Application for the Owner", + "operationId": "postApiV1OwnersApps", + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The Name of it." + } + } + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Application created ... 👍", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Application" + } + } + } + }, + "400": { + "description": "Validation Eror", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/owners/apps/{app_key}": { + "delete": { + "tags": [ + "Owners" + ], + "summary": "Deleting Application", + "description": "DLETE request, to delete an Application", + "operationId": "deleteApiV1OwnersAppsAppKey", + "parameters": [ + { + "name": "app_key", + "in": "path", + "description": "The App Key of it.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "204": { + "description": "Deleting Application", + "content": {} + }, + "400": { + "description": "Validation Eror", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + } + } + }, + "/api/v1/ownership/change": { + "patch": { + "tags": [ + "Ownership" + ], + "summary": "Change Ownership of requested Subject", + "description": "PATCH request, to change Ownership of requested Subject", + "operationId": "patchApiV1OwnershipChange", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/patchApiV1OwnershipChange" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Ownership changed", + "content": {} + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V1_Entities_Message" + } + } + } + } + }, + "x-codegen-request-body-name": "patchApiV1OwnershipChange" + } + } + }, + "components": { + "schemas": { + "V1_Entities_Statistics": { + "type": "object", + "properties": { + "predictions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "count": { + "type": "integer", + "format": "int32" + } + } + } + }, + "calibrations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "count": { + "type": "integer", + "format": "int32" + } + } + } + } + }, + "description": "V1_Entities_Statistics model" + }, + "V1_Entities_Message": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "description": "V1_Entities_Message model" + }, + "postApiV1PredictionsFilter": { + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "Which page should be shown.
If nothings given, all will be responded.", + "format": "int32" + }, + "search": { + "type": "string", + "description": "Search free text on different attributes." + }, + "sort": { + "type": "object", + "properties": { + "attribute": { + "type": "string" + }, + "dir": { + "type": "string" + } + }, + "description": "Sort by provided attribute and given direction." + } + }, + "description": "Filter Predictions" + }, + "V1_Entities_Prediction": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "uuid": { + "type": "string", + "format": "UUID" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string" + }, + "crop": { + "type": "string" + }, + "trait": { + "type": "string" + }, + "created_by": { + "type": "string", + "format": "Email" + }, + "created_at": { + "type": "string", + "format": "DateTime" + }, + "comment": { + "type": "string" + }, + "history_id": { + "type": "integer", + "format": "int32" + }, + "path": { + "type": "string" + }, + "can_be_deleted": { + "type": "boolean" + }, + "updated_by": { + "type": "string", + "format": "Email" + }, + "approved": { + "type": "boolean" + }, + "workflow": { + "$ref": "#/components/schemas/Workflow" + } + }, + "description": "V1_Entities_Prediction model" + }, + "Workflow": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Name of it." + }, + "href": { + "type": "string", + "description": "Link to GLX.", + "format": "URL" + }, + "state": { + "type": "string", + "description": "The Final workflow state" + }, + "errors": { + "type": "string", + "description": "Error message(s) if something bad happened." + } + } + }, + "PagedPredictions": { + "type": "object", + "properties": { + "pages": { + "type": "integer", + "description": "Page count of result.", + "format": "int32" + }, + "items": { + "type": "array", + "description": "The result array for Predictions.", + "items": { + "$ref": "#/components/schemas/V1_Entities_Prediction" + } + } + }, + "description": "PagedPredictions model" + }, + "V1_Entities_AttributeValues": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "values": { + "type": "array" + }, + "value": { + "type": "boolean" + } + }, + "description": "V1_Entities_AttributeValues model" + }, + "postApiV1PredictionsCreating": { + "required": [ + "crop", + "name" + ], + "type": "object", + "properties": { + "crop": { + "type": "string", + "description": "The Crop of it." + }, + "name": { + "type": "string", + "description": "The Name of it." + }, + "comment": { + "type": "string", + "description": "The Comment of it." + }, + "pools": { + "type": "array", + "description": "The pool(s) of it.", + "items": { + "type": "string" + } + }, + "material_level": { + "type": "array", + "description": "The material level(s) of it.", + "items": { + "type": "string" + } + }, + "material_groups": { + "type": "array", + "description": "The material group(s) of it.", + "items": { + "type": "string" + } + }, + "id": { + "type": "integer", + "description": "The ID of it (possible on back step, so editing is possible).", + "format": "int32" + } + }, + "description": "Creating Prediction" + }, + "V1_Entities_PredictionWorkspace": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "uuid": { + "type": "string", + "format": "UUID" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string" + }, + "crop": { + "type": "string" + }, + "trait": { + "type": "string" + }, + "created_by": { + "type": "string", + "format": "Email" + }, + "created_at": { + "type": "string", + "format": "DateTime" + }, + "comment": { + "type": "string" + }, + "material_groups": { + "type": "array", + "items": { + "type": "string" + } + }, + "material_level": { + "type": "array", + "items": { + "type": "string" + } + }, + "pools": { + "type": "array", + "items": { + "type": "string" + } + }, + "genotype_list": { + "$ref": "#/components/schemas/GenotypeShort" + }, + "calibrations": { + "type": "array", + "description": "The assigned Calibrations.", + "items": { + "$ref": "#/components/schemas/CalibrationShort" + } + }, + "result": { + "type": "object", + "properties": { + "genotypes": { + "type": "array", + "description": "Compared Genotypes", + "items": { + "$ref": "#/components/schemas/ComparingGenotypeResult" + } + }, + "markers": { + "type": "array", + "description": "Array of Calibration comparing result.", + "items": { + "$ref": "#/components/schemas/ComparingMarkerResult" + } + } + }, + "description": "The Marker Comparision results." + } + }, + "description": "V1_Entities_PredictionWorkspace model" + }, + "GenotypeShort": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string", + "description": "The Name of it." + }, + "mdb": { + "type": "boolean", + "description": "The Source Indicator: `true` -> it comes from MarkerDB." + }, + "count": { + "type": "integer", + "description": "Number of user provided genotypes", + "format": "int32" + } + }, + "description": "GenotypeShort model" + }, + "CalibrationShort": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "uuid": { + "type": "string", + "format": "UUID" + }, + "name": { + "type": "string" + }, + "crop": { + "type": "string" + }, + "trait": { + "type": "string" + }, + "kind": { + "type": "string" + } + }, + "description": "CalibrationShort model" + }, + "ComparingGenotypeResult": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int32" + }, + "in_mdb": { + "type": "integer", + "format": "int32" + } + } + }, + "ComparingMarkerResult": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int32" + }, + "overlap": { + "type": "integer", + "format": "int32" + }, + "rerun": { + "type": "boolean" + } + } + }, + "postApiV1PredictionsWorkspace": { + "type": "object", + "description": "Workspace for Predictions" + }, + "V1_Entities_File": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the file." + } + }, + "description": "V1_Entities_File model" + }, + "putApiV1PredictionsIdWorkflowParameters": { + "required": [ + "workflow" + ], + "type": "object", + "properties": { + "workflow": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The workflow ID." + }, + "name": { + "type": "string", + "description": "The workflow Name." + } + }, + "description": "besides documented and required parameters,\n it is possible to submit additional one, depends on choosen workflow" + } + }, + "description": "Set Workflow Parameters" + }, + "putApiV1PredictionsIdGenotypes": { + "required": [ + "list" + ], + "type": "object", + "properties": { + "list": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The Genotypelist ID to assign to.", + "format": "int32" + }, + "mdb": { + "type": "boolean", + "description": "Comes the List from Marker DB?", + "default": false + } + } + } + }, + "description": "Assign Genotypelist" + }, + "postApiV1CalibrationsFilter": { + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "Which page should be shown.
If nothings given, all will be responded.", + "format": "int32" + }, + "short": { + "type": "boolean", + "description": "Indicates if short or long entities should be responded" + }, + "search": { + "type": "string", + "description": "Search free text on different attributes." + }, + "sort": { + "type": "object", + "properties": { + "attribute": { + "type": "string" + }, + "dir": { + "type": "string" + } + }, + "description": "Sort by provided attribute and given direction." + }, + "ids": { + "type": "array", + "description": "Get Calibrations by id", + "items": { + "type": "integer", + "format": "int32" + } + } + }, + "description": "Filter Calibrations" + }, + "Calibration": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "uuid": { + "type": "string", + "format": "UUID" + }, + "name": { + "type": "string" + }, + "crop": { + "type": "string" + }, + "trait": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "status": { + "type": "string" + }, + "history_id": { + "type": "integer", + "format": "int32" + }, + "method": { + "type": "string" + }, + "path": { + "type": "string" + }, + "can_be_deleted": { + "type": "boolean" + }, + "updated_by": { + "type": "string", + "format": "Email" + }, + "created_by": { + "type": "string", + "format": "Email" + }, + "created_at": { + "type": "string", + "format": "DateTime" + }, + "glx_created_at": { + "type": "string", + "format": "DateTime" + } + }, + "description": "Calibration model" + }, + "PagedCalibrations": { + "type": "object", + "properties": { + "pages": { + "type": "integer", + "description": "Page count of result.", + "format": "int32" + }, + "items": { + "type": "array", + "description": "The result array for Calibrations.", + "items": { + "$ref": "#/components/schemas/Calibration" + } + } + }, + "description": "PagedCalibrations model" + }, + "postApiV1CalibrationsCreating": { + "required": [ + "crop", + "name" + ], + "type": "object", + "properties": { + "crop": { + "type": "string", + "description": "The Crop of it." + }, + "name": { + "type": "string", + "description": "The Name of it." + }, + "projects": { + "type": "array", + "description": "The project(s) of it.", + "items": { + "type": "string" + } + }, + "pools": { + "type": "array", + "description": "The pool(s) of it.", + "items": { + "type": "string" + } + }, + "material_level": { + "type": "array", + "description": "The material level(s) of it.", + "items": { + "type": "string" + } + }, + "material_groups": { + "type": "array", + "description": "The material group(s) of it.", + "items": { + "type": "string" + } + }, + "path": { + "type": "string", + "description": "The path of it." + }, + "testers": { + "type": "array", + "description": "The tester(s) of it.", + "items": { + "type": "string" + } + }, + "locations": { + "type": "array", + "description": "The location(s) of it.", + "items": { + "type": "string" + } + }, + "years": { + "type": "array", + "description": "The year(s) of it.", + "items": { + "type": "integer", + "format": "int32" + } + }, + "tags": { + "type": "array", + "description": "The tag(s) of it.", + "items": { + "type": "string" + } + }, + "treatments": { + "type": "array", + "description": "The treatment(s) of it.", + "items": { + "type": "string" + } + }, + "id": { + "type": "integer", + "description": "The ID of it (possible on back step, so editing is possible).", + "format": "int32" + } + }, + "description": "Creating Calibration" + }, + "CalibrationWorkspace": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "uuid": { + "type": "string", + "format": "UUID" + }, + "name": { + "type": "string" + }, + "crop": { + "type": "string" + }, + "trait": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "treatments": { + "type": "array", + "items": { + "type": "string" + } + }, + "status": { + "type": "string" + }, + "path": { + "type": "string" + }, + "locations": { + "type": "array", + "items": { + "type": "string" + } + }, + "material_groups": { + "type": "array", + "items": { + "type": "string" + } + }, + "material_level": { + "type": "array", + "items": { + "type": "string" + } + }, + "pools": { + "type": "array", + "items": { + "type": "string" + } + }, + "projects": { + "type": "array", + "items": { + "type": "string" + } + }, + "testers": { + "type": "array", + "items": { + "type": "string" + } + }, + "years": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "workflow": { + "type": "object", + "properties": {} + }, + "created_at": { + "type": "string", + "format": "DateTime" + }, + "created_by": { + "type": "string", + "format": "Email" + } + }, + "description": "CalibrationWorkspace model" + }, + "postApiV1CalibrationsWorkspace": { + "type": "object", + "description": "Workspace for Calibrations" + }, + "putApiV1CalibrationsIdWorkflowParameters": { + "required": [ + "workflow" + ], + "type": "object", + "properties": { + "workflow": { + "required": [ + "id", + "marker_set_name" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The workflow ID." + }, + "name": { + "type": "string", + "description": "The workflow Name." + }, + "marker_set_name": { + "required": [ + "id", + "name" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The MarkerSet ID.", + "format": "int32" + }, + "name": { + "type": "string", + "description": "The MarkerSet Name." + } + } + }, + "method": { + "type": "string", + "description": "The Method." + }, + "het_individuals_fraction": { + "type": "number", + "description": "The HET stuff.", + "format": "float" + } + }, + "description": "besides documented and required parameters,\n it is possible to submit additional one, depends on choosen workflow" + } + }, + "description": "Set Workflow Parameters" + }, + "putApiV1CalibrationsUuid": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "array", + "description": "Attributes to update", + "items": { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Attribute name" + }, + "type": { + "type": "string", + "description": "Indicates, if attribute is an Array" + }, + "values": { + "type": "string", + "description": "Value(s) to update" + } + } + } + } + }, + "description": "Update Calibration" + }, + "V1_Entities_Parameters": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the object." + }, + "name": { + "type": "string", + "description": "The Name of the object." + }, + "label": { + "type": "string" + }, + "title": { + "type": "string" + }, + "values": { + "type": "array", + "description": "Predefined values -> allowed values", + "items": { + "type": "object", + "properties": {} + } + }, + "optional": { + "type": "boolean", + "description": "Is the value required?" + }, + "type": { + "type": "string", + "description": "The data type" + } + }, + "description": "V1_Entities_Parameters model" + }, + "Workflows": { + "type": "object", + "properties": { + "value": { + "type": "integer", + "description": "The ID of it.", + "format": "int32" + }, + "label": { + "type": "string", + "description": "The Name of it." + }, + "owner": { + "type": "string", + "description": "The Owner of it." + } + }, + "description": "Workflows model" + }, + "V1_Entities_List": { + "type": "object", + "description": "V1_Entities_List model" + }, + "V1_Entities_Information": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "value is based on the result of the action", + "enum": [ + "success", + "error" + ] + }, + "name": { + "type": "string" + }, + "message": { + "type": "string" + } + }, + "description": "V1_Entities_Information model" + }, + "postApiV1ImportListing": { + "required": [ + "content", + "kind", + "name" + ], + "type": "object", + "properties": { + "kind": { + "type": "string", + "description": "The Kind of it", + "enum": [ + "marker", + "genotype", + "phenotype" + ] + }, + "name": { + "type": "string", + "description": "The Name of it." + }, + "content": { + "type": "string", + "description": "A File including list of items, formatted as CSV | TSV | JSON Array,\t\n or a String, such as one from text input,\n where the items can be separated by comma, semicolon or tab." + }, + "old_list_id": { + "type": "integer", + "description": "ID of a list which was created before, but will not be used → will be deleted", + "format": "int32" + } + }, + "description": "Import Listing" + }, + "postApiV1CartsCreate": { + "required": [ + "calibrations", + "name", + "published" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "published": { + "type": "boolean" + }, + "calibrations": { + "type": "array", + "description": "List of selected calibration ids", + "items": { + "type": "integer", + "format": "int32" + } + } + }, + "description": "Crate new cart" + }, + "V1_Entities_Cart": { + "type": "object", + "properties": { + "display_name": { + "type": "string", + "description": "The id and name of the cart." + }, + "name": { + "type": "string", + "description": "The name of the cart." + }, + "id": { + "type": "integer", + "description": "Id of the cart.", + "format": "int32" + }, + "crop": { + "type": "string", + "description": "Crop of the cart." + }, + "published": { + "type": "boolean", + "description": "Whether or not the cart has been published." + }, + "created_by": { + "type": "string", + "description": "Owner of the cart." + }, + "trait_calibrations": { + "type": "array", + "description": "The associated calibrations.", + "items": { + "$ref": "#/components/schemas/CalibrationShort" + } + } + }, + "description": "V1_Entities_Cart model" + }, + "putApiV1CartsId": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "published": { + "type": "boolean" + }, + "calibrations": { + "type": "array", + "description": "List of selected calibration ids", + "items": { + "type": "integer", + "format": "int32" + } + } + }, + "description": "Update cart" + }, + "Health": { + "type": "object", + "properties": { + "checks": { + "type": "array", + "description": "The services being monitored.", + "items": { + "$ref": "#/components/schemas/Service" + } + }, + "health": { + "type": "string", + "description": "The overall status of the application." + } + }, + "description": "Health model" + }, + "Service": { + "type": "object", + "properties": { + "check": { + "type": "string", + "description": "The name of the service." + }, + "health": { + "type": "string", + "description": "The status of the service." + }, + "description": { + "type": "string", + "description": "The description of the service." + }, + "milliseconds": { + "type": "integer", + "description": "The time it took to perform the check in milliseconds.", + "format": "int32" + }, + "exception": { + "type": "string", + "description": "The exception message if the service is unhealthy." + }, + "modules": { + "type": "array", + "description": "The modules that depend on the service." + } + } + }, + "V1_Entities_Owner": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "email": { + "type": "string", + "format": "Email" + }, + "role": { + "type": "string" + } + }, + "description": "V1_Entities_Owner model" + }, + "postApiV1MessageRecipientsCreate": { + "required": [ + "crops", + "email" + ], + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "crops": { + "type": "string" + } + }, + "description": "Create Message Recipient" + }, + "postApiV1MessageRecipientsSend": { + "required": [ + "id", + "recipients" + ], + "type": "object", + "properties": { + "recipients": { + "type": "array", + "description": "List of selected recipient ids", + "items": { + "required": [ + "email" + ], + "type": "object", + "properties": { + "email": { + "type": "string" + } + } + } + }, + "files": { + "type": "array", + "description": "List of selected files", + "items": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "id": { + "type": "string" + } + } + } + }, + "id": { + "type": "integer", + "format": "int32" + } + }, + "description": "Send Message to Recipients" + }, + "Application": { + "type": "object", + "properties": { + "app_key": { + "type": "string", + "description": "Tha Access Key of the App.", + "format": "uuid" + }, + "name": { + "type": "string", + "description": "The Name of it." + } + }, + "description": "Application model" + }, + "patchApiV1OwnershipChange": { + "required": [ + "owner", + "subject" + ], + "type": "object", + "properties": { + "owner": { + "required": [ + "email", + "id" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID.", + "format": "int32" + }, + "email": { + "type": "string", + "description": "The Email." + } + }, + "description": "The new Owner." + }, + "subject": { + "required": [ + "id", + "klass" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID.", + "format": "int32" + }, + "klass": { + "type": "string", + "description": "The Class." + } + }, + "description": "The Subject to change ownership" + } + }, + "description": "Change Ownership of requested Subject" + } + }, + "securitySchemes": { + "user_authentication": { + "type": "apiKey", + "description": "provide your galaxy key as api key", + "name": "HTTP_API_KEY", + "in": "header" + }, + "app_authentication": { + "type": "apiKey", + "description": "provide key of registered app -> login and create a key under /apps", + "name": "HTTP_APP_KEY", + "in": "header" + } + } + } +} \ No newline at end of file diff --git a/spec/lib/import_spec.rb b/spec/lib/import_spec.rb index 7676d2b..650d07e 100644 --- a/spec/lib/import_spec.rb +++ b/spec/lib/import_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Starter::Import do # describe '.do_it!' do - # let(:path) { './spec/fixtures/links.json' } + # let(:path) { './spec/fixtures/pmm.json' } # subject { described_class.do_it!(path) } diff --git a/spec/lib/importer/parameter_spec.rb b/spec/lib/importer/parameter_spec.rb index 4e6c860..b8991f7 100644 --- a/spec/lib/importer/parameter_spec.rb +++ b/spec/lib/importer/parameter_spec.rb @@ -1,8 +1,52 @@ # frozen_string_literal: false +# rubocop:disable Layout/LineLength RSpec.describe Starter::Importer::Parameter do + let(:components) do + { + 'parameters' => { + 'rowParam' => { + 'description' => 'Board row (vertical coordinate)', + 'name' => 'row', + 'in' => 'path', + 'required' => true, + 'schema' => { '$ref' => '#/components/schemas/coordinate' } + }, + 'columnParam' => { + 'description' => 'Board column (horizontal coordinate)', + 'name' => 'column', + 'in' => 'path', + 'required' => true, + 'schema' => { '$ref' => '#/components/schemas/coordinate' } + } + }, + 'schemas' => { + 'errorMessage' => { 'type' => 'string', 'maxLength' => 256, 'description' => 'A text message describing an error' }, + 'coordinate' => { 'type' => 'integer', 'minimum' => 1, 'maximum' => 3, 'example' => 1 }, + 'mark' => { + 'type' => 'string', + 'enum' => ['.', 'X', 'O'], + 'description' => 'Possible values for a board square. `.` means empty square.', + 'example' => '.' + }, + 'board' => { + 'type' => 'array', + 'maxItems' => 3, + 'minItems' => 3, + 'items' => { 'type' => 'array', 'maxItems' => 3, 'minItems' => 3, 'items' => { '$ref' => '#/components/schemas/mark' } } + }, + 'winner' => { + 'type' => 'string', 'enum' => ['.', 'X', 'O'], 'description' => 'Winner of the game. `.` means nobody has won yet.', 'example' => '.' + }, + 'status' => { + 'type' => 'object', 'properties' => { 'winner' => { '$ref' => '#/components/schemas/winner' }, 'board' => { '$ref' => '#/components/schemas/board' } } + } + } + } + end + describe 'valid parameters -> sets kind' do - describe 'name in definition' do + describe 'name in definition -> :direct' do subject { described_class.new(definition:) } let(:definition) { { 'name' => 'limit' } } @@ -13,7 +57,7 @@ end end - describe 'ref and components/parameters given' do + describe 'ref and components/parameters given -> :ref' do subject { described_class.new(definition:, components:) } let(:definition) { { '$ref' => '#/components/parameters/rowParam' } } @@ -24,6 +68,35 @@ expect(subject.kind).to eql :ref end end + + describe 'content given -> body' do + subject { described_class.new(definition:, components:) } + + let(:definition) do + { + 'content' => { 'application/json' => { + 'schema' => { + '$ref' => '#/components/schemas/some_name' + } + } } + } + end + let(:components) do + { + 'schemas' => { + 'some_name' => { + 'required' => %w[crop name], + 'type' => 'object', + 'properties' => {} + } + } + } + end + specify do + expect { subject }.not_to raise_error + expect(subject.kind).to eql :body + end + end end describe 'invalid parameters' do @@ -49,104 +122,219 @@ end end - describe 'local params' do - subject { described_class.new(definition:) } + subject { described_class.new(definition:, components:) } - describe 'atomic' do - let(:definition) do - { - 'name' => 'limit', - 'in' => 'query', - 'description' => 'maximum number of results to return', - 'required' => false, - 'schema' => { 'type' => 'integer', 'format' => 'int32' } - } - end + describe 'atomic parameter' do + let(:definition) do + { + 'name' => 'limit', + 'in' => 'query', + 'description' => 'maximum number of results to return', + 'required' => false, + 'schema' => { 'type' => 'integer', 'format' => 'int32' } + } + end - specify do - expect(subject.name).to eql 'limit' - expect(subject.definition.keys).to match_array %w[ - description in required schema - ] - expect(subject.to_s).to eql( - "optional :limit, type: Integer, documentation: { desc: 'maximum number of results to return', in: 'query' }" - ) - end + specify do + expect(subject.name).to eql 'limit' + expect(subject.definition.keys).to match_array %w[ + description in required schema + ] + expect(subject.to_s).to eql( + "optional :limit, type: Integer, documentation: { desc: 'maximum number of results to return', in: 'query' }" + ) end + end - describe 'array' do - let(:definition) do - { - 'name' => 'tags', - 'in' => 'query', - 'description' => 'tags to filter by', - 'required' => false, - 'style' => 'form', - 'schema' => { 'type' => 'array', 'items' => { 'type' => 'string' } } - } - end + describe 'reference atomic parameter' do + let(:definition) do + { '$ref' => '#/components/parameters/rowParam' } + end - specify do - expect(subject.name).to eql 'tags' - expect(subject.definition.keys).to match_array %w[ - description in required style schema - ] - expect(subject.to_s).to eql( - "optional :tags, type: Array, documentation: { desc: 'tags to filter by', in: 'query' }" - ) - end + specify do + expect(subject.name).to eql 'row' + expect(subject.definition.keys).to match_array %w[ + description in required schema + ] + expect(subject.definition['schema']['type']).to eql 'integer' + expect(subject.to_s).to eql( + "requires :row, type: Integer, documentation: { desc: 'Board row (vertical coordinate)', in: 'path' }" + ) end end - describe 'references' do - subject { described_class.new(definition:, components:) } - + describe 'array' do let(:definition) do - { '$ref' => '#/components/parameters/rowParam' } + { + 'name' => 'tags', + 'in' => 'query', + 'description' => 'tags to filter by', + 'required' => false, + 'style' => 'form', + 'schema' => { 'type' => 'array', 'items' => { 'type' => 'string' } } + } end - let(:components) do + specify do + expect(subject.name).to eql 'tags' + expect(subject.definition.keys).to match_array %w[ + description in required style schema + ] + expect(subject.to_s).to eql( + "optional :tags, type: Array, documentation: { desc: 'tags to filter by', in: 'query' }" + ) + end + end + + describe 'request body: simple array' do + let(:definition) do { - 'parameters' => { - 'rowParam' => { - 'description' => 'Board row (vertical coordinate)', - 'name' => 'row', - 'in' => 'path', - 'required' => true, + 'content' => { + 'multipart/form-data' => { 'schema' => { - '$ref' => '#/components/schemas/coordinate' + 'required' => ['ids'], + 'properties' => { + 'ids' => { 'type' => 'array', 'items' => { 'type' => 'integer', 'format' => 'int32' } } + } } - }, - 'columnParam' => { - 'description' => 'Board column (horizontal coordinate)', - 'name' => 'column', - 'in' => 'path', - 'required' => true, + } + }, + 'required' => true, + 'in' => 'body' + } + end + + specify do + expect(subject.name).to eql 'ids' + expect(subject.definition.keys).to match_array %w[ + content required in type + ] + expect(subject.to_s).to eql( + "requires :ids, type: Array[Integer], documentation: { in: 'body' }" + ) + end + end + + describe 'request body: other' do + let(:definition) do + { + 'required' => true, + 'content' => { + 'application/form_data' => { + 'schema' => { '$ref' => '#/components/schemas/mark' } + } + } + } + end + + specify do + expect(subject.name).to eql 'mark' + expect(subject.definition.keys).to match_array %w[ + required content in type enum description example + ] + expect(subject.to_s).to eql( + "requires :mark, type: String, documentation: { desc: 'Possible values for a board square. `.` means empty square.', in: 'body' }" + ) + end + end + + describe 'request body: object' do + let(:definition) do + { + 'content' => { + 'application/json' => { 'schema' => { - '$ref' => '#/components/schemas/coordinate' + '$ref' => '#/components/schemas/postApiV1CalibrationsCreating' } } }, + 'required' => true, + 'in' => 'body' + } + end + + let(:components) do + { 'schemas' => { - 'coordinate' => { - 'type' => 'integer', - 'minimum' => 1, - 'maximum' => 3, - 'example' => 1 + 'postApiV1CalibrationsCreating' => { + 'required' => ['crop', 'name'], # rubocop:disable Style/WordArray + 'type' => 'object', + 'properties' => { + 'crop' => { 'type' => 'string', 'description' => 'The Crop of it.' }, + 'name' => { 'type' => 'string', 'description' => 'The Name of it.' }, + 'projects' => { 'type' => 'array', 'description' => 'The project(s) of it.', 'items' => { 'type' => 'string' } }, + 'pools' => { 'type' => 'array', 'description' => 'The pool(s) of it.', 'items' => { 'type' => 'string' } }, + 'material_level' => { 'type' => 'array', 'description' => 'The material level(s) of it.', 'items' => { 'type' => 'string' } }, + 'material_groups' => { 'type' => 'array', 'description' => 'The material group(s) of it.', 'items' => { 'type' => 'string' } }, + 'path' => { 'type' => 'string', 'description' => 'The path of it.' }, + 'testers' => { 'type' => 'array', 'description' => 'The tester(s) of it.', 'items' => { 'type' => 'string' } }, + 'locations' => { 'type' => 'array', 'description' => 'The location(s) of it.', 'items' => { 'type' => 'string' } }, + 'years' => { 'type' => 'array', 'description' => 'The year(s) of it.', 'items' => { 'type' => 'integer', 'format' => 'int32' } }, + 'tags' => { 'type' => 'array', 'description' => 'The tag(s) of it.', 'items' => { 'type' => 'string' } }, + 'treatments' => { 'type' => 'array', 'description' => 'The treatment(s) of it.', 'items' => { 'type' => 'string' } }, + 'id' => { 'type' => 'integer', 'description' => 'The ID of it (possible on back step, so editing is possible).', 'format' => 'int32' } + }, + 'description' => 'Creating Calibration' } } } end specify do - expect(subject.name).to eql 'row' + # require 'pry'; binding.pry + expect(subject.name).to eql 'postApiV1CalibrationsCreating' expect(subject.definition.keys).to match_array %w[ - description in required schema + required content in type ] - expect(subject.definition['schema']['type']).to eql 'integer' - expect(subject.to_s).to eql( - "requires :row, type: Integer, documentation: { desc: 'Board row (vertical coordinate)', in: 'path' }" + expect(subject.definition['type']).to eql 'object' + # ap subject.to_s + + expect(subject.to_s).to include( + "requires :postApiV1CalibrationsCreating, type: JSON, documentation: { in: 'body' } do" + ) + expect(subject.to_s).to include( + "requires :crop, type: String, documentation: { desc: 'The Crop of it.' }" + ) + expect(subject.to_s).to include( + "requires :name, type: String, documentation: { desc: 'The Name of it.' }" + ) + expect(subject.to_s).to include( + "optional :projects, type: Array[String], documentation: { desc: 'The project(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :pools, type: Array[String], documentation: { desc: 'The pool(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :material_level, type: Array[String], documentation: { desc: 'The material level(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :material_groups, type: Array[String], documentation: { desc: 'The material group(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :path, type: String, documentation: { desc: 'The path of it.' }" + ) + expect(subject.to_s).to include( + "optional :testers, type: Array[String], documentation: { desc: 'The tester(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :locations, type: Array[String], documentation: { desc: 'The location(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :years, type: Array[Integer], documentation: { desc: 'The year(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :tags, type: Array[String], documentation: { desc: 'The tag(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :treatments, type: Array[String], documentation: { desc: 'The treatment(s) of it.' }" + ) + expect(subject.to_s).to include( + "optional :id, type: Integer, documentation: { desc: 'The ID of it (possible on back step, so editing is possible).' }" + ) + expect(subject.to_s).to include( + 'end' ) end end end +# rubocop:enable Layout/LineLength