From 7e052d246daa76b178b1ad6199743f9d16d9ad30 Mon Sep 17 00:00:00 2001 From: rautenberg Date: Wed, 7 Sep 2016 10:51:23 +0200 Subject: fix swagger content-type, replace with correct accept --- api/api.json | 39 ++++++++++++++------------------------- lib/dataset.rb | 2 +- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/api/api.json b/api/api.json index 7033ad3..abc4a0b 100644 --- a/api/api.json +++ b/api/api.json @@ -70,9 +70,9 @@ "description": "Get model representation", "parameters": [ { - "name": "Content-Type", + "name": "accept", "in": "header", - "description": "body Content-Type", + "description": "requested Content-Type", "required": true, "type": "string", "enum": [ @@ -192,17 +192,6 @@ ], "description": "Get dataset representation", "parameters": [ - { - "name": "Content-Type", - "in": "header", - "description": "body Content-Type", - "required": true, - "type": "string", - "enum": [ - "application/json", - "text/csv" - ] - }, { "name": "accept", "in": "header", @@ -210,8 +199,8 @@ "required": true, "type": "string", "enum": [ - "text/uri-list", - "application/json" + "application/json", + "text/csv" ] }, { @@ -249,9 +238,9 @@ "description": "Get dataset representation", "parameters": [ { - "name": "Content-Type", + "name": "accept", "in": "header", - "description": "body Content-Type", + "description": "requested Content-Type", "required": true, "type": "string", "enum": [ @@ -347,9 +336,9 @@ "description": "Get substance representation", "parameters": [ { - "name": "Content-Type", + "name": "accept", "in": "header", - "description": "body Content-Type", + "description": "requested Content-Type", "required": true, "type": "string", "enum": [ @@ -432,9 +421,9 @@ "description": "Get nanoparticle representation", "parameters": [ { - "name": "Content-Type", + "name": "accept", "in": "header", - "description": "body Content-Type", + "description": "requested Content-Type", "required": true, "type": "string", "enum": [ @@ -517,9 +506,9 @@ "description": "Get feature representation", "parameters": [ { - "name": "Content-Type", + "name": "acept", "in": "header", - "description": "body Content-Type", + "description": "requested Content-Type", "required": true, "type": "string", "enum": [ @@ -742,7 +731,7 @@ "required": true, "type": "string", "enum": [ - "application/csv", + "text/csv", "application/json" ] }, @@ -765,7 +754,7 @@ } ], "produces": [ - "application/csv", + "text/csv", "application/json" ], "responses": { diff --git a/lib/dataset.rb b/lib/dataset.rb index 1468c8d..a48b23f 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -29,7 +29,7 @@ get "/dataset/:id/?" do dataset[:substances] = uri("/dataset/#{dataset.id}/substances") dataset[:features] = uri("/dataset/#{dataset.id}/features") return dataset.to_json - when "text/csv" + when "text/csv", "application/csv" return dataset.to_csv else bad_request_error "Mime type #{@accept} is not supported." -- cgit v1.2.3