@@ -67,104 +67,102 @@ class ApiError < Grape::Entity
67
67
"termsOfServiceUrl" => "www.The-URL-of-the-terms-and-service.com" ,
68
68
"contact" => { "name" => "Contact name" , "email" => "[email protected] " , "url" => "Contact URL" } ,
69
69
"license" => { "name" => "The name of the license." , "url" => "www.The-URL-of-the-license.org" } ,
70
- "version" => "v1"
71
- } ,
72
- "swagger" => "2.0" ,
73
- "produces" => [ "application/json" ] ,
74
- "host" => "example.org" ,
75
- "basePath" => "/api" ,
76
- "tags" => [ { "name" => "other_thing" , "description" => "Operations about other_things" } ,
77
- { "name" => "thing" , "description" => "Operations about things" } ,
78
- { "name" => "thing2" , "description" => "Operations about thing2s" } ,
79
- { "name" => "dummy" , "description" => "Operations about dummies" } ] ,
80
- "schemes" => [ "https" , "http" ] ,
81
- "paths" => {
82
- "/v3/other_thing/{elements}" => {
83
- "get" => {
84
- "produces" => [ "application/json" ] ,
85
- "parameters" => [
86
- { "in" => "array" , "name" => "elements" , "description" => "Set of configuration" , "type" => "string" , "required" => true , "items" => { "type" => "string" } } ] ,
70
+ "version" => "v1" } ,
71
+ "swagger" => "2.0" ,
72
+ "produces" => [ "application/json" ] ,
73
+ "host" => "example.org" ,
74
+ "basePath" => "/api" ,
75
+ "tags" => [
76
+ { "name" => "other_thing" , "description" => "Operations about other_things" } ,
77
+ { "name" => "thing" , "description" => "Operations about things" } ,
78
+ { "name" => "thing2" , "description" => "Operations about thing2s" } ,
79
+ { "name" => "dummy" , "description" => "Operations about dummies" }
80
+ ] ,
81
+ "schemes" => [ "https" , "http" ] ,
82
+ "paths" => {
83
+ "/v3/other_thing/{elements}" => {
84
+ "get" => {
85
+ "produces" => [ "application/json" ] ,
86
+ "parameters" => [ { "in" => "array" , "name" => "elements" , "description" => "Set of configuration" , "required" => true , "type" => "string" , "items" => { "type" => "string" } } ] ,
87
+ "responses" => { "200" => { "description" => "nested route inside namespace" , "schema" => { "$ref" => "#/definitions/QueryInput" } } } ,
87
88
"tags" => [ "other_thing" ] ,
88
89
"operationId" => "getV3OtherThingElements" ,
89
- "responses" => { "200" => { "description" => "nested route inside namespace" , "schema" => { "$ref" => "#/definitions/QueryInput" } } } ,
90
90
"x-amazon-apigateway-auth" => { "type" => "none" } ,
91
- "x-amazon-apigateway-integration" => { "type" => "aws" , "uri" => "foo_bar_uri" , "httpMethod" => "get" } } } ,
92
- "/thing" => {
93
- "get" => {
94
- "produces" => [ "application/json" ] ,
95
- "parameters" => [
96
- { "in" => "query" , "name" => "id" , "description" => "Identity of Something" , "type" => "integer" , "required" => false , "format" => "int32" } ,
97
- { "in" => "query" , "name" => "text" , "description" => "Content of something." , "type" => "string" , "required" => false } ,
98
- { "in" => "query" , "name" => "links" , "description" => nil , "type" => "link" , "required" => false } ,
99
- { "in" => "query" , "name" => "others" , "description" => nil , "type" => "text" , "required" => false } ] ,
100
- "tags" => [ "thing" ] ,
101
- "operationId" => "getThing" ,
102
- "responses" => {
103
- "200" => { "description" => "This gets Things." , "schema" => { "$ref" => "#/definitions/Thing" } } ,
104
- "401" => { "description" => "Unauthorized" , "schema" => { "$ref" => "#/definitions/ApiError" } } } } ,
105
- "post" => {
106
- "produces" => [ "application/json" ] ,
107
- "consumes" => [ "application/json" ] ,
108
- "parameters" => [
109
- { "in" => "formData" , "name" => "text" , "description" => "Content of something." , "type" => "string" , "required" => true } ,
110
- { "in" => "body" , "name" => "links" , "description" => nil , "type" => "Array" , "required" => true } ] ,
111
- "tags" => [ "thing" ] ,
112
- "operationId" => "postThing" ,
113
- "responses" => {
114
- "201" => { "description" => "This creates Thing." , "schema" => { "$ref" => "#/definitions/Something" } } ,
115
- "422" => { "description" => "Unprocessible Entity" } }
116
- } } ,
117
- "/thing/{id}" => {
118
- "get" => {
119
- "produces" => [ "application/json" ] ,
120
- "parameters" => [
121
- { "in" => "path" , "name" => "id" , "description" => nil , "type" => "integer" , "required" => true , "format" => "int32" } ] ,
122
- "tags" => [ "thing" ] ,
123
- "operationId" => "getThingId" ,
124
- "responses" => {
125
- "200" => { "description" => "getting a single thing" , "schema" => { "$ref" => "#/definitions/Thing" } } ,
126
- "401" => { "description" => "Unauthorized" } } } ,
127
- "put" => {
128
- "produces" => [ "application/json" ] ,
129
- "consumes" => [ "application/json" ] ,
130
- "parameters" => [
131
- { "in" => "path" , "name" => "id" , "description" => nil , "type" => "integer" , "required" => true , "format" => "int32" } ,
132
- { "in" => "formData" , "name" => "text" , "description" => "Content of something." , "type" => "string" , "required" => false } ,
133
- { "in" => "body" , "name" => "links" , "description" => nil , "type" => "Array" , "required" => false } ] ,
134
- "tags" => [ "thing" ] ,
135
- "operationId" => "putThingId" ,
136
- "responses" => { "200" => { "description" => "This updates Thing." , "schema" => { "$ref" => "#/definitions/Something" } } } } ,
137
- "delete" => {
138
- "produces" => [ "application/json" ] ,
139
- "parameters" => [ { "in" => "path" , "name" => "id" , "description" => nil , "type" => "integer" , "required" => true , "format" => "int32" } ] ,
140
- "tags" => [ "thing" ] ,
141
- "operationId" => "deleteThingId" ,
142
- "responses" => { "200" => { "description" => "This deletes Thing." , "schema" => { "$ref" => "#/definitions/Something" } } }
143
- } } ,
144
- "/thing2" => {
145
- "get" => {
146
- "produces" => [ "application/json" ] ,
147
- "tags" => [ "thing2" ] ,
148
- "operationId" => "getThing2" ,
149
- "responses" => {
150
- "200" => { "description" => "get Horses" , "schema" => { "$ref" => "#/definitions/Something" } } ,
151
- "401" => { "description" => "HorsesOutError" , "schema" => { "$ref" => "#/definitions/ApiError" } } }
152
- } } ,
153
- "/dummy/{id}" => {
154
- "delete" => {
155
- "produces" => [ "application/json" ] ,
156
- "parameters" => [ { "in" => "path" , "name" => "id" , "description" => nil , "type" => "integer" , "required" => true , "format" => "int32" } ] ,
157
- "tags" => [ "dummy" ] ,
158
- "operationId" => "deleteDummyId" ,
159
- "responses" => { "200" => { "description" => "dummy route." } , "401" => { "description" => "Unauthorized" } }
160
- } } } ,
161
- "definitions" => {
162
- "QueryInputElement" => { "type" => "object" , "properties" => { "key" => { "type" => "string" } , "value" => { "type" => "string" } } } ,
163
- "QueryInput" => { "type" => "object" , "properties" => { "elements" => { "type" => "array" , "items" => { "$ref" => "#/definitions/QueryInputElement" } } } } ,
164
- "Thing" => { "properties" => { "id" => { "type" => "integer" } , "text" => { "type" => "string" } , "links" => { "type" => "link" } , "others" => { "type" => "text" } } } ,
165
- "ApiError" => { "type" => "object" , "properties" => { "code" => { "type" => "integer" } , "message" => { "type" => "string" } } } ,
166
- "Something" => { "type" => "object" , "properties" => { "id" => { "type" => "integer" } , "text" => { "type" => "string" } , "links" => { "type" => "link" } , "others" => { "type" => "text" } } }
167
- } }
91
+ "x-amazon-apigateway-integration" => { "type" => "aws" , "uri" => "foo_bar_uri" , "httpMethod" => "get" }
92
+ } } ,
93
+ "/thing" => {
94
+ "get" => {
95
+ "produces" => [ "application/json" ] ,
96
+ "parameters" => [
97
+ { "in" => "query" , "name" => "id" , "description" => "Identity of Something" , "required" => false , "type" => "integer" , "format" => "int32" } ,
98
+ { "in" => "query" , "name" => "text" , "description" => "Content of something." , "required" => false , "type" => "string" } ,
99
+ { "in" => "query" , "name" => "links" , "description" => nil , "required" => false , "type" => "link" } ,
100
+ { "in" => "query" , "name" => "others" , "description" => nil , "required" => false , "type" => "text" }
101
+ ] ,
102
+ "responses" => { "200" => { "description" => "This gets Things." , "schema" => { "$ref" => "#/definitions/Thing" } } , "401" => { "description" => "Unauthorized" , "schema" => { "$ref" => "#/definitions/ApiError" } } } ,
103
+ "tags" => [ "thing" ] ,
104
+ "operationId" => "getThing"
105
+ } ,
106
+ "post" => {
107
+ "produces" => [ "application/json" ] ,
108
+ "consumes" => [ "application/json" ] ,
109
+ "parameters" => [
110
+ { "in" => "formData" , "name" => "text" , "description" => "Content of something." , "required" => true , "type" => "string" } ,
111
+ { "in" => "formData" , "name" => "links" , "description" => nil , "required" => true , "type" => "array" }
112
+ ] ,
113
+ "responses" => { "201" => { "description" => "This creates Thing." , "schema" => { "$ref" => "#/definitions/Something" } } , "422" => { "description" => "Unprocessible Entity" } } ,
114
+ "tags" => [ "thing" ] ,
115
+ "operationId" => "postThing"
116
+ } } ,
117
+ "/thing/{id}" => {
118
+ "get" => {
119
+ "produces" => [ "application/json" ] ,
120
+ "parameters" => [ { "in" => "path" , "name" => "id" , "description" => nil , "required" => true , "type" => "integer" , "format" => "int32" } ] ,
121
+ "responses" => { "200" => { "description" => "getting a single thing" , "schema" => { "$ref" => "#/definitions/Thing" } } , "401" => { "description" => "Unauthorized" } } ,
122
+ "tags" => [ "thing" ] ,
123
+ "operationId" => "getThingId"
124
+ } ,
125
+ "put" => {
126
+ "produces" => [ "application/json" ] ,
127
+ "consumes" => [ "application/json" ] ,
128
+ "parameters" => [
129
+ { "in" => "path" , "name" => "id" , "description" => nil , "required" => true , "type" => "integer" , "format" => "int32" } ,
130
+ { "in" => "formData" , "name" => "text" , "description" => "Content of something." , "required" => false , "type" => "string" } ,
131
+ { "in" => "formData" , "name" => "links" , "description" => nil , "required" => false , "type" => "array" }
132
+ ] ,
133
+ "responses" => { "200" => { "description" => "This updates Thing." , "schema" => { "$ref" => "#/definitions/Something" } } } ,
134
+ "tags" => [ "thing" ] ,
135
+ "operationId" => "putThingId"
136
+ } ,
137
+ "delete" => {
138
+ "produces" => [ "application/json" ] ,
139
+ "parameters" => [ { "in" => "path" , "name" => "id" , "description" => nil , "required" => true , "type" => "integer" , "format" => "int32" } ] ,
140
+ "responses" => { "200" => { "description" => "This deletes Thing." , "schema" => { "$ref" => "#/definitions/Something" } } } ,
141
+ "tags" => [ "thing" ] ,
142
+ "operationId" => "deleteThingId"
143
+ } } ,
144
+ "/thing2" => {
145
+ "get" => {
146
+ "produces" => [ "application/json" ] ,
147
+ "responses" => { "200" => { "description" => "get Horses" , "schema" => { "$ref" => "#/definitions/Something" } } , "401" => { "description" => "HorsesOutError" , "schema" => { "$ref" => "#/definitions/ApiError" } } } ,
148
+ "tags" => [ "thing2" ] ,
149
+ "operationId" => "getThing2"
150
+ } } ,
151
+ "/dummy/{id}" => {
152
+ "delete" => {
153
+ "produces" => [ "application/json" ] ,
154
+ "parameters" => [ { "in" => "path" , "name" => "id" , "description" => nil , "required" => true , "type" => "integer" , "format" => "int32" } ] ,
155
+ "responses" => { "200" => { "description" => "dummy route." } , "401" => { "description" => "Unauthorized" } } ,
156
+ "tags" => [ "dummy" ] ,
157
+ "operationId" => "deleteDummyId"
158
+ } } } ,
159
+ "definitions" => {
160
+ "QueryInputElement" => { "type" => "object" , "properties" => { "key" => { "type" => "string" } , "value" => { "type" => "string" } } } ,
161
+ "QueryInput" => { "type" => "object" , "properties" => { "elements" => { "type" => "array" , "items" => { "$ref" => "#/definitions/QueryInputElement" } } } } ,
162
+ "Thing" => { "properties" => { "id" => { "type" => "integer" , "format" => "int32" } , "text" => { "type" => "string" } , "links" => { "type" => "link" } , "others" => { "type" => "text" } } } ,
163
+ "ApiError" => { "type" => "object" , "properties" => { "code" => { "type" => "integer" , "format" => "int32" } , "message" => { "type" => "string" } } } ,
164
+ "Something" => { "type" => "object" , "properties" => { "id" => { "type" => "integer" , "format" => "int32" } , "text" => { "type" => "string" } , "links" => { "type" => "link" } , "others" => { "type" => "text" } } }
165
+ } }
168
166
end
169
167
170
168
let ( :http_verbs ) { %w[ get post put delete ] }
0 commit comments