openapi-rails 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openapi/mongoid/spec_builder.rb +21 -20
- data/lib/openapi/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: 8a159aad26d1ebebde743aa749c2e24d47d20244
|
4
|
+
data.tar.gz: 9c4651933c47cfcfcc74e876fb8afa36515a0311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5970ef069b39fb49e829b6484d5af750b1792d89c3ebf455f130698b0c2efd048055a88abb0ef80272d09b07254bffb01737b157b2cdf673c11bb01491d5fd9c
|
7
|
+
data.tar.gz: 776f4ce7f899a7283683c51b80ca08d2b203de3a8434b81a7299f468fca4773cf8103e5289ed73d4d707e6d307f4787c6f00b81e9e2cffa7fa4ef1829913710e
|
@@ -48,31 +48,32 @@ module Openapi
|
|
48
48
|
|
49
49
|
class_methods do
|
50
50
|
def spec_params(options)
|
51
|
-
self.spec_collection_name = options[:collection_name]
|
52
|
-
self.spec_resource_name = options[:resource_name]
|
53
51
|
self.spec_resource_class = options[:resource_class]
|
54
|
-
self.
|
52
|
+
self.spec_resource_name = options[:resource_name]
|
53
|
+
self.spec_collection_name = options[:collection_name]
|
55
54
|
self.spec_relative_path = options[:relative_path]
|
55
|
+
self.spec_except_actions = options[:except_actions]
|
56
56
|
end
|
57
57
|
|
58
58
|
def build_openapi_specification(options)
|
59
|
-
self.
|
59
|
+
self.spec_except_actions ||=
|
60
|
+
[]
|
61
|
+
|
62
|
+
self.spec_base_path =
|
63
|
+
options[:base_path]
|
60
64
|
|
61
65
|
self.spec_relative_path ||=
|
62
66
|
('/' + to_s.remove(/Controller$/).gsub('::', '/').underscore).
|
63
67
|
remove(spec_base_path)
|
64
68
|
|
65
|
-
self.
|
66
|
-
|
67
|
-
self.spec_collection_name ||=
|
68
|
-
to_s.split('::').last.sub(/Controller$/, '')
|
69
|
+
self.spec_resource_class ||=
|
70
|
+
self.try(:crud_resource_class)
|
69
71
|
|
70
72
|
self.spec_resource_name ||=
|
71
|
-
self.
|
73
|
+
self.spec_resource_class.to_s.remove('::')
|
72
74
|
|
73
|
-
self.
|
74
|
-
|
75
|
-
self.spec_resource_name.constantize
|
75
|
+
self.spec_collection_name ||=
|
76
|
+
self.spec_resource_name.pluralize
|
76
77
|
|
77
78
|
build_openapi_definitions
|
78
79
|
build_openapi_paths
|
@@ -88,9 +89,9 @@ module Openapi
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def build_openapi_definitions
|
91
|
-
collection_name
|
92
|
-
resource_class
|
93
|
-
resource_name
|
92
|
+
collection_name = spec_collection_name
|
93
|
+
resource_class = spec_resource_class
|
94
|
+
resource_name = spec_resource_name
|
94
95
|
resource_property_name = resource_name.underscore.to_sym
|
95
96
|
|
96
97
|
swagger_schema resource_name do
|
@@ -169,7 +170,7 @@ module Openapi
|
|
169
170
|
if include_index
|
170
171
|
operation :get do
|
171
172
|
key :tags, [plural_name]
|
172
|
-
key :summary,
|
173
|
+
key :summary, "index#{plural_name}"
|
173
174
|
key :operationId, "index#{plural_name}"
|
174
175
|
key :produces, json_mime
|
175
176
|
|
@@ -257,7 +258,7 @@ module Openapi
|
|
257
258
|
if include_create
|
258
259
|
operation :post do
|
259
260
|
key :tags, [plural_name]
|
260
|
-
key :summary,
|
261
|
+
key :summary, "create#{plural_name}"
|
261
262
|
key :operationId, "create#{plural_name}"
|
262
263
|
key :produces, json_mime
|
263
264
|
|
@@ -309,7 +310,7 @@ module Openapi
|
|
309
310
|
if include_show
|
310
311
|
operation :get do
|
311
312
|
key :tags, [plural_name]
|
312
|
-
key :summary,
|
313
|
+
key :summary, "show#{name}ById"
|
313
314
|
key :operationId, "show#{name}ById"
|
314
315
|
key :produces, json_mime
|
315
316
|
|
@@ -354,7 +355,7 @@ module Openapi
|
|
354
355
|
if include_update
|
355
356
|
operation :put do
|
356
357
|
key :tags, [plural_name]
|
357
|
-
key :summary,
|
358
|
+
key :summary, "update#{name}"
|
358
359
|
key :operationId, "update#{name}"
|
359
360
|
key :produces, json_mime
|
360
361
|
|
@@ -408,7 +409,7 @@ module Openapi
|
|
408
409
|
if include_destroy
|
409
410
|
operation :delete do
|
410
411
|
key :tags, [plural_name]
|
411
|
-
key :summary,
|
412
|
+
key :summary, "destroy#{name}"
|
412
413
|
key :operationId, "destroy#{name}"
|
413
414
|
|
414
415
|
parameter do
|
data/lib/openapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openapi-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kravets
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-01-
|
12
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: swagger-blocks
|