zero-rails_openapi 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +1,29 @@
1
1
  class V1::GoodsDoc < BaseDoc
2
-
3
- open_api :index, 'Get list of Goods.' do
4
- desc 'listing Goods',
5
- view!: 'search view, allows::<br/>',
2
+ api :index, 'GET list of goods.' do
3
+ desc 'listing goods',
4
+ view!: 'search view, allows:<br/>',
6
5
  # '1/ all goods (default):all<br/>' \
7
6
  # '2/ only online:online<br/>' \
8
7
  # '3/ only offline:offline<br/>' \
9
8
  # '4/ expensive goods:expensive<br/>' \
10
9
  # '5/ cheap goods:cheap<br/>',
11
- search_type!: 'search field, allows:<br/>'
10
+ search_type!: 'search field, allows:<br/>'
12
11
  # '1/ name<br/>2/ creator,<br/>3/ category<br/>4/ price<br/>'
13
12
 
14
13
  # Instead of:
15
- # query :view, String, enum: %w[all online offline expensive cheap]
14
+ # query :view, String, enum: %w[ all online offline expensive cheap ]
16
15
  query :view, String, enum: {
17
16
  'all goods (default)': :all,
18
17
  'only online': :online,
19
18
  'only offline': :offline,
20
19
  'expensive goods': :expensive,
21
- 'cheap goods': :cheap,
20
+ 'cheap goods': :cheap
22
21
  }
23
- query :search_type, String, enum: %w[name creator category price]
22
+ query :search_type, String, enum: %w[ name creator category price ]
24
23
  # Same as:
25
24
  # query :search_type, String, desc!: 'search field, allows:<br/>',
26
- # enum: %w[name creator category price]
25
+ # enum: %w[ name creator category price ]
27
26
 
28
- # TODO: Support `desc: '', auto_desc: true or [:enum, :must_be]`
27
+ # TODO: Support `desc: '', auto_desc: true or %i[ enum must_be ]`
29
28
  end
30
-
31
29
  end
@@ -11,7 +11,7 @@ module AutoGenDoc
11
11
  super
12
12
  subclass.class_eval do
13
13
  break unless self.name.match? /sController|sDoc/
14
- ctrl_path "api/#{self.name.sub('Doc', '').downcase.gsub('::', '/')}" if self.name.match? /sDoc/
14
+ ctrl_path self.name.sub('Doc', '').downcase.gsub('::', '/') if self.name.match?(/sDoc/)
15
15
  open_api_dry
16
16
  end
17
17
  end
@@ -49,7 +49,7 @@ module AutoGenDoc
49
49
  # OAS require at least one response on each api.
50
50
  # default_response 'default response', :json
51
51
  model = Object.const_get(action_path.split('#').first.split('/').last[0..-2].camelize) rescue nil
52
- type = action.in?(['index', 'show']) ? Array[load_schema(model)] : String
52
+ type = action.in?(%w[ index show ]) ? Array[load_schema(model)] : String
53
53
  response '200', 'success', :json, type: {
54
54
  code: { type: Integer, dft: 200 },
55
55
  msg: { type: String, dft: 'success' },
@@ -82,4 +82,4 @@ module AutoGenDoc
82
82
  end
83
83
  end
84
84
  end
85
- end
85
+ end
@@ -2,51 +2,49 @@ class Api::V1::ExamplesController < Api::V1::BaseController
2
2
  apis_tag name: 'ExampleTagName', desc: 'ExamplesController\'s APIs'
3
3
 
4
4
  components do
5
- schema :Dog => [{
6
- id!: Integer,
7
- name: { type: String, must_be: 'zhandao', desc: 'name' }
8
- }, # this is schema type, see:
9
- dft: { id: 1, name: 'pet' }]
10
- # schema :Dog => [ String, dft: { id: 1, name: 'pet' } ]
11
- query! :QueryCompUuid => [ :product_uuid, String, desc: 'product uuid' ]
12
- path! :PathCompId => [ :id, Integer, desc: 'user id' ]
13
- resp :RespComp => [ 'bad request', :json ]
14
- body! :RqBodyComp => [ :form ]
5
+ schema :DogSchema => [ String, dft: 'doge' ]
6
+ query! :UidQuery => [ :uid, String, desc: 'user uid' ]
7
+ path! :IdPath => [ :id, Integer, desc: 'product id' ]
8
+ resp :BadRqResp => [ 'bad request', :json ]
15
9
  end
16
10
 
17
- api_dry %i[index show], 'common response' do
18
- response '567', 'query result export', :pdf, type: File
11
+
12
+ api_dry %i[ index show ], 'common parts of :index and :show' do
13
+ header! :Token, String
14
+ response 1000, 'data export', :pdf, type: File
19
15
  end
20
16
 
21
- open_api :index, '(SUMMARY) this api blah blah ...', builder: :template1 do
22
- this_api_is_invalid! 'this api is expired!'
23
- desc 'Optional multiline or single-line Markdown-formatted description',
24
- id: 'user id',
25
- email_addr: 'email_addr\'s desc'
26
- email = 'zero@rails.org'
27
17
 
28
- query! :id, Integer, enum: 0..5, length: [1, 2], pattern: /^[0-9]$/, range: { gt:0, le:5 }
29
- query! :done, Boolean, must_be: false, default: true, desc: 'must be false'
30
- query :email_addr, String, lth: :ge_3, default: email # is_a: :email
18
+ api :index, 'GET examples', use: :Token do
19
+ this_api_is_invalid! 'do not use!'
20
+ desc '**GET** list of examples,<br/>and get the status 200.',
21
+ id: 'user id',
22
+ email: 'email addr\'s desc'
23
+ email = 'a@b.c'
31
24
 
32
- file :pdf, 'desc: the media type is application/pdf'
25
+ query! :count, Integer, enum: 0..5, length: [1, 2], pattern: /^[0-9]$/, range: { gt: 0, le: 5 }
26
+ query! :done, Boolean, must_be: false, default: true, desc: 'must be false'
27
+ query :email, String, lth: :ge_3, default: email # is_a: :email
28
+ file :pdf, 'upload a file: the media type should be application/pdf'
33
29
 
34
- response :success, 'success response', :json, type: :Dog
30
+ response :success, 'success response', :json, type: :DogSchema
35
31
 
36
32
  security :ApiKeyAuth
37
33
  end
38
34
 
39
- open_api :show do
40
- param_ref :PathCompId, :QueryCompUuid
41
- response_ref '123' => :RespComp, '223' => :RespComp
35
+
36
+ api :show, skip: :Token do
37
+ param_ref :IdPath, :UidQuery
38
+ response_ref 400 => :BadRqResp
42
39
  end
43
40
 
44
- open_api :create do
41
+
42
+ api :create do
45
43
  form 'for creating a user', data: {
46
- :name! => { type: String, desc: 'user name' },
44
+ :name! => String, # <= schema_type is `String`
47
45
  :password! => { type: String, pattern: /[0-9]{6,10}/, desc: 'password' },
48
46
  # optional
49
- :remarks => { type: String, desc: 'remarks' },
47
+ :remarks => { type: String, desc: 'remarks' }, # <= schema_type is `String`, and schema_hash is { desc: '..' }
50
48
  }
51
49
  end
52
50
  end
@@ -1,11 +1,12 @@
1
1
  class V2::GoodsDoc < BaseDoc
2
+ SCHEMA_DRY = { a: 1, b: 2 }
2
3
 
3
- open_api :index, 'GET list of Goods.', builder: :index, # jbuilder templates is set in initializers/open_api.rb
4
+ api :index, 'GET list of goods.', builder: :index, # jbuilder templates is set in initializers/open_api.rb
4
5
  use: [ 'Token', :page, :rows ] do # use parameters write in AutoGenDoc#api_dry
5
6
  # skip: [ 'Token' ] do # you can also skip parameters
6
- desc 'listing Goods',
7
- view!: 'search view, allows::<br/>',
8
- search_type!: 'search field, allows:<br/>'
7
+ desc 'listing goods',
8
+ view!: 'search view, allows:<br/>',
9
+ search_type!: 'search field, allows:<br/>'
9
10
 
10
11
  # Single `query`
11
12
  query :view, String, enum: {
@@ -14,7 +15,7 @@ class V2::GoodsDoc < BaseDoc
14
15
  'only offline': :offline,
15
16
  'expensive goods': :expensive,
16
17
  'cheap goods': :cheap,
17
- }
18
+ }, **SCHEMA_DRY # >>> Here is a little trick! <<<
18
19
  # Batch `query`
19
20
  do_query by: {
20
21
  :search_type => { type: String, enum: %w[ name creator category price ] },
@@ -27,7 +28,7 @@ class V2::GoodsDoc < BaseDoc
27
28
  end
28
29
 
29
30
 
30
- open_api :create, 'POST create a Good', builder: :success_or_not, use: 'Token' do
31
+ api :create, 'POST create a good', builder: :success_or_not, use: 'Token' do
31
32
  form! 'for creating a good', data: {
32
33
  :name! => { type: String, desc: 'good\'s name' },
33
34
  :category_id! => { type: Integer, desc: 'sub_category\'s id', npmt: true, range: { ge: 1 }, as: :cate },
@@ -45,8 +46,8 @@ class V2::GoodsDoc < BaseDoc
45
46
  end
46
47
 
47
48
 
48
- open_api :show, 'GET a Good.', builder: :show, use: [ 'Token', :id ]
49
+ api :show, 'GET the specified Good.', builder: :show, use: [ 'Token', :id ]
49
50
 
50
51
 
51
- open_api :destroy, 'DELETE a Good.', builder: :success_or_not, use: [ 'Token', :id ]
52
+ api :destroy, 'DELETE the specified Good.', builder: :success_or_not, use: [ 'Token', :id ]
52
53
  end
@@ -3,23 +3,26 @@ require 'open_api'
3
3
  OpenApi::Config.tap do |c|
4
4
  # Config DSL
5
5
  c.instance_eval do
6
- api :zero_rails_api, root_controller: ApiDoc
6
+ open_api :zero_rails, root_controller: ApiDoc
7
7
  info version: '0.0.1', title: 'Zero Rails APIs', description: 'API documentation of Zero-Rails Application.'
8
8
  server 'http://localhost:3000', desc: 'Main (production) server'
9
9
  server 'http://localhost:3000', desc: 'Internal staging server for testing'
10
- security ApiKeyAuth: [ ]
11
- security_scheme :ApiKeyAuth, type: 'apiKey', name: 'server_token', in: 'query'
10
+ bearer_auth :Token
11
+ global_auth :Token
12
12
  end
13
13
 
14
14
  # [REQUIRED] The location where .json doc file will be output.
15
15
  c.file_output_path = 'public/open_api'
16
16
 
17
+ # [Optional] Use this txt instead of running `rails routes`.
18
+ # c.rails_routes_file = 'config/routes.txt'
19
+
17
20
  # Everything about OAS3 is on https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md
18
21
  # Getting started: https://swagger.io/docs/specification/basic-structure/
19
- c.register_docs = {
20
- homepage_api: {
22
+ c.open_api_docs = {
23
+ blog_api: {
21
24
  # [REQUIRED] ZRO will scan all the descendants of the root_controller, then generate their docs.
22
- root_controller: Api::V1::BaseController,
25
+ root_controller: ApiController,
23
26
 
24
27
  # [REQUIRED] Info Object: The info section contains API information
25
28
  info: {
@@ -38,7 +41,7 @@ OpenApi::Config.tap do |c|
38
41
  # The URL pointing to the contact information. MUST be in the format of a URL.
39
42
  url: 'http://www.github.com',
40
43
  # The email address of the contact person/organization. MUST be in the format of an email address.
41
- email: 'git@gtihub.com'
44
+ email: 'x@y.z'
42
45
  },
43
46
  # License Object: The license information for the exposed API.
44
47
  license: {
@@ -75,13 +78,11 @@ OpenApi::Config.tap do |c|
75
78
 
76
79
  # Authentication
77
80
  # The securitySchemes and security keywords are used to describe the authentication methods used in your API.
81
+ # https://swagger.io/docs/specification/authentication/
78
82
  # Security Scheme Object: An object to hold reusable Security Scheme Objects.
79
- global_security_schemes: {
80
- ApiKeyAuth: {
81
- type: 'apiKey',
82
- name: 'server_token',
83
- in: 'query'
84
- }
83
+ security_schemes: {
84
+ ApiKeyAuth: { type: 'apiKey', name: 'server_token', in: 'query' },
85
+ Token: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }
85
86
  },
86
87
  # Security Requirement Object
87
88
  # A declaration of which security mechanisms can be used across the API.
@@ -89,7 +90,7 @@ OpenApi::Config.tap do |c|
89
90
  # Only one of the security requirement objects need to be satisfied to authorize a request.
90
91
  # Individual operations can override this definition.
91
92
  # see: https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#securityRequirementObject
92
- global_security: [{ ApiKeyAuth: [] }],
93
+ global_security: [{ ApiKeyAuth: [] }, { Token: [] }],
93
94
  }
94
95
  }
95
96
 
@@ -102,9 +103,9 @@ OpenApi::Config.tap do |c|
102
103
  json.partial! 'api/base', total: @data.size
103
104
 
104
105
  json.data do
105
- # @data = @data.page(@_page).per(@_rows) if @_page || @_rows
106
+ # @data = @data.page(@page).per(@rows) if @page || @rows
106
107
  # json.array! @data do |datum|
107
- json.array! @data.page(@_page).per(@_rows) do |datum|
108
+ json.array! @data.page(@page).per(@rows) do |datum|
108
109
  json.(datum, *datum.show_attrs) if datum.present?
109
110
  end
110
111
  end
@@ -148,4 +149,14 @@ end
148
149
 
149
150
  Object.const_set('Boolean', 'boolean') # Support `Boolean` writing in DSL
150
151
 
151
- OpenApi.write_docs generate_files: !Rails.env.production?
152
+ OpenApi.write_docs generate_files: !Rails.env.production?
153
+
154
+
155
+ __END__
156
+
157
+ (1) all the description:
158
+ CommonMark(http://spec.commonmark.org/) syntax MAY be used for rich text representation.
159
+ (2) all the url could be URL template(?):
160
+ Variable substitutions will be made when a variable is named in {brackets}.
161
+ variables: Map Object, A map between a variable name and its value, is used for substitution in the URL template.
162
+ variables example: https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#server-object-example
@@ -1,41 +1,42 @@
1
1
  {
2
2
  "openapi": "3.0.0",
3
3
  "info": {
4
- "title": "Zero Rails Apis",
5
- "version": "0.0.1"
4
+ "version": "0.0.1",
5
+ "title": "Zero Rails APIs",
6
+ "description": "API documentation of Zero-Rails Application."
6
7
  },
7
8
  "servers": [
8
9
  {
9
10
  "url": "http://localhost:3000",
10
- "description": "Optional server description, e.g. Main (production) server"
11
+ "description": "Main (production) server"
11
12
  },
12
13
  {
13
- "url": "http://staging_server",
14
- "description": "Optional server description, e.g. Internal staging server for testing"
14
+ "url": "http://localhost:3000",
15
+ "description": "Internal staging server for testing"
15
16
  }
16
17
  ],
17
18
  "security": [
18
19
  {
19
- "ApiKeyAuth": [
20
+ "Token": [
20
21
 
21
22
  ]
22
23
  }
23
24
  ],
24
25
  "tags": [
25
26
  {
26
- "name": "Goods"
27
+ "name": "Categories"
27
28
  },
28
29
  {
29
- "name": "Permissions"
30
+ "name": "Goods"
30
31
  },
31
32
  {
32
- "name": "Roles"
33
+ "name": "Inventories"
33
34
  },
34
35
  {
35
- "name": "Categories"
36
+ "name": "Permissions"
36
37
  },
37
38
  {
38
- "name": "Inventories"
39
+ "name": "Roles"
39
40
  },
40
41
  {
41
42
  "name": "Stores"
@@ -45,46 +46,14 @@
45
46
  }
46
47
  ],
47
48
  "paths": {
48
- "/api/v1/goods": {
49
+ "/api/v1/categories": {
49
50
  "get": {
50
- "description": "Get list of Goods.",
51
- "summary": "Get list of Goods.",
51
+ "summary": "GET list of categories.",
52
52
  "operationId": "index",
53
53
  "tags": [
54
- "Goods"
54
+ "Categories"
55
55
  ],
56
56
  "parameters": [
57
- {
58
- "name": "Token",
59
- "in": "header",
60
- "required": true,
61
- "description": "user token",
62
- "schema": {
63
- "type": "string"
64
- }
65
- },
66
- {
67
- "name": "created_start_at",
68
- "in": "query",
69
- "required": false,
70
- "description": "时间起点, YY-MM-DD (HH:MM:SS, 可选)",
71
- "schema": {
72
- "type": "string",
73
- "format": "date-time",
74
- "as": "start"
75
- }
76
- },
77
- {
78
- "name": "created_end_at",
79
- "in": "query",
80
- "required": false,
81
- "description": "时间终点, YY-MM-DD (HH:MM:SS, 可选)",
82
- "schema": {
83
- "type": "string",
84
- "format": "date-time",
85
- "as": "end"
86
- }
87
- },
88
57
  {
89
58
  "name": "page",
90
59
  "in": "query",
@@ -106,47 +75,6 @@
106
75
  "minimum": 1,
107
76
  "default": 10
108
77
  }
109
- },
110
- {
111
- "name": "view",
112
- "in": "query",
113
- "required": false,
114
- "description": "请求来自的视图,允许值:<br/>1/ 所有物品 (default): all<br/>2/ 上线物品: online<br/>3/ 下线物品: offline",
115
- "schema": {
116
- "type": "string",
117
- "enum": [
118
- "all",
119
- "online",
120
- "offline"
121
- ],
122
- "default": "all"
123
- }
124
- },
125
- {
126
- "name": "search_type",
127
- "in": "query",
128
- "required": false,
129
- "description": "搜索的字段名,允许值:<br/>1/ name<br/>2/ creator<br/>3/ category_name<br/>4/ unit<br/>5/ price",
130
- "schema": {
131
- "type": "string",
132
- "enum": [
133
- "name",
134
- "creator",
135
- "category_name",
136
- "unit",
137
- "price"
138
- ],
139
- "as": "field"
140
- }
141
- },
142
- {
143
- "name": "export",
144
- "in": "query",
145
- "required": false,
146
- "description": "是否将查询结果导出 Excel 文件",
147
- "schema": {
148
- "type": "boolean"
149
- }
150
78
  }
151
79
  ],
152
80
  "responses": {
@@ -180,7 +108,7 @@
180
108
  "data": {
181
109
  "type": "array",
182
110
  "items": {
183
- "type": "object"
111
+ "type": ""
184
112
  }
185
113
  }
186
114
  }
@@ -197,19 +125,16 @@
197
125
  "-11": {
198
126
  "description": "insufficient permission"
199
127
  },
200
- "700": {
201
- "description": "change online failed"
202
- },
203
128
  "400": {
204
- "description": "param validation failure"
129
+ "description": "parameter validation failed"
205
130
  }
206
131
  }
207
132
  },
208
133
  "post": {
209
- "summary": "Create a Good, returns id of the good that was created.",
134
+ "summary": "POST create a category.",
210
135
  "operationId": "create",
211
136
  "tags": [
212
- "Goods"
137
+ "Categories"
213
138
  ],
214
139
  "parameters": [
215
140
  {
@@ -224,7 +149,7 @@
224
149
  ],
225
150
  "requestBody": {
226
151
  "required": true,
227
- "description": "for creating a good",
152
+ "description": "for creating the specified category",
228
153
  "content": {
229
154
  "multipart/form-data": {
230
155
  "schema": {
@@ -234,43 +159,22 @@
234
159
  "type": "string",
235
160
  "description": "名字"
236
161
  },
237
- "category_id": {
238
- "type": "integer",
239
- "minimum": 1,
240
- "as": "cate",
241
- "not_permit": true,
242
- "description": "子类 id"
243
- },
244
- "unit": {
245
- "type": "string",
246
- "description": "单位"
247
- },
248
- "price": {
249
- "type": "number",
250
- "format": "float",
251
- "minimum": 0,
252
- "description": "单价"
253
- },
254
- "is_online": {
162
+ "is_smaller": {
255
163
  "type": "boolean",
256
- "description": "是否上线?"
164
+ "description": "icon name"
257
165
  },
258
- "remarks": {
166
+ "icon_name": {
259
167
  "type": "string",
260
- "description": "其他说明"
168
+ "description": "是否二级分类?"
261
169
  },
262
- "pic_path": {
263
- "type": "string",
264
- "format": "url",
265
- "is": "url",
266
- "description": "图片路径"
170
+ "base_id": {
171
+ "type": "integer",
172
+ "description": "一级分类的 id"
267
173
  }
268
174
  },
269
175
  "required": [
270
176
  "name",
271
- "category_id",
272
- "unit",
273
- "price"
177
+ "is_smaller"
274
178
  ]
275
179
  }
276
180
  }
@@ -305,10 +209,7 @@
305
209
  "default": "Ruby"
306
210
  },
307
211
  "data": {
308
- "type": "array",
309
- "items": {
310
- "type": "object"
311
- }
212
+ "type": "string"
312
213
  }
313
214
  }
314
215
  }
@@ -327,41 +228,18 @@
327
228
  "-11": {
328
229
  "description": "insufficient permission"
329
230
  },
330
- "700": {
331
- "description": "change online failed"
332
- },
333
231
  "400": {
334
- "description": "param validation failure"
232
+ "description": "parameter validation failed"
335
233
  }
336
234
  }
337
235
  }
338
236
  },
339
- "/api/v1/goods/{id}": {
237
+ "/api/v1/categories/list": {
340
238
  "get": {
341
- "summary": "Show a Good.",
342
- "operationId": "show",
239
+ "summary": "GET nested list of categories.",
240
+ "operationId": "nested_list",
343
241
  "tags": [
344
- "Goods"
345
- ],
346
- "parameters": [
347
- {
348
- "name": "Token",
349
- "in": "header",
350
- "required": true,
351
- "description": "user token",
352
- "schema": {
353
- "type": "string"
354
- }
355
- },
356
- {
357
- "name": "id",
358
- "in": "path",
359
- "required": true,
360
- "description": "要查询的 id",
361
- "schema": {
362
- "type": "integer"
363
- }
364
- }
242
+ "Categories"
365
243
  ],
366
244
  "responses": {
367
245
  "200": {
@@ -392,10 +270,7 @@
392
270
  "default": "Ruby"
393
271
  },
394
272
  "data": {
395
- "type": "array",
396
- "items": {
397
- "type": "object"
398
- }
273
+ "type": "string"
399
274
  }
400
275
  }
401
276
  }
@@ -411,19 +286,18 @@
411
286
  "-11": {
412
287
  "description": "insufficient permission"
413
288
  },
414
- "700": {
415
- "description": "change online failed"
416
- },
417
289
  "400": {
418
- "description": "param validation failure"
290
+ "description": "parameter validation failed"
419
291
  }
420
292
  }
421
- },
293
+ }
294
+ },
295
+ "/api/v1/categories/{id}": {
422
296
  "patch": {
423
- "summary": "Update a Good.",
297
+ "summary": "PATCH update the specified category.",
424
298
  "operationId": "update",
425
299
  "tags": [
426
- "Goods"
300
+ "Categories"
427
301
  ],
428
302
  "parameters": [
429
303
  {
@@ -447,7 +321,7 @@
447
321
  ],
448
322
  "requestBody": {
449
323
  "required": true,
450
- "description": "for updating a good",
324
+ "description": "for updating the specified category",
451
325
  "content": {
452
326
  "multipart/form-data": {
453
327
  "schema": {
@@ -457,36 +331,17 @@
457
331
  "type": "string",
458
332
  "description": "名字"
459
333
  },
460
- "category_id": {
461
- "type": "integer",
462
- "minimum": 1,
463
- "as": "cate",
464
- "not_permit": true,
465
- "description": "子类 id"
466
- },
467
- "unit": {
468
- "type": "string",
469
- "description": "单位"
470
- },
471
- "price": {
472
- "type": "number",
473
- "format": "float",
474
- "minimum": 0,
475
- "description": "单价"
476
- },
477
- "remarks": {
478
- "type": "string",
479
- "description": "其他说明"
334
+ "is_smaller": {
335
+ "type": "boolean",
336
+ "description": "icon name"
480
337
  },
481
- "pic_path": {
338
+ "icon_name": {
482
339
  "type": "string",
483
- "format": "url",
484
- "is": "url",
485
- "description": "图片路径"
340
+ "description": "是否二级分类?"
486
341
  },
487
- "is_online": {
488
- "type": "boolean",
489
- "description": "是否上线"
342
+ "base_id": {
343
+ "type": "integer",
344
+ "description": "一级分类的 id"
490
345
  }
491
346
  }
492
347
  }
@@ -522,10 +377,7 @@
522
377
  "default": "Ruby"
523
378
  },
524
379
  "data": {
525
- "type": "array",
526
- "items": {
527
- "type": "object"
528
- }
380
+ "type": "string"
529
381
  }
530
382
  }
531
383
  }
@@ -544,19 +396,16 @@
544
396
  "-11": {
545
397
  "description": "insufficient permission"
546
398
  },
547
- "700": {
548
- "description": "change online failed"
549
- },
550
399
  "400": {
551
- "description": "param validation failure"
400
+ "description": "parameter validation failed"
552
401
  }
553
402
  }
554
403
  },
555
404
  "delete": {
556
- "summary": "Delete a Good.",
405
+ "summary": "DELETE the specified category.",
557
406
  "operationId": "destroy",
558
407
  "tags": [
559
- "Goods"
408
+ "Categories"
560
409
  ],
561
410
  "parameters": [
562
411
  {
@@ -607,10 +456,7 @@
607
456
  "default": "Ruby"
608
457
  },
609
458
  "data": {
610
- "type": "array",
611
- "items": {
612
- "type": "object"
613
- }
459
+ "type": "string"
614
460
  }
615
461
  }
616
462
  }
@@ -629,19 +475,17 @@
629
475
  "-11": {
630
476
  "description": "insufficient permission"
631
477
  },
632
- "700": {
633
- "description": "change online failed"
634
- },
635
478
  "400": {
636
- "description": "param validation failure"
479
+ "description": "parameter validation failed"
637
480
  }
638
481
  }
639
482
  }
640
483
  },
641
- "/api/v1/goods/{id}/change_online": {
642
- "post": {
643
- "summary": "Change online status of Good, will do: is_online = !is_online.",
644
- "operationId": "change_online",
484
+ "/api/v1/goods": {
485
+ "get": {
486
+ "description": "GET list of goods.",
487
+ "summary": "GET list of goods.",
488
+ "operationId": "index",
645
489
  "tags": [
646
490
  "Goods"
647
491
  ],
@@ -656,97 +500,109 @@
656
500
  }
657
501
  },
658
502
  {
659
- "name": "id",
660
- "in": "path",
661
- "required": true,
662
- "description": "要上/下线的物品 id",
503
+ "name": "view",
504
+ "in": "query",
505
+ "required": false,
506
+ "description": "请求来自的视图,允许值:<br/>1/ 所有物品 (default): all<br/>2/ 上线物品: online<br/>3/ 下线物品: offline",
663
507
  "schema": {
664
- "type": "integer"
508
+ "type": "string",
509
+ "enum": [
510
+ "all",
511
+ "online",
512
+ "offline"
513
+ ],
514
+ "default": "all"
665
515
  }
666
- }
667
- ],
668
- "responses": {
669
- "200": {
670
- "description": "success",
671
- "content": {
672
- "application/json": {
673
- "schema": {
674
- "type": "object",
675
- "properties": {
676
- "code": {
677
- "type": "integer",
678
- "default": 200
679
- },
680
- "msg": {
681
- "type": "string",
682
- "default": "success"
683
- },
684
- "total": {
685
- "type": "integer"
686
- },
687
- "timestamp": {
688
- "type": "integer",
689
- "format": "time",
690
- "is": "time"
691
- },
692
- "language": {
693
- "type": "string",
694
- "default": "Ruby"
695
- },
696
- "data": {
697
- "type": "array",
698
- "items": {
699
- "type": "object"
700
- }
701
- }
702
- }
703
- }
704
- }
516
+ },
517
+ {
518
+ "name": "search_type",
519
+ "in": "query",
520
+ "required": false,
521
+ "description": "搜索的字段名,允许值:<br/>1/ name<br/>2/ creator<br/>3/ category_name<br/>4/ unit<br/>5/ price",
522
+ "schema": {
523
+ "type": "string",
524
+ "enum": [
525
+ "name",
526
+ "creator",
527
+ "category_name",
528
+ "unit",
529
+ "price"
530
+ ],
531
+ "as": "field"
705
532
  }
706
533
  },
707
- "-1": {
708
- "description": "invalid token"
534
+ {
535
+ "name": "value",
536
+ "in": "query",
537
+ "required": false,
538
+ "description": "查询词",
539
+ "schema": {
540
+ "type": "string"
541
+ }
709
542
  },
710
- "-10": {
711
- "description": "role verification failed"
543
+ {
544
+ "name": "created_start_at",
545
+ "in": "query",
546
+ "required": false,
547
+ "description": "时间起点, YY-MM-DD (HH:MM:SS, 可选)",
548
+ "schema": {
549
+ "type": "string",
550
+ "format": "date-time",
551
+ "as": "start"
552
+ }
712
553
  },
713
- "-11": {
714
- "description": "insufficient permission"
554
+ {
555
+ "name": "created_end_at",
556
+ "in": "query",
557
+ "required": false,
558
+ "description": "时间终点, YY-MM-DD (HH:MM:SS, 可选)",
559
+ "schema": {
560
+ "type": "string",
561
+ "format": "date-time",
562
+ "as": "end"
563
+ }
715
564
  },
716
- "700": {
717
- "description": "change online failed"
565
+ {
566
+ "name": "page",
567
+ "in": "query",
568
+ "required": false,
569
+ "description": "页数,从 1 开始",
570
+ "schema": {
571
+ "type": "integer",
572
+ "minimum": 1,
573
+ "default": 1
574
+ }
718
575
  },
719
- "400": {
720
- "description": "param validation failure"
721
- }
722
- }
723
- }
724
- },
725
- "/api/v1/permissions": {
726
- "get": {
727
- "summary": "Get list of Permissions of specified model",
728
- "operationId": "index",
729
- "tags": [
730
- "Permissions"
731
- ],
732
- "parameters": [
733
576
  {
734
- "name": "Token",
735
- "in": "header",
736
- "required": true,
737
- "description": "user token",
577
+ "name": "rows",
578
+ "in": "query",
579
+ "required": false,
580
+ "description": "per page, 请求的数据条数",
738
581
  "schema": {
739
- "type": "string"
582
+ "type": "integer",
583
+ "minimum": 1,
584
+ "default": 10
740
585
  }
741
586
  },
742
587
  {
743
- "name": "model",
588
+ "name": "export",
744
589
  "in": "query",
745
590
  "required": false,
591
+ "description": "是否将查询结果导出 Excel 文件",
746
592
  "schema": {
747
- "type": "string",
748
- "pattern": "^[A-Z]",
749
- "default": "User"
593
+ "type": "boolean",
594
+ "examples": [
595
+ {
596
+ "right_input": {
597
+ "value": true
598
+ }
599
+ },
600
+ {
601
+ "wrong_input": {
602
+ "value": "wrong input"
603
+ }
604
+ }
605
+ ]
750
606
  }
751
607
  }
752
608
  ],
@@ -781,21 +637,121 @@
781
637
  "data": {
782
638
  "type": "array",
783
639
  "items": {
784
- "type": "object"
640
+ "type": "object",
641
+ "properties": {
642
+ "id": {
643
+ "type": "integer"
644
+ },
645
+ "name": {
646
+ "type": "string"
647
+ },
648
+ "unit": {
649
+ "type": "string"
650
+ },
651
+ "price": {
652
+ "type": "number",
653
+ "format": "float"
654
+ },
655
+ "remarks": {
656
+ "type": "string"
657
+ },
658
+ "pic_path": {
659
+ "type": "string"
660
+ },
661
+ "creator": {
662
+ "type": "string"
663
+ },
664
+ "is_online": {
665
+ "type": "boolean"
666
+ },
667
+ "created_at": {
668
+ "type": "string",
669
+ "format": "date-time"
670
+ },
671
+ "updated_at": {
672
+ "type": "string",
673
+ "format": "date-time"
674
+ },
675
+ "category_info": {
676
+ "type": "object",
677
+ "properties": {
678
+ "id": {
679
+ "type": "integer"
680
+ },
681
+ "name": {
682
+ "type": "string"
683
+ },
684
+ "base_category_id": {
685
+ "type": "integer"
686
+ },
687
+ "icon_name": {
688
+ "type": "string"
689
+ },
690
+ "deleted_at": {
691
+ "type": "string",
692
+ "format": "date-time"
693
+ }
694
+ }
695
+ }
696
+ }
785
697
  }
786
698
  }
787
699
  }
788
700
  }
789
701
  }
790
702
  }
703
+ },
704
+ "-1": {
705
+ "description": "invalid token"
706
+ },
707
+ "-10": {
708
+ "description": "role verification failed"
709
+ },
710
+ "-11": {
711
+ "description": "insufficient permission"
712
+ },
713
+ "400": {
714
+ "description": "parameter validation failed"
715
+ }
716
+ },
717
+ "examples": [
718
+ {
719
+ "right_input": {
720
+ "value": {
721
+ "Token": "Token",
722
+ "view": "view",
723
+ "search_type": "search_type",
724
+ "value": "value",
725
+ "created_start_at": "created_start_at",
726
+ "created_end_at": "created_end_at",
727
+ "page": "page",
728
+ "rows": "rows",
729
+ "export": "export"
730
+ }
731
+ }
732
+ },
733
+ {
734
+ "wrong_input": {
735
+ "value": {
736
+ "Token": null,
737
+ "view": null,
738
+ "search_type": null,
739
+ "value": null,
740
+ "created_start_at": null,
741
+ "created_end_at": null,
742
+ "page": null,
743
+ "rows": null,
744
+ "export": null
745
+ }
746
+ }
791
747
  }
792
- }
748
+ ]
793
749
  },
794
750
  "post": {
795
- "summary": "POST create a Permission",
751
+ "summary": "POST create a good.",
796
752
  "operationId": "create",
797
753
  "tags": [
798
- "Permissions"
754
+ "Goods"
799
755
  ],
800
756
  "parameters": [
801
757
  {
@@ -810,7 +766,7 @@
810
766
  ],
811
767
  "requestBody": {
812
768
  "required": true,
813
- "description": "for creating a permission",
769
+ "description": "for creating the specified good",
814
770
  "content": {
815
771
  "multipart/form-data": {
816
772
  "schema": {
@@ -818,21 +774,69 @@
818
774
  "properties": {
819
775
  "name": {
820
776
  "type": "string",
821
- "description": "name of permission"
777
+ "description": "名字"
822
778
  },
823
- "condition": {
779
+ "category_id": {
780
+ "type": "integer",
781
+ "minimum": 1,
782
+ "as": "cate",
783
+ "not_permit": true,
784
+ "description": "子类 id"
785
+ },
786
+ "unit": {
824
787
  "type": "string",
825
- "default": "true",
826
- "description": "暂不必传"
788
+ "description": "单位"
789
+ },
790
+ "price": {
791
+ "type": "number",
792
+ "format": "float",
793
+ "minimum": 0,
794
+ "description": "单价"
795
+ },
796
+ "is_online": {
797
+ "type": "boolean",
798
+ "description": "是否上线?"
827
799
  },
828
800
  "remarks": {
829
- "type": "string"
801
+ "type": "string",
802
+ "description": "其他说明"
803
+ },
804
+ "pic_path": {
805
+ "type": "string",
806
+ "format": "url",
807
+ "is": "url",
808
+ "description": "图片路径"
830
809
  }
831
810
  },
832
811
  "required": [
833
- "name"
812
+ "name",
813
+ "category_id",
814
+ "unit",
815
+ "price"
834
816
  ]
835
- }
817
+ },
818
+ "examples": [
819
+ {
820
+ "right_input": {
821
+ "value": {
822
+ "name": "good1",
823
+ "category_id": 6,
824
+ "unit": "unit",
825
+ "price": 5.7
826
+ }
827
+ }
828
+ },
829
+ {
830
+ "wrong_input": {
831
+ "value": {
832
+ "name": "good2",
833
+ "category_id": 0,
834
+ "unit": "unit",
835
+ "price": -1
836
+ }
837
+ }
838
+ }
839
+ ]
836
840
  }
837
841
  }
838
842
  },
@@ -865,25 +869,37 @@
865
869
  "default": "Ruby"
866
870
  },
867
871
  "data": {
868
- "type": "array",
869
- "items": {
870
- "type": "object"
871
- }
872
+ "type": "string"
872
873
  }
873
874
  }
874
875
  }
875
876
  }
876
877
  }
878
+ },
879
+ "600": {
880
+ "description": "create failed"
881
+ },
882
+ "-1": {
883
+ "description": "invalid token"
884
+ },
885
+ "-10": {
886
+ "description": "role verification failed"
887
+ },
888
+ "-11": {
889
+ "description": "insufficient permission"
890
+ },
891
+ "400": {
892
+ "description": "parameter validation failed"
877
893
  }
878
894
  }
879
895
  }
880
896
  },
881
- "/api/v1/roles": {
897
+ "/api/v1/goods/{id}": {
882
898
  "get": {
883
- "summary": "Get list of Roles of specified model",
884
- "operationId": "index",
899
+ "summary": "GET the specified good.",
900
+ "operationId": "show",
885
901
  "tags": [
886
- "Roles"
902
+ "Goods"
887
903
  ],
888
904
  "parameters": [
889
905
  {
@@ -896,13 +912,12 @@
896
912
  }
897
913
  },
898
914
  {
899
- "name": "model",
900
- "in": "query",
901
- "required": false,
915
+ "name": "id",
916
+ "in": "path",
917
+ "required": true,
918
+ "description": "要查询的 id",
902
919
  "schema": {
903
- "type": "string",
904
- "pattern": "^[A-Z]",
905
- "default": "Admin"
920
+ "type": "integer"
906
921
  }
907
922
  }
908
923
  ],
@@ -937,21 +952,89 @@
937
952
  "data": {
938
953
  "type": "array",
939
954
  "items": {
940
- "type": "object"
955
+ "type": "object",
956
+ "properties": {
957
+ "id": {
958
+ "type": "integer"
959
+ },
960
+ "name": {
961
+ "type": "string"
962
+ },
963
+ "unit": {
964
+ "type": "string"
965
+ },
966
+ "price": {
967
+ "type": "number",
968
+ "format": "float"
969
+ },
970
+ "remarks": {
971
+ "type": "string"
972
+ },
973
+ "pic_path": {
974
+ "type": "string"
975
+ },
976
+ "creator": {
977
+ "type": "string"
978
+ },
979
+ "is_online": {
980
+ "type": "boolean"
981
+ },
982
+ "created_at": {
983
+ "type": "string",
984
+ "format": "date-time"
985
+ },
986
+ "updated_at": {
987
+ "type": "string",
988
+ "format": "date-time"
989
+ },
990
+ "category_info": {
991
+ "type": "object",
992
+ "properties": {
993
+ "id": {
994
+ "type": "integer"
995
+ },
996
+ "name": {
997
+ "type": "string"
998
+ },
999
+ "base_category_id": {
1000
+ "type": "integer"
1001
+ },
1002
+ "icon_name": {
1003
+ "type": "string"
1004
+ },
1005
+ "deleted_at": {
1006
+ "type": "string",
1007
+ "format": "date-time"
1008
+ }
1009
+ }
1010
+ }
1011
+ }
941
1012
  }
942
1013
  }
943
1014
  }
944
1015
  }
945
1016
  }
946
1017
  }
1018
+ },
1019
+ "-1": {
1020
+ "description": "invalid token"
1021
+ },
1022
+ "-10": {
1023
+ "description": "role verification failed"
1024
+ },
1025
+ "-11": {
1026
+ "description": "insufficient permission"
1027
+ },
1028
+ "400": {
1029
+ "description": "parameter validation failed"
947
1030
  }
948
1031
  }
949
1032
  },
950
- "post": {
951
- "summary": "POST create a Role",
952
- "operationId": "create",
1033
+ "patch": {
1034
+ "summary": "PATCH update the specified Good.",
1035
+ "operationId": "update",
953
1036
  "tags": [
954
- "Roles"
1037
+ "Goods"
955
1038
  ],
956
1039
  "parameters": [
957
1040
  {
@@ -960,38 +1043,379 @@
960
1043
  "required": true,
961
1044
  "description": "user token",
962
1045
  "schema": {
963
- "type": "string"
1046
+ "type": "string"
1047
+ }
1048
+ },
1049
+ {
1050
+ "name": "id",
1051
+ "in": "path",
1052
+ "required": true,
1053
+ "description": "要更新的 id",
1054
+ "schema": {
1055
+ "type": "integer"
1056
+ }
1057
+ }
1058
+ ],
1059
+ "requestBody": {
1060
+ "required": true,
1061
+ "description": "for updating the specified good",
1062
+ "content": {
1063
+ "multipart/form-data": {
1064
+ "schema": {
1065
+ "type": "object",
1066
+ "properties": {
1067
+ "name": {
1068
+ "type": "string",
1069
+ "description": "名字"
1070
+ },
1071
+ "category_id": {
1072
+ "type": "integer",
1073
+ "minimum": 1,
1074
+ "as": "cate",
1075
+ "not_permit": true,
1076
+ "description": "子类 id"
1077
+ },
1078
+ "unit": {
1079
+ "type": "string",
1080
+ "description": "单位"
1081
+ },
1082
+ "price": {
1083
+ "type": "number",
1084
+ "format": "float",
1085
+ "minimum": 0,
1086
+ "description": "单价"
1087
+ },
1088
+ "remarks": {
1089
+ "type": "string",
1090
+ "description": "其他说明"
1091
+ },
1092
+ "pic_path": {
1093
+ "type": "string",
1094
+ "format": "url",
1095
+ "is": "url",
1096
+ "description": "图片路径"
1097
+ },
1098
+ "is_online": {
1099
+ "type": "boolean",
1100
+ "description": "是否上线"
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ }
1106
+ },
1107
+ "responses": {
1108
+ "200": {
1109
+ "description": "success",
1110
+ "content": {
1111
+ "application/json": {
1112
+ "schema": {
1113
+ "type": "object",
1114
+ "properties": {
1115
+ "code": {
1116
+ "type": "integer",
1117
+ "default": 200
1118
+ },
1119
+ "msg": {
1120
+ "type": "string",
1121
+ "default": "success"
1122
+ },
1123
+ "total": {
1124
+ "type": "integer"
1125
+ },
1126
+ "timestamp": {
1127
+ "type": "integer",
1128
+ "format": "time",
1129
+ "is": "time"
1130
+ },
1131
+ "language": {
1132
+ "type": "string",
1133
+ "default": "Ruby"
1134
+ },
1135
+ "data": {
1136
+ "type": "string"
1137
+ }
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ },
1143
+ "601": {
1144
+ "description": "update failed"
1145
+ },
1146
+ "-1": {
1147
+ "description": "invalid token"
1148
+ },
1149
+ "-10": {
1150
+ "description": "role verification failed"
1151
+ },
1152
+ "-11": {
1153
+ "description": "insufficient permission"
1154
+ },
1155
+ "400": {
1156
+ "description": "parameter validation failed"
1157
+ }
1158
+ }
1159
+ },
1160
+ "delete": {
1161
+ "summary": "DELETE the specified good.",
1162
+ "operationId": "destroy",
1163
+ "tags": [
1164
+ "Goods"
1165
+ ],
1166
+ "parameters": [
1167
+ {
1168
+ "name": "Token",
1169
+ "in": "header",
1170
+ "required": true,
1171
+ "description": "user token",
1172
+ "schema": {
1173
+ "type": "string"
1174
+ }
1175
+ },
1176
+ {
1177
+ "name": "id",
1178
+ "in": "path",
1179
+ "required": true,
1180
+ "description": "要删除的 id",
1181
+ "schema": {
1182
+ "type": "integer"
1183
+ }
1184
+ }
1185
+ ],
1186
+ "responses": {
1187
+ "200": {
1188
+ "description": "success",
1189
+ "content": {
1190
+ "application/json": {
1191
+ "schema": {
1192
+ "type": "object",
1193
+ "properties": {
1194
+ "code": {
1195
+ "type": "integer",
1196
+ "default": 200
1197
+ },
1198
+ "msg": {
1199
+ "type": "string",
1200
+ "default": "success"
1201
+ },
1202
+ "total": {
1203
+ "type": "integer"
1204
+ },
1205
+ "timestamp": {
1206
+ "type": "integer",
1207
+ "format": "time",
1208
+ "is": "time"
1209
+ },
1210
+ "language": {
1211
+ "type": "string",
1212
+ "default": "Ruby"
1213
+ },
1214
+ "data": {
1215
+ "type": "string"
1216
+ }
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+ },
1222
+ "602": {
1223
+ "description": "destroy failed"
1224
+ },
1225
+ "-1": {
1226
+ "description": "invalid token"
1227
+ },
1228
+ "-10": {
1229
+ "description": "role verification failed"
1230
+ },
1231
+ "-11": {
1232
+ "description": "insufficient permission"
1233
+ },
1234
+ "400": {
1235
+ "description": "parameter validation failed"
1236
+ }
1237
+ }
1238
+ }
1239
+ },
1240
+ "/api/v1/goods/{id}/change_online": {
1241
+ "post": {
1242
+ "summary": "POST change online status of the specified good.",
1243
+ "operationId": "change_online",
1244
+ "tags": [
1245
+ "Goods"
1246
+ ],
1247
+ "parameters": [
1248
+ {
1249
+ "name": "Token",
1250
+ "in": "header",
1251
+ "required": true,
1252
+ "description": "user token",
1253
+ "schema": {
1254
+ "type": "string"
1255
+ }
1256
+ },
1257
+ {
1258
+ "name": "id",
1259
+ "in": "path",
1260
+ "required": true,
1261
+ "description": "要上/下线的物品 id",
1262
+ "schema": {
1263
+ "type": "integer"
1264
+ }
1265
+ }
1266
+ ],
1267
+ "responses": {
1268
+ "200": {
1269
+ "description": "success",
1270
+ "content": {
1271
+ "application/json": {
1272
+ "schema": {
1273
+ "type": "object",
1274
+ "properties": {
1275
+ "code": {
1276
+ "type": "integer",
1277
+ "default": 200
1278
+ },
1279
+ "msg": {
1280
+ "type": "string",
1281
+ "default": "success"
1282
+ },
1283
+ "total": {
1284
+ "type": "integer"
1285
+ },
1286
+ "timestamp": {
1287
+ "type": "integer",
1288
+ "format": "time",
1289
+ "is": "time"
1290
+ },
1291
+ "language": {
1292
+ "type": "string",
1293
+ "default": "Ruby"
1294
+ },
1295
+ "data": {
1296
+ "type": "string"
1297
+ }
1298
+ }
1299
+ }
1300
+ }
1301
+ }
1302
+ },
1303
+ "700": {
1304
+ "description": "change online failed"
1305
+ },
1306
+ "-1": {
1307
+ "description": "invalid token"
1308
+ },
1309
+ "-10": {
1310
+ "description": "role verification failed"
1311
+ },
1312
+ "-11": {
1313
+ "description": "insufficient permission"
1314
+ },
1315
+ "400": {
1316
+ "description": "parameter validation failed"
1317
+ }
1318
+ }
1319
+ }
1320
+ },
1321
+ "/api/v1/inventories": {
1322
+ "get": {
1323
+ "description": "GET list of inventories.",
1324
+ "summary": "GET list of inventories.",
1325
+ "operationId": "index",
1326
+ "tags": [
1327
+ "Inventories"
1328
+ ],
1329
+ "parameters": [
1330
+ {
1331
+ "name": "created_start_at",
1332
+ "in": "query",
1333
+ "required": false,
1334
+ "description": "时间起点, YY-MM-DD (HH:MM:SS, 可选)",
1335
+ "schema": {
1336
+ "type": "string",
1337
+ "format": "date-time",
1338
+ "as": "start"
1339
+ }
1340
+ },
1341
+ {
1342
+ "name": "created_end_at",
1343
+ "in": "query",
1344
+ "required": false,
1345
+ "description": "时间终点, YY-MM-DD (HH:MM:SS, 可选)",
1346
+ "schema": {
1347
+ "type": "string",
1348
+ "format": "date-time",
1349
+ "as": "end"
1350
+ }
1351
+ },
1352
+ {
1353
+ "name": "value",
1354
+ "in": "query",
1355
+ "required": false,
1356
+ "description": "查询词",
1357
+ "schema": {
1358
+ "type": "string"
1359
+ }
1360
+ },
1361
+ {
1362
+ "name": "page",
1363
+ "in": "query",
1364
+ "required": false,
1365
+ "description": "页数,从 1 开始",
1366
+ "schema": {
1367
+ "type": "integer",
1368
+ "minimum": 1,
1369
+ "default": 1
1370
+ }
1371
+ },
1372
+ {
1373
+ "name": "rows",
1374
+ "in": "query",
1375
+ "required": false,
1376
+ "description": "per page, 请求的数据条数",
1377
+ "schema": {
1378
+ "type": "integer",
1379
+ "minimum": 1,
1380
+ "default": 10
1381
+ }
1382
+ },
1383
+ {
1384
+ "name": "store_code",
1385
+ "in": "query",
1386
+ "required": true,
1387
+ "description": "商店代号",
1388
+ "schema": {
1389
+ "type": "string"
1390
+ }
1391
+ },
1392
+ {
1393
+ "name": "search_type",
1394
+ "in": "query",
1395
+ "required": false,
1396
+ "description": "搜索的字段名,允许值:<br/><br/>1/ name<br/>2/ creator<br/>3/ category_name<br/>4/ unit<br/>5/ price",
1397
+ "schema": {
1398
+ "type": "string",
1399
+ "enum": [
1400
+ "name",
1401
+ "creator",
1402
+ "category_name",
1403
+ "unit",
1404
+ "price"
1405
+ ],
1406
+ "as": "field"
1407
+ }
1408
+ },
1409
+ {
1410
+ "name": "export",
1411
+ "in": "query",
1412
+ "required": false,
1413
+ "description": "是否将查询结果导出 Excel 文件",
1414
+ "schema": {
1415
+ "type": "boolean"
964
1416
  }
965
1417
  }
966
1418
  ],
967
- "requestBody": {
968
- "required": true,
969
- "description": "for creating a role",
970
- "content": {
971
- "multipart/form-data": {
972
- "schema": {
973
- "type": "object",
974
- "properties": {
975
- "name": {
976
- "type": "string",
977
- "description": "name of role"
978
- },
979
- "condition": {
980
- "type": "string",
981
- "default": "true",
982
- "description": "暂不必传"
983
- },
984
- "remarks": {
985
- "type": "string"
986
- }
987
- },
988
- "required": [
989
- "name"
990
- ]
991
- }
992
- }
993
- }
994
- },
995
1419
  "responses": {
996
1420
  "200": {
997
1421
  "description": "success",
@@ -1023,23 +1447,35 @@
1023
1447
  "data": {
1024
1448
  "type": "array",
1025
1449
  "items": {
1026
- "type": "object"
1450
+ "type": ""
1027
1451
  }
1028
1452
  }
1029
1453
  }
1030
1454
  }
1031
1455
  }
1032
1456
  }
1457
+ },
1458
+ "-1": {
1459
+ "description": "invalid token"
1460
+ },
1461
+ "-10": {
1462
+ "description": "role verification failed"
1463
+ },
1464
+ "-11": {
1465
+ "description": "insufficient permission"
1466
+ },
1467
+ "400": {
1468
+ "description": "parameter validation failed"
1033
1469
  }
1034
1470
  }
1035
1471
  }
1036
1472
  },
1037
- "/api/v1/roles/{id}/permissions": {
1038
- "post": {
1039
- "summary": "GET Permissions of specified role",
1040
- "operationId": "permissions",
1473
+ "/api/v1/permissions": {
1474
+ "get": {
1475
+ "summary": "GET permissions list of the specified model.",
1476
+ "operationId": "index",
1041
1477
  "tags": [
1042
- "Roles"
1478
+ "Permissions"
1043
1479
  ],
1044
1480
  "parameters": [
1045
1481
  {
@@ -1052,12 +1488,13 @@
1052
1488
  }
1053
1489
  },
1054
1490
  {
1055
- "name": "id",
1056
- "in": "path",
1057
- "required": true,
1058
- "description": "要查询的 role id",
1491
+ "name": "model",
1492
+ "in": "query",
1493
+ "required": false,
1059
1494
  "schema": {
1060
- "type": "integer"
1495
+ "type": "string",
1496
+ "pattern": "^[A-Z]",
1497
+ "default": "User"
1061
1498
  }
1062
1499
  }
1063
1500
  ],
@@ -1092,23 +1529,52 @@
1092
1529
  "data": {
1093
1530
  "type": "array",
1094
1531
  "items": {
1095
- "type": "object"
1532
+ "type": "object",
1533
+ "properties": {
1534
+ "id": {
1535
+ "type": "integer"
1536
+ },
1537
+ "name": {
1538
+ "type": "string"
1539
+ },
1540
+ "remarks": {
1541
+ "type": "string"
1542
+ },
1543
+ "created_at": {
1544
+ "type": "string",
1545
+ "format": "date-time"
1546
+ },
1547
+ "updated_at": {
1548
+ "type": "string",
1549
+ "format": "date-time"
1550
+ }
1551
+ }
1096
1552
  }
1097
1553
  }
1098
1554
  }
1099
1555
  }
1100
1556
  }
1101
1557
  }
1558
+ },
1559
+ "-1": {
1560
+ "description": "invalid token"
1561
+ },
1562
+ "-10": {
1563
+ "description": "role verification failed"
1564
+ },
1565
+ "-11": {
1566
+ "description": "insufficient permission"
1567
+ },
1568
+ "400": {
1569
+ "description": "parameter validation failed"
1102
1570
  }
1103
1571
  }
1104
- }
1105
- },
1106
- "/api/v1/roles/{id}/permissions/add": {
1572
+ },
1107
1573
  "post": {
1108
- "summary": "POST add Permissions to specified role",
1109
- "operationId": "permissions_add",
1574
+ "summary": "PATCH update the specified permission.",
1575
+ "operationId": "create",
1110
1576
  "tags": [
1111
- "Roles"
1577
+ "Permissions"
1112
1578
  ],
1113
1579
  "parameters": [
1114
1580
  {
@@ -1119,37 +1585,29 @@
1119
1585
  "schema": {
1120
1586
  "type": "string"
1121
1587
  }
1122
- },
1123
- {
1124
- "name": "id",
1125
- "in": "path",
1126
- "required": true,
1127
- "description": "role id",
1128
- "schema": {
1129
- "type": "integer"
1130
- }
1131
1588
  }
1132
1589
  ],
1133
1590
  "requestBody": {
1134
1591
  "required": true,
1135
- "description": "for adding permissions to role",
1592
+ "description": "for updating the specified permission",
1136
1593
  "content": {
1137
1594
  "multipart/form-data": {
1138
1595
  "schema": {
1139
1596
  "type": "object",
1140
1597
  "properties": {
1141
- "permission_ids": {
1142
- "type": "array",
1143
- "items": {
1144
- "type": "integer",
1145
- "minimum": 1
1146
- },
1147
- "minLength": 1
1598
+ "name": {
1599
+ "type": "string",
1600
+ "description": "name of permission"
1601
+ },
1602
+ "condition": {
1603
+ "type": "string",
1604
+ "default": "true",
1605
+ "description": "暂不必传"
1606
+ },
1607
+ "remarks": {
1608
+ "type": "string"
1148
1609
  }
1149
- },
1150
- "required": [
1151
- "permission_ids"
1152
- ]
1610
+ }
1153
1611
  }
1154
1612
  }
1155
1613
  }
@@ -1183,25 +1641,37 @@
1183
1641
  "default": "Ruby"
1184
1642
  },
1185
1643
  "data": {
1186
- "type": "array",
1187
- "items": {
1188
- "type": "object"
1189
- }
1644
+ "type": "string"
1190
1645
  }
1191
1646
  }
1192
1647
  }
1193
1648
  }
1194
1649
  }
1650
+ },
1651
+ "600": {
1652
+ "description": "create failed"
1653
+ },
1654
+ "-1": {
1655
+ "description": "invalid token"
1656
+ },
1657
+ "-10": {
1658
+ "description": "role verification failed"
1659
+ },
1660
+ "-11": {
1661
+ "description": "insufficient permission"
1662
+ },
1663
+ "400": {
1664
+ "description": "parameter validation failed"
1195
1665
  }
1196
1666
  }
1197
1667
  }
1198
1668
  },
1199
- "/api/v1/roles/{id}/permissions/remove": {
1200
- "post": {
1201
- "summary": "POST remove Permissions from specified role",
1202
- "operationId": "permissions_remove",
1669
+ "/api/v1/permissions/{id}": {
1670
+ "delete": {
1671
+ "summary": "DELETE the specified permission.",
1672
+ "operationId": "destroy",
1203
1673
  "tags": [
1204
- "Roles"
1674
+ "Permissions"
1205
1675
  ],
1206
1676
  "parameters": [
1207
1677
  {
@@ -1217,36 +1687,12 @@
1217
1687
  "name": "id",
1218
1688
  "in": "path",
1219
1689
  "required": true,
1220
- "description": "role id",
1690
+ "description": "要删除的 id",
1221
1691
  "schema": {
1222
1692
  "type": "integer"
1223
1693
  }
1224
1694
  }
1225
1695
  ],
1226
- "requestBody": {
1227
- "required": true,
1228
- "description": "for removing permissions from the role",
1229
- "content": {
1230
- "multipart/form-data": {
1231
- "schema": {
1232
- "type": "object",
1233
- "properties": {
1234
- "permission_ids": {
1235
- "type": "array",
1236
- "items": {
1237
- "type": "integer",
1238
- "minimum": 1
1239
- },
1240
- "minLength": 1
1241
- }
1242
- },
1243
- "required": [
1244
- "permission_ids"
1245
- ]
1246
- }
1247
- }
1248
- }
1249
- },
1250
1696
  "responses": {
1251
1697
  "200": {
1252
1698
  "description": "success",
@@ -1276,45 +1722,56 @@
1276
1722
  "default": "Ruby"
1277
1723
  },
1278
1724
  "data": {
1279
- "type": "array",
1280
- "items": {
1281
- "type": "object"
1282
- }
1725
+ "type": "string"
1283
1726
  }
1284
1727
  }
1285
1728
  }
1286
1729
  }
1287
1730
  }
1731
+ },
1732
+ "602": {
1733
+ "description": "destroy failed"
1734
+ },
1735
+ "-1": {
1736
+ "description": "invalid token"
1737
+ },
1738
+ "-10": {
1739
+ "description": "role verification failed"
1740
+ },
1741
+ "-11": {
1742
+ "description": "insufficient permission"
1743
+ },
1744
+ "400": {
1745
+ "description": "parameter validation failed"
1288
1746
  }
1289
1747
  }
1290
1748
  }
1291
1749
  },
1292
- "/api/v1/categories": {
1750
+ "/api/v1/roles": {
1293
1751
  "get": {
1294
- "summary": "Get list of Categories.",
1752
+ "summary": "GET roles list of the specified model",
1295
1753
  "operationId": "index",
1296
1754
  "tags": [
1297
- "Categories"
1755
+ "Roles"
1298
1756
  ],
1299
1757
  "parameters": [
1300
1758
  {
1301
- "name": "page",
1302
- "in": "query",
1303
- "required": false,
1304
- "description": "偏移量,从 0 开始",
1759
+ "name": "Token",
1760
+ "in": "header",
1761
+ "required": true,
1762
+ "description": "user token",
1305
1763
  "schema": {
1306
- "type": "integer",
1307
- "minimum": 1
1764
+ "type": "string"
1308
1765
  }
1309
1766
  },
1310
1767
  {
1311
- "name": "rows",
1768
+ "name": "model",
1312
1769
  "in": "query",
1313
1770
  "required": false,
1314
- "description": "per page, 请求的数据条数",
1315
1771
  "schema": {
1316
- "type": "integer",
1317
- "minimum": 1
1772
+ "type": "string",
1773
+ "pattern": "^[A-Z]",
1774
+ "default": "User"
1318
1775
  }
1319
1776
  }
1320
1777
  ],
@@ -1349,7 +1806,29 @@
1349
1806
  "data": {
1350
1807
  "type": "array",
1351
1808
  "items": {
1352
- "type": "object"
1809
+ "type": "object",
1810
+ "properties": {
1811
+ "id": {
1812
+ "type": "integer"
1813
+ },
1814
+ "name": {
1815
+ "type": "string"
1816
+ },
1817
+ "remarks": {
1818
+ "type": "string"
1819
+ },
1820
+ "base_role_id": {
1821
+ "type": "integer"
1822
+ },
1823
+ "created_at": {
1824
+ "type": "string",
1825
+ "format": "date-time"
1826
+ },
1827
+ "updated_at": {
1828
+ "type": "string",
1829
+ "format": "date-time"
1830
+ }
1831
+ }
1353
1832
  }
1354
1833
  }
1355
1834
  }
@@ -1367,15 +1846,15 @@
1367
1846
  "description": "insufficient permission"
1368
1847
  },
1369
1848
  "400": {
1370
- "description": "param validation failure"
1849
+ "description": "parameter validation failed"
1371
1850
  }
1372
1851
  }
1373
1852
  },
1374
1853
  "post": {
1375
- "summary": "Create a Category, returns id of the category that was created.",
1854
+ "summary": "POST create a role",
1376
1855
  "operationId": "create",
1377
1856
  "tags": [
1378
- "Categories"
1857
+ "Roles"
1379
1858
  ],
1380
1859
  "parameters": [
1381
1860
  {
@@ -1390,7 +1869,7 @@
1390
1869
  ],
1391
1870
  "requestBody": {
1392
1871
  "required": true,
1393
- "description": "for creating a category",
1872
+ "description": "for creating the specified role",
1394
1873
  "content": {
1395
1874
  "multipart/form-data": {
1396
1875
  "schema": {
@@ -1398,24 +1877,19 @@
1398
1877
  "properties": {
1399
1878
  "name": {
1400
1879
  "type": "string",
1401
- "description": "名字"
1402
- },
1403
- "is_smaller": {
1404
- "type": "boolean",
1405
- "description": "icon name"
1880
+ "description": "name of role"
1406
1881
  },
1407
- "icon_name": {
1882
+ "condition": {
1408
1883
  "type": "string",
1409
- "description": "是否二级分类?"
1884
+ "default": "true",
1885
+ "description": "暂不必传"
1410
1886
  },
1411
- "base_id": {
1412
- "type": "integer",
1413
- "description": "一级分类的 id"
1887
+ "remarks": {
1888
+ "type": "string"
1414
1889
  }
1415
1890
  },
1416
1891
  "required": [
1417
- "name",
1418
- "is_smaller"
1892
+ "name"
1419
1893
  ]
1420
1894
  }
1421
1895
  }
@@ -1450,10 +1924,7 @@
1450
1924
  "default": "Ruby"
1451
1925
  },
1452
1926
  "data": {
1453
- "type": "array",
1454
- "items": {
1455
- "type": "object"
1456
- }
1927
+ "type": "string"
1457
1928
  }
1458
1929
  }
1459
1930
  }
@@ -1473,17 +1944,37 @@
1473
1944
  "description": "insufficient permission"
1474
1945
  },
1475
1946
  "400": {
1476
- "description": "param validation failure"
1947
+ "description": "parameter validation failed"
1477
1948
  }
1478
1949
  }
1479
1950
  }
1480
1951
  },
1481
- "/api/v1/category_list": {
1952
+ "/api/v1/roles/{id}": {
1482
1953
  "get": {
1483
- "summary": "Get nested list of Categories.",
1484
- "operationId": "nested_list",
1954
+ "summary": "GET the specified role.",
1955
+ "operationId": "show",
1485
1956
  "tags": [
1486
- "Categories"
1957
+ "Roles"
1958
+ ],
1959
+ "parameters": [
1960
+ {
1961
+ "name": "Token",
1962
+ "in": "header",
1963
+ "required": true,
1964
+ "description": "user token",
1965
+ "schema": {
1966
+ "type": "string"
1967
+ }
1968
+ },
1969
+ {
1970
+ "name": "id",
1971
+ "in": "path",
1972
+ "required": true,
1973
+ "description": "要查询的 id",
1974
+ "schema": {
1975
+ "type": "integer"
1976
+ }
1977
+ }
1487
1978
  ],
1488
1979
  "responses": {
1489
1980
  "200": {
@@ -1516,7 +2007,29 @@
1516
2007
  "data": {
1517
2008
  "type": "array",
1518
2009
  "items": {
1519
- "type": "object"
2010
+ "type": "object",
2011
+ "properties": {
2012
+ "id": {
2013
+ "type": "integer"
2014
+ },
2015
+ "name": {
2016
+ "type": "string"
2017
+ },
2018
+ "remarks": {
2019
+ "type": "string"
2020
+ },
2021
+ "base_role_id": {
2022
+ "type": "integer"
2023
+ },
2024
+ "created_at": {
2025
+ "type": "string",
2026
+ "format": "date-time"
2027
+ },
2028
+ "updated_at": {
2029
+ "type": "string",
2030
+ "format": "date-time"
2031
+ }
2032
+ }
1520
2033
  }
1521
2034
  }
1522
2035
  }
@@ -1534,17 +2047,15 @@
1534
2047
  "description": "insufficient permission"
1535
2048
  },
1536
2049
  "400": {
1537
- "description": "param validation failure"
2050
+ "description": "parameter validation failed"
1538
2051
  }
1539
2052
  }
1540
- }
1541
- },
1542
- "/api/v1/categories/{id}": {
1543
- "patch": {
1544
- "summary": "Update a Category.",
1545
- "operationId": "update",
2053
+ },
2054
+ "delete": {
2055
+ "summary": "DELETE the specified role.",
2056
+ "operationId": "destroy",
1546
2057
  "tags": [
1547
- "Categories"
2058
+ "Roles"
1548
2059
  ],
1549
2060
  "parameters": [
1550
2061
  {
@@ -1560,41 +2071,12 @@
1560
2071
  "name": "id",
1561
2072
  "in": "path",
1562
2073
  "required": true,
1563
- "description": "要更新的 id",
2074
+ "description": "要删除的 id",
1564
2075
  "schema": {
1565
2076
  "type": "integer"
1566
2077
  }
1567
2078
  }
1568
2079
  ],
1569
- "requestBody": {
1570
- "required": true,
1571
- "description": "for creating a category",
1572
- "content": {
1573
- "multipart/form-data": {
1574
- "schema": {
1575
- "type": "object",
1576
- "properties": {
1577
- "name": {
1578
- "type": "string",
1579
- "description": "名字"
1580
- },
1581
- "is_smaller": {
1582
- "type": "boolean",
1583
- "description": "icon name"
1584
- },
1585
- "icon_name": {
1586
- "type": "string",
1587
- "description": "是否二级分类?"
1588
- },
1589
- "base_id": {
1590
- "type": "integer",
1591
- "description": "一级分类的 id"
1592
- }
1593
- }
1594
- }
1595
- }
1596
- }
1597
- },
1598
2080
  "responses": {
1599
2081
  "200": {
1600
2082
  "description": "success",
@@ -1624,18 +2106,15 @@
1624
2106
  "default": "Ruby"
1625
2107
  },
1626
2108
  "data": {
1627
- "type": "array",
1628
- "items": {
1629
- "type": "object"
1630
- }
2109
+ "type": "string"
1631
2110
  }
1632
2111
  }
1633
2112
  }
1634
2113
  }
1635
2114
  }
1636
2115
  },
1637
- "601": {
1638
- "description": "update failed"
2116
+ "602": {
2117
+ "description": "destroy failed"
1639
2118
  },
1640
2119
  "-1": {
1641
2120
  "description": "invalid token"
@@ -1647,15 +2126,17 @@
1647
2126
  "description": "insufficient permission"
1648
2127
  },
1649
2128
  "400": {
1650
- "description": "param validation failure"
2129
+ "description": "parameter validation failed"
1651
2130
  }
1652
2131
  }
1653
- },
1654
- "delete": {
1655
- "summary": "Delete a Category.",
1656
- "operationId": "destroy",
2132
+ }
2133
+ },
2134
+ "/api/v1/roles/{id}/permissions": {
2135
+ "get": {
2136
+ "summary": "GET permissions of specified role",
2137
+ "operationId": "permissions",
1657
2138
  "tags": [
1658
- "Categories"
2139
+ "Roles"
1659
2140
  ],
1660
2141
  "parameters": [
1661
2142
  {
@@ -1671,7 +2152,7 @@
1671
2152
  "name": "id",
1672
2153
  "in": "path",
1673
2154
  "required": true,
1674
- "description": "要删除的 id",
2155
+ "description": "要查询的 role id",
1675
2156
  "schema": {
1676
2157
  "type": "integer"
1677
2158
  }
@@ -1706,19 +2187,13 @@
1706
2187
  "default": "Ruby"
1707
2188
  },
1708
2189
  "data": {
1709
- "type": "array",
1710
- "items": {
1711
- "type": "object"
1712
- }
2190
+ "type": "string"
1713
2191
  }
1714
2192
  }
1715
2193
  }
1716
2194
  }
1717
2195
  }
1718
2196
  },
1719
- "602": {
1720
- "description": "destroy failed"
1721
- },
1722
2197
  "-1": {
1723
2198
  "description": "invalid token"
1724
2199
  },
@@ -1729,100 +2204,62 @@
1729
2204
  "description": "insufficient permission"
1730
2205
  },
1731
2206
  "400": {
1732
- "description": "param validation failure"
2207
+ "description": "parameter validation failed"
1733
2208
  }
1734
2209
  }
1735
2210
  }
1736
2211
  },
1737
- "/api/v1/inventories": {
1738
- "get": {
1739
- "description": "Get list of Goods",
1740
- "summary": "Get list of Inventories.",
1741
- "operationId": "index",
2212
+ "/api/v1/roles/{id}/permissions/modify": {
2213
+ "post": {
2214
+ "summary": "POST modify permissions to the specified role and then save to db",
2215
+ "operationId": "permissions_modify",
1742
2216
  "tags": [
1743
- "Inventories"
2217
+ "Roles"
1744
2218
  ],
1745
2219
  "parameters": [
1746
2220
  {
1747
- "name": "created_start_at",
1748
- "in": "query",
1749
- "required": false,
1750
- "description": "时间起点, YY-MM-DD (HH:MM:SS, 可选)",
1751
- "schema": {
1752
- "type": "string",
1753
- "format": "date-time",
1754
- "as": "start"
1755
- }
1756
- },
1757
- {
1758
- "name": "created_end_at",
1759
- "in": "query",
1760
- "required": false,
1761
- "description": "时间终点, YY-MM-DD (HH:MM:SS, 可选)",
1762
- "schema": {
1763
- "type": "string",
1764
- "format": "date-time",
1765
- "as": "end"
1766
- }
1767
- },
1768
- {
1769
- "name": "page",
1770
- "in": "query",
1771
- "required": false,
1772
- "description": "页数,从 1 开始",
1773
- "schema": {
1774
- "type": "integer",
1775
- "minimum": 1,
1776
- "default": 1
1777
- }
1778
- },
1779
- {
1780
- "name": "rows",
1781
- "in": "query",
1782
- "required": false,
1783
- "description": "per page, 请求的数据条数",
1784
- "schema": {
1785
- "type": "integer",
1786
- "minimum": 1,
1787
- "default": 10
1788
- }
1789
- },
1790
- {
1791
- "name": "store_code",
1792
- "in": "query",
2221
+ "name": "Token",
2222
+ "in": "header",
1793
2223
  "required": true,
1794
- "description": "商店代号",
2224
+ "description": "user token",
1795
2225
  "schema": {
1796
2226
  "type": "string"
1797
2227
  }
1798
2228
  },
1799
2229
  {
1800
- "name": "search_type",
1801
- "in": "query",
1802
- "required": false,
1803
- "description": "搜索的字段名,允许值:<br/>1/ name<br/>2/ creator<br/>3/ category_name<br/>4/ unit<br/>5/ price",
1804
- "schema": {
1805
- "type": "string",
1806
- "enum": [
1807
- "name",
1808
- "creator",
1809
- "category_name",
1810
- "unit",
1811
- "price"
1812
- ],
1813
- "as": "field"
1814
- }
1815
- },
1816
- {
1817
- "name": "export",
1818
- "in": "query",
1819
- "required": false,
1820
- "description": "是否将查询结果导出 Excel 文件",
2230
+ "name": "id",
2231
+ "in": "path",
2232
+ "required": true,
2233
+ "description": "role id",
1821
2234
  "schema": {
1822
- "type": "boolean"
2235
+ "type": "integer"
1823
2236
  }
1824
2237
  }
1825
2238
  ],
2239
+ "requestBody": {
2240
+ "required": true,
2241
+ "description": "for modifying permissions to the specified role",
2242
+ "content": {
2243
+ "multipart/form-data": {
2244
+ "schema": {
2245
+ "type": "object",
2246
+ "properties": {
2247
+ "permission_ids": {
2248
+ "type": "array",
2249
+ "items": {
2250
+ "type": "integer",
2251
+ "minimum": 1
2252
+ },
2253
+ "minItems": 1
2254
+ }
2255
+ },
2256
+ "required": [
2257
+ "permission_ids"
2258
+ ]
2259
+ }
2260
+ }
2261
+ }
2262
+ },
1826
2263
  "responses": {
1827
2264
  "200": {
1828
2265
  "description": "success",
@@ -1852,22 +2289,31 @@
1852
2289
  "default": "Ruby"
1853
2290
  },
1854
2291
  "data": {
1855
- "type": "array",
1856
- "items": {
1857
- "type": "object"
1858
- }
2292
+ "type": "string"
1859
2293
  }
1860
2294
  }
1861
2295
  }
1862
2296
  }
1863
2297
  }
2298
+ },
2299
+ "-1": {
2300
+ "description": "invalid token"
2301
+ },
2302
+ "-10": {
2303
+ "description": "role verification failed"
2304
+ },
2305
+ "-11": {
2306
+ "description": "insufficient permission"
2307
+ },
2308
+ "400": {
2309
+ "description": "parameter validation failed"
1864
2310
  }
1865
2311
  }
1866
2312
  }
1867
2313
  },
1868
2314
  "/api/v1/stores": {
1869
2315
  "get": {
1870
- "summary": "Get list of Stores.",
2316
+ "summary": "GET list of stores.",
1871
2317
  "operationId": "index",
1872
2318
  "tags": [
1873
2319
  "Stores"
@@ -1925,7 +2371,18 @@
1925
2371
  "data": {
1926
2372
  "type": "array",
1927
2373
  "items": {
1928
- "type": "object"
2374
+ "type": "object",
2375
+ "properties": {
2376
+ "id": {
2377
+ "type": "integer"
2378
+ },
2379
+ "code": {
2380
+ "type": "string"
2381
+ },
2382
+ "addr": {
2383
+ "type": "string"
2384
+ }
2385
+ }
1929
2386
  }
1930
2387
  }
1931
2388
  }
@@ -1943,12 +2400,12 @@
1943
2400
  "description": "insufficient permission"
1944
2401
  },
1945
2402
  "400": {
1946
- "description": "param validation failure"
2403
+ "description": "parameter validation failed"
1947
2404
  }
1948
2405
  }
1949
2406
  },
1950
2407
  "post": {
1951
- "summary": "Create a Store, returns id of the store that was created.",
2408
+ "summary": "POST create a store.",
1952
2409
  "operationId": "create",
1953
2410
  "tags": [
1954
2411
  "Stores"
@@ -1966,7 +2423,7 @@
1966
2423
  ],
1967
2424
  "requestBody": {
1968
2425
  "required": true,
1969
- "description": "for creating a store",
2426
+ "description": "for creating the specified store",
1970
2427
  "content": {
1971
2428
  "multipart/form-data": {
1972
2429
  "schema": {
@@ -2018,10 +2475,7 @@
2018
2475
  "default": "Ruby"
2019
2476
  },
2020
2477
  "data": {
2021
- "type": "array",
2022
- "items": {
2023
- "type": "object"
2024
- }
2478
+ "type": "string"
2025
2479
  }
2026
2480
  }
2027
2481
  }
@@ -2041,18 +2495,29 @@
2041
2495
  "description": "insufficient permission"
2042
2496
  },
2043
2497
  "400": {
2044
- "description": "param validation failure"
2498
+ "description": "parameter validation failed"
2045
2499
  }
2046
2500
  }
2047
2501
  }
2048
2502
  },
2049
2503
  "/api/v1/stores/{id}": {
2050
2504
  "get": {
2051
- "summary": "Show a Store.",
2505
+ "summary": "GET the specified store.",
2052
2506
  "operationId": "show",
2053
2507
  "tags": [
2054
2508
  "Stores"
2055
2509
  ],
2510
+ "parameters": [
2511
+ {
2512
+ "name": "id",
2513
+ "in": "path",
2514
+ "required": true,
2515
+ "description": "要查询的 id",
2516
+ "schema": {
2517
+ "type": "integer"
2518
+ }
2519
+ }
2520
+ ],
2056
2521
  "responses": {
2057
2522
  "200": {
2058
2523
  "description": "success",
@@ -2084,7 +2549,18 @@
2084
2549
  "data": {
2085
2550
  "type": "array",
2086
2551
  "items": {
2087
- "type": "object"
2552
+ "type": "object",
2553
+ "properties": {
2554
+ "id": {
2555
+ "type": "integer"
2556
+ },
2557
+ "code": {
2558
+ "type": "string"
2559
+ },
2560
+ "addr": {
2561
+ "type": "string"
2562
+ }
2563
+ }
2088
2564
  }
2089
2565
  }
2090
2566
  }
@@ -2102,12 +2578,12 @@
2102
2578
  "description": "insufficient permission"
2103
2579
  },
2104
2580
  "400": {
2105
- "description": "param validation failure"
2581
+ "description": "parameter validation failed"
2106
2582
  }
2107
2583
  }
2108
2584
  },
2109
2585
  "patch": {
2110
- "summary": "Update a Store.",
2586
+ "summary": "POST update the specified store.",
2111
2587
  "operationId": "update",
2112
2588
  "tags": [
2113
2589
  "Stores"
@@ -2134,7 +2610,7 @@
2134
2610
  ],
2135
2611
  "requestBody": {
2136
2612
  "required": true,
2137
- "description": "for updating a store",
2613
+ "description": "for updating the specified store",
2138
2614
  "content": {
2139
2615
  "multipart/form-data": {
2140
2616
  "schema": {
@@ -2152,7 +2628,86 @@
2152
2628
  }
2153
2629
  }
2154
2630
  }
2155
- },
2631
+ },
2632
+ "responses": {
2633
+ "200": {
2634
+ "description": "success",
2635
+ "content": {
2636
+ "application/json": {
2637
+ "schema": {
2638
+ "type": "object",
2639
+ "properties": {
2640
+ "code": {
2641
+ "type": "integer",
2642
+ "default": 200
2643
+ },
2644
+ "msg": {
2645
+ "type": "string",
2646
+ "default": "success"
2647
+ },
2648
+ "total": {
2649
+ "type": "integer"
2650
+ },
2651
+ "timestamp": {
2652
+ "type": "integer",
2653
+ "format": "time",
2654
+ "is": "time"
2655
+ },
2656
+ "language": {
2657
+ "type": "string",
2658
+ "default": "Ruby"
2659
+ },
2660
+ "data": {
2661
+ "type": "string"
2662
+ }
2663
+ }
2664
+ }
2665
+ }
2666
+ }
2667
+ },
2668
+ "601": {
2669
+ "description": "update failed"
2670
+ },
2671
+ "-1": {
2672
+ "description": "invalid token"
2673
+ },
2674
+ "-10": {
2675
+ "description": "role verification failed"
2676
+ },
2677
+ "-11": {
2678
+ "description": "insufficient permission"
2679
+ },
2680
+ "400": {
2681
+ "description": "parameter validation failed"
2682
+ }
2683
+ }
2684
+ },
2685
+ "delete": {
2686
+ "summary": "DELETE the specified store.",
2687
+ "operationId": "destroy",
2688
+ "tags": [
2689
+ "Stores"
2690
+ ],
2691
+ "parameters": [
2692
+ {
2693
+ "name": "Token",
2694
+ "in": "header",
2695
+ "required": true,
2696
+ "description": "user token",
2697
+ "schema": {
2698
+ "type": "string"
2699
+ }
2700
+ },
2701
+ {
2702
+ "name": "id",
2703
+ "in": "path",
2704
+ "required": true,
2705
+ "description": "要删除的 id",
2706
+ "schema": {
2707
+ "type": "integer"
2708
+ }
2709
+ }
2710
+ ],
2156
2711
  "responses": {
2157
2712
  "200": {
2158
2713
  "description": "success",
@@ -2182,18 +2737,15 @@
2182
2737
  "default": "Ruby"
2183
2738
  },
2184
2739
  "data": {
2185
- "type": "array",
2186
- "items": {
2187
- "type": "object"
2188
- }
2740
+ "type": "string"
2189
2741
  }
2190
2742
  }
2191
2743
  }
2192
2744
  }
2193
2745
  }
2194
2746
  },
2195
- "601": {
2196
- "description": "update failed"
2747
+ "602": {
2748
+ "description": "destroy failed"
2197
2749
  },
2198
2750
  "-1": {
2199
2751
  "description": "invalid token"
@@ -2205,15 +2757,17 @@
2205
2757
  "description": "insufficient permission"
2206
2758
  },
2207
2759
  "400": {
2208
- "description": "param validation failure"
2760
+ "description": "parameter validation failed"
2209
2761
  }
2210
2762
  }
2211
- },
2212
- "delete": {
2213
- "summary": "Delete a Store.",
2214
- "operationId": "destroy",
2763
+ }
2764
+ },
2765
+ "/api/v1/u/{name}": {
2766
+ "get": {
2767
+ "summary": "GET the specified user by name.",
2768
+ "operationId": "show_via_name",
2215
2769
  "tags": [
2216
- "Stores"
2770
+ "Users"
2217
2771
  ],
2218
2772
  "parameters": [
2219
2773
  {
@@ -2226,12 +2780,12 @@
2226
2780
  }
2227
2781
  },
2228
2782
  {
2229
- "name": "id",
2783
+ "name": "name",
2230
2784
  "in": "path",
2231
2785
  "required": true,
2232
- "description": "要删除的 id",
2786
+ "description": "user name",
2233
2787
  "schema": {
2234
- "type": "integer"
2788
+ "type": "string"
2235
2789
  }
2236
2790
  }
2237
2791
  ],
@@ -2264,41 +2818,22 @@
2264
2818
  "default": "Ruby"
2265
2819
  },
2266
2820
  "data": {
2267
- "type": "array",
2268
- "items": {
2269
- "type": "object"
2270
- }
2821
+ "type": "string"
2271
2822
  }
2272
2823
  }
2273
2824
  }
2274
2825
  }
2275
2826
  }
2276
2827
  },
2277
- "602": {
2278
- "description": "destroy failed"
2279
- },
2280
- "-1": {
2281
- "description": "invalid token"
2282
- },
2283
- "-10": {
2284
- "description": "role verification failed"
2285
- },
2286
- "-11": {
2287
- "description": "insufficient permission"
2288
- },
2289
2828
  "400": {
2290
- "description": "param validation failure"
2829
+ "description": "parameter validation failed"
2291
2830
  }
2292
2831
  }
2293
2832
  }
2294
2833
  },
2295
2834
  "/api/v1/users": {
2296
2835
  "get": {
2297
- "summary": {
2298
- "use": [
2299
- "Token"
2300
- ]
2301
- },
2836
+ "summary": "GET list of users.",
2302
2837
  "operationId": "index",
2303
2838
  "tags": [
2304
2839
  "Users"
@@ -2313,28 +2848,6 @@
2313
2848
  "type": "string"
2314
2849
  }
2315
2850
  },
2316
- {
2317
- "name": "created_start_at",
2318
- "in": "query",
2319
- "required": false,
2320
- "description": "时间起点, YY-MM-DD (HH:MM:SS, 可选)",
2321
- "schema": {
2322
- "type": "string",
2323
- "format": "date-time",
2324
- "as": "start"
2325
- }
2326
- },
2327
- {
2328
- "name": "created_end_at",
2329
- "in": "query",
2330
- "required": false,
2331
- "description": "时间终点, YY-MM-DD (HH:MM:SS, 可选)",
2332
- "schema": {
2333
- "type": "string",
2334
- "format": "date-time",
2335
- "as": "end"
2336
- }
2337
- },
2338
2851
  {
2339
2852
  "name": "page",
2340
2853
  "in": "query",
@@ -2389,7 +2902,36 @@
2389
2902
  "data": {
2390
2903
  "type": "array",
2391
2904
  "items": {
2392
- "type": "object"
2905
+ "type": "object",
2906
+ "properties": {
2907
+ "id": {
2908
+ "type": "integer"
2909
+ },
2910
+ "name": {
2911
+ "type": "string"
2912
+ },
2913
+ "password_digest": {
2914
+ "type": "string"
2915
+ },
2916
+ "email": {
2917
+ "type": "string"
2918
+ },
2919
+ "phone_number": {
2920
+ "type": "string"
2921
+ },
2922
+ "deleted_at": {
2923
+ "type": "string",
2924
+ "format": "date-time"
2925
+ },
2926
+ "created_at": {
2927
+ "type": "string",
2928
+ "format": "date-time"
2929
+ },
2930
+ "updated_at": {
2931
+ "type": "string",
2932
+ "format": "date-time"
2933
+ }
2934
+ }
2393
2935
  }
2394
2936
  }
2395
2937
  }
@@ -2398,30 +2940,19 @@
2398
2940
  }
2399
2941
  },
2400
2942
  "400": {
2401
- "description": "param validation failure"
2943
+ "description": "parameter validation failed"
2402
2944
  }
2403
2945
  }
2404
2946
  },
2405
2947
  "post": {
2406
- "summary": "register",
2948
+ "summary": "POST user register",
2407
2949
  "operationId": "create",
2408
2950
  "tags": [
2409
2951
  "Users"
2410
2952
  ],
2411
- "parameters": [
2412
- {
2413
- "name": "Token",
2414
- "in": "header",
2415
- "required": true,
2416
- "description": "user token",
2417
- "schema": {
2418
- "type": "string"
2419
- }
2420
- }
2421
- ],
2422
2953
  "requestBody": {
2423
2954
  "required": true,
2424
- "description": "register",
2955
+ "description": "for registering user",
2425
2956
  "content": {
2426
2957
  "multipart/form-data": {
2427
2958
  "schema": {
@@ -2435,6 +2966,12 @@
2435
2966
  },
2436
2967
  "password_confirmation": {
2437
2968
  "type": "string"
2969
+ },
2970
+ "email": {
2971
+ "type": "string"
2972
+ },
2973
+ "phone_number": {
2974
+ "type": "string"
2438
2975
  }
2439
2976
  },
2440
2977
  "required": [
@@ -2475,32 +3012,107 @@
2475
3012
  "default": "Ruby"
2476
3013
  },
2477
3014
  "data": {
2478
- "type": "array",
2479
- "items": {
2480
- "type": "object"
2481
- }
3015
+ "type": "string"
2482
3016
  }
2483
3017
  }
2484
3018
  }
2485
3019
  }
2486
3020
  }
2487
3021
  },
2488
- "600": {
3022
+ "700": {
3023
+ "description": "invalid info"
3024
+ },
3025
+ "701": {
2489
3026
  "description": "invalid info"
2490
3027
  },
3028
+ "702": {
3029
+ "description": "repeated info"
3030
+ },
3031
+ "400": {
3032
+ "description": "parameter validation failed"
3033
+ }
3034
+ }
3035
+ }
3036
+ },
3037
+ "/api/v1/users/login": {
3038
+ "post": {
3039
+ "summary": "POST user login.",
3040
+ "operationId": "login",
3041
+ "tags": [
3042
+ "Users"
3043
+ ],
3044
+ "requestBody": {
3045
+ "required": true,
3046
+ "description": "for user login",
3047
+ "content": {
3048
+ "multipart/form-data": {
3049
+ "schema": {
3050
+ "type": "object",
3051
+ "properties": {
3052
+ "name": {
3053
+ "type": "string",
3054
+ "description": "user name"
3055
+ },
3056
+ "password": {
3057
+ "type": "string"
3058
+ }
3059
+ },
3060
+ "required": [
3061
+ "name",
3062
+ "password"
3063
+ ]
3064
+ }
3065
+ }
3066
+ }
3067
+ },
3068
+ "responses": {
3069
+ "200": {
3070
+ "description": "success",
3071
+ "content": {
3072
+ "application/json": {
3073
+ "schema": {
3074
+ "type": "object",
3075
+ "properties": {
3076
+ "code": {
3077
+ "type": "integer",
3078
+ "default": 200
3079
+ },
3080
+ "msg": {
3081
+ "type": "string",
3082
+ "default": "success"
3083
+ },
3084
+ "total": {
3085
+ "type": "integer"
3086
+ },
3087
+ "timestamp": {
3088
+ "type": "integer",
3089
+ "format": "time",
3090
+ "is": "time"
3091
+ },
3092
+ "language": {
3093
+ "type": "string",
3094
+ "default": "Ruby"
3095
+ },
3096
+ "data": {
3097
+ "type": "string"
3098
+ }
3099
+ }
3100
+ }
3101
+ }
3102
+ }
3103
+ },
3104
+ "800": {
3105
+ "description": "login failed"
3106
+ },
2491
3107
  "400": {
2492
- "description": "param validation failure"
3108
+ "description": "parameter validation failed"
2493
3109
  }
2494
3110
  }
2495
3111
  }
2496
3112
  },
2497
3113
  "/api/v1/users/{id}": {
2498
3114
  "get": {
2499
- "summary": {
2500
- "use": [
2501
- "Token"
2502
- ]
2503
- },
3115
+ "summary": "GET the specified user.",
2504
3116
  "operationId": "show",
2505
3117
  "tags": [
2506
3118
  "Users"
@@ -2556,7 +3168,36 @@
2556
3168
  "data": {
2557
3169
  "type": "array",
2558
3170
  "items": {
2559
- "type": "object"
3171
+ "type": "object",
3172
+ "properties": {
3173
+ "id": {
3174
+ "type": "integer"
3175
+ },
3176
+ "name": {
3177
+ "type": "string"
3178
+ },
3179
+ "password_digest": {
3180
+ "type": "string"
3181
+ },
3182
+ "email": {
3183
+ "type": "string"
3184
+ },
3185
+ "phone_number": {
3186
+ "type": "string"
3187
+ },
3188
+ "deleted_at": {
3189
+ "type": "string",
3190
+ "format": "date-time"
3191
+ },
3192
+ "created_at": {
3193
+ "type": "string",
3194
+ "format": "date-time"
3195
+ },
3196
+ "updated_at": {
3197
+ "type": "string",
3198
+ "format": "date-time"
3199
+ }
3200
+ }
2560
3201
  }
2561
3202
  }
2562
3203
  }
@@ -2565,38 +3206,60 @@
2565
3206
  }
2566
3207
  },
2567
3208
  "400": {
2568
- "description": "param validation failure"
3209
+ "description": "parameter validation failed"
2569
3210
  }
2570
3211
  }
2571
- }
2572
- },
2573
- "/api/v1/login": {
2574
- "post": {
2575
- "summary": "user login, and get token.",
2576
- "operationId": "login",
3212
+ },
3213
+ "patch": {
3214
+ "summary": "PATCH update the specified User.",
3215
+ "operationId": "update",
2577
3216
  "tags": [
2578
3217
  "Users"
2579
3218
  ],
3219
+ "parameters": [
3220
+ {
3221
+ "name": "Token",
3222
+ "in": "header",
3223
+ "required": true,
3224
+ "description": "user token",
3225
+ "schema": {
3226
+ "type": "string"
3227
+ }
3228
+ },
3229
+ {
3230
+ "name": "id",
3231
+ "in": "path",
3232
+ "required": true,
3233
+ "description": "要更新的 id",
3234
+ "schema": {
3235
+ "type": "integer"
3236
+ }
3237
+ }
3238
+ ],
2580
3239
  "requestBody": {
2581
3240
  "required": true,
2582
- "description": "login",
3241
+ "description": "for updating the specified user",
2583
3242
  "content": {
2584
3243
  "multipart/form-data": {
2585
3244
  "schema": {
2586
3245
  "type": "object",
2587
3246
  "properties": {
2588
3247
  "name": {
2589
- "type": "string",
2590
- "description": "user name"
3248
+ "type": "string"
2591
3249
  },
2592
3250
  "password": {
2593
3251
  "type": "string"
3252
+ },
3253
+ "password_confirmation": {
3254
+ "type": "string"
3255
+ },
3256
+ "email": {
3257
+ "type": "string"
3258
+ },
3259
+ "phone_number": {
3260
+ "type": "string"
2594
3261
  }
2595
- },
2596
- "required": [
2597
- "name",
2598
- "password"
2599
- ]
3262
+ }
2600
3263
  }
2601
3264
  }
2602
3265
  }
@@ -2630,29 +3293,21 @@
2630
3293
  "default": "Ruby"
2631
3294
  },
2632
3295
  "data": {
2633
- "type": "array",
2634
- "items": {
2635
- "type": "object"
2636
- }
3296
+ "type": "string"
2637
3297
  }
2638
3298
  }
2639
3299
  }
2640
3300
  }
2641
3301
  }
2642
3302
  },
2643
- "601": {
2644
- "description": "admin not found"
2645
- },
2646
3303
  "400": {
2647
- "description": "param validation failure"
3304
+ "description": "parameter validation failed"
2648
3305
  }
2649
3306
  }
2650
- }
2651
- },
2652
- "/api/v1/users/{id}/roles": {
2653
- "get": {
2654
- "summary": "GET Roles of specified user",
2655
- "operationId": "roles",
3307
+ },
3308
+ "delete": {
3309
+ "summary": "DELETE the specified User.",
3310
+ "operationId": "destroy",
2656
3311
  "tags": [
2657
3312
  "Users"
2658
3313
  ],
@@ -2670,7 +3325,7 @@
2670
3325
  "name": "id",
2671
3326
  "in": "path",
2672
3327
  "required": true,
2673
- "description": "要查询的 user id",
3328
+ "description": "要删除的 id",
2674
3329
  "schema": {
2675
3330
  "type": "integer"
2676
3331
  }
@@ -2705,10 +3360,7 @@
2705
3360
  "default": "Ruby"
2706
3361
  },
2707
3362
  "data": {
2708
- "type": "array",
2709
- "items": {
2710
- "type": "object"
2711
- }
3363
+ "type": "string"
2712
3364
  }
2713
3365
  }
2714
3366
  }
@@ -2716,14 +3368,14 @@
2716
3368
  }
2717
3369
  },
2718
3370
  "400": {
2719
- "description": "param validation failure"
3371
+ "description": "parameter validation failed"
2720
3372
  }
2721
3373
  }
2722
3374
  }
2723
3375
  },
2724
3376
  "/api/v1/users/{id}/permissions": {
2725
3377
  "get": {
2726
- "summary": "GET Permissions of specified user",
3378
+ "summary": "GET permissions of the specified user",
2727
3379
  "operationId": "permissions",
2728
3380
  "tags": [
2729
3381
  "Users"
@@ -2777,10 +3429,7 @@
2777
3429
  "default": "Ruby"
2778
3430
  },
2779
3431
  "data": {
2780
- "type": "array",
2781
- "items": {
2782
- "type": "object"
2783
- }
3432
+ "type": "string"
2784
3433
  }
2785
3434
  }
2786
3435
  }
@@ -2788,15 +3437,15 @@
2788
3437
  }
2789
3438
  },
2790
3439
  "400": {
2791
- "description": "param validation failure"
3440
+ "description": "parameter validation failed"
2792
3441
  }
2793
3442
  }
2794
3443
  }
2795
3444
  },
2796
- "/api/v1/users/{id}/roles/add": {
2797
- "post": {
2798
- "summary": "POST add Roles to specified user",
2799
- "operationId": "roles_add",
3445
+ "/api/v1/users/{id}/roles": {
3446
+ "get": {
3447
+ "summary": "GET roles of the specified user",
3448
+ "operationId": "roles",
2800
3449
  "tags": [
2801
3450
  "Users"
2802
3451
  ],
@@ -2814,36 +3463,12 @@
2814
3463
  "name": "id",
2815
3464
  "in": "path",
2816
3465
  "required": true,
2817
- "description": "user id",
3466
+ "description": "要查询的 user id",
2818
3467
  "schema": {
2819
3468
  "type": "integer"
2820
3469
  }
2821
3470
  }
2822
3471
  ],
2823
- "requestBody": {
2824
- "required": true,
2825
- "description": "for adding roles to user",
2826
- "content": {
2827
- "multipart/form-data": {
2828
- "schema": {
2829
- "type": "object",
2830
- "properties": {
2831
- "role_ids": {
2832
- "type": "array",
2833
- "items": {
2834
- "type": "integer",
2835
- "minimum": 1
2836
- },
2837
- "minLength": 1
2838
- }
2839
- },
2840
- "required": [
2841
- "role_ids"
2842
- ]
2843
- }
2844
- }
2845
- }
2846
- },
2847
3472
  "responses": {
2848
3473
  "200": {
2849
3474
  "description": "success",
@@ -2873,10 +3498,7 @@
2873
3498
  "default": "Ruby"
2874
3499
  },
2875
3500
  "data": {
2876
- "type": "array",
2877
- "items": {
2878
- "type": "object"
2879
- }
3501
+ "type": "string"
2880
3502
  }
2881
3503
  }
2882
3504
  }
@@ -2884,15 +3506,15 @@
2884
3506
  }
2885
3507
  },
2886
3508
  "400": {
2887
- "description": "param validation failure"
3509
+ "description": "parameter validation failed"
2888
3510
  }
2889
3511
  }
2890
3512
  }
2891
3513
  },
2892
- "/api/v1/users/{id}/roles/remove": {
3514
+ "/api/v1/users/{id}/roles/modify": {
2893
3515
  "post": {
2894
- "summary": "POST remove Roles from specified user",
2895
- "operationId": "roles_remove",
3516
+ "summary": "POST modify roles to the specified user",
3517
+ "operationId": "roles_modify",
2896
3518
  "tags": [
2897
3519
  "Users"
2898
3520
  ],
@@ -2918,7 +3540,7 @@
2918
3540
  ],
2919
3541
  "requestBody": {
2920
3542
  "required": true,
2921
- "description": "for removing roles from the user",
3543
+ "description": "for modifying roles to the specified user",
2922
3544
  "content": {
2923
3545
  "multipart/form-data": {
2924
3546
  "schema": {
@@ -2930,7 +3552,7 @@
2930
3552
  "type": "integer",
2931
3553
  "minimum": 1
2932
3554
  },
2933
- "minLength": 1
3555
+ "minItems": 1
2934
3556
  }
2935
3557
  },
2936
3558
  "required": [
@@ -2969,10 +3591,7 @@
2969
3591
  "default": "Ruby"
2970
3592
  },
2971
3593
  "data": {
2972
- "type": "array",
2973
- "items": {
2974
- "type": "object"
2975
- }
3594
+ "type": "string"
2976
3595
  }
2977
3596
  }
2978
3597
  }
@@ -2980,7 +3599,7 @@
2980
3599
  }
2981
3600
  },
2982
3601
  "400": {
2983
- "description": "param validation failure"
3602
+ "description": "parameter validation failed"
2984
3603
  }
2985
3604
  }
2986
3605
  }
@@ -2988,10 +3607,10 @@
2988
3607
  },
2989
3608
  "components": {
2990
3609
  "securitySchemes": {
2991
- "ApiKeyAuth": {
2992
- "type": "apiKey",
2993
- "name": "server_token",
2994
- "in": "query"
3610
+ "Token": {
3611
+ "type": "http",
3612
+ "scheme": "bearer",
3613
+ "bearerFormat": "JWT"
2995
3614
  }
2996
3615
  }
2997
3616
  }