api_schema 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api_schema/patches/operation_node.rb +6 -6
- data/lib/api_schema/resource_definition.rb +12 -12
- data/lib/api_schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3334a6b84fcdea073dd676ab06b21546851d4b
|
4
|
+
data.tar.gz: 1fb668c1353c45e69df045e5b2ad5c6e2ce3efec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d093ee56e095d80380455875dcf29bc0e6ba52a464274ad800ef78d4231e34e1b47262e5205d14826e300976214a0f354ea91f4c62cdd4bdb96edd5b722f7602
|
7
|
+
data.tar.gz: c69ec8ced324c26e66e3a9f19b0d6bc09a2a6f2e65438b2672b2a1106cf6c6040465e80c568631279fd304eac28f56d27401054795a866a8abf4efa35d3c75b5
|
@@ -15,11 +15,11 @@ module Swagger
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def header_param(name, type)
|
18
|
+
def header_param(name, type, required)
|
19
19
|
parameter do
|
20
20
|
key :name, name
|
21
21
|
key :in, :header
|
22
|
-
key :required,
|
22
|
+
key :required, required
|
23
23
|
key :type, type
|
24
24
|
end
|
25
25
|
end
|
@@ -35,20 +35,20 @@ module Swagger
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def query_param(name, type)
|
38
|
+
def query_param(name, type, required)
|
39
39
|
parameter do
|
40
40
|
key :name, name
|
41
41
|
key :in, :query
|
42
|
-
key :required,
|
42
|
+
key :required, required
|
43
43
|
key :type, type
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def path_param(name, type)
|
47
|
+
def path_param(name, type, required)
|
48
48
|
parameter do
|
49
49
|
key :name, name
|
50
50
|
key :in, :path
|
51
|
-
key :required,
|
51
|
+
key :required, required
|
52
52
|
key :type, type
|
53
53
|
end
|
54
54
|
end
|
@@ -13,9 +13,9 @@ module ApiSchema
|
|
13
13
|
@query_params = []
|
14
14
|
end
|
15
15
|
|
16
|
-
HeaderParam = ::Struct.new(:name, :type)
|
17
|
-
PathParam = ::Struct.new(:name, :type)
|
18
|
-
QueryParam = ::Struct.new(:name, :type)
|
16
|
+
HeaderParam = ::Struct.new(:name, :type, :required)
|
17
|
+
PathParam = ::Struct.new(:name, :type, :required)
|
18
|
+
QueryParam = ::Struct.new(:name, :type, :required)
|
19
19
|
|
20
20
|
attr_reader :method, :summary, :description, :header_params, :body_param,
|
21
21
|
:path_params, :query_params, :resp,
|
@@ -33,20 +33,20 @@ module ApiSchema
|
|
33
33
|
@description = desc
|
34
34
|
end
|
35
35
|
|
36
|
-
def header(name, type)
|
37
|
-
@header_params << HeaderParam.new(name, type)
|
36
|
+
def header(name, type, required: true)
|
37
|
+
@header_params << HeaderParam.new(name, type, required)
|
38
38
|
end
|
39
39
|
|
40
40
|
def body(body_param)
|
41
41
|
@body_param = body_param
|
42
42
|
end
|
43
43
|
|
44
|
-
def path_param(name, type)
|
45
|
-
@path_params << PathParam.new(name, type)
|
44
|
+
def path_param(name, type, required: true)
|
45
|
+
@path_params << PathParam.new(name, type, required)
|
46
46
|
end
|
47
47
|
|
48
|
-
def query_param(name, type)
|
49
|
-
@query_params << QueryParam.new(name, type)
|
48
|
+
def query_param(name, type, required: true)
|
49
|
+
@query_params << QueryParam.new(name, type, required)
|
50
50
|
end
|
51
51
|
|
52
52
|
def response(code, model_name = nil, &block)
|
@@ -106,13 +106,13 @@ module ApiSchema
|
|
106
106
|
body_param(r.body_param) if r.with_body?
|
107
107
|
|
108
108
|
r.header_params.each do |p|
|
109
|
-
header_param(p.name, p.type)
|
109
|
+
header_param(p.name, p.type, p.required)
|
110
110
|
end
|
111
111
|
r.path_params.each do |p|
|
112
|
-
path_param(p.name, p.type)
|
112
|
+
path_param(p.name, p.type, p.required)
|
113
113
|
end
|
114
114
|
r.query_params.each do |p|
|
115
|
-
query_param(p.name, p.type)
|
115
|
+
query_param(p.name, p.type, p.required)
|
116
116
|
end
|
117
117
|
|
118
118
|
success_response(r.resp.code, r.resp.model, r.resp.fields)
|
data/lib/api_schema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Chopey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|