open_api_import 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/open_api_import.rb +31 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1785c2aeaa1f0211104cf19f3a827f95f001787ec6d96133ad74fec3651b617d
|
4
|
+
data.tar.gz: c28a8aa99ec9b3f98c0aebe9335ca4366418ec80f25bdedd4563cfb4d0be31dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86bc8c53a3932521a9245b386baafdf384171ac546a6306ac3b745014a6b633de8eb485f2498c88748edb7280316771fa42f853443406fac90adfe82bee5208c
|
7
|
+
data.tar.gz: 0bb4013a8dc30bbec7132dcbda4dbb64a33c218573caa29090d0107bbe26f0000f3aa0171a4bbfb27e56eb596cccf17f0746f69dddb5337af62a7b2466730b0e
|
data/lib/open_api_import.rb
CHANGED
@@ -113,6 +113,7 @@ class OpenApiImport
|
|
113
113
|
params = []
|
114
114
|
params_path = []
|
115
115
|
params_query = []
|
116
|
+
params_required = []
|
116
117
|
description_parameters = []
|
117
118
|
data_required = []
|
118
119
|
data_read_only = []
|
@@ -211,19 +212,23 @@ class OpenApiImport
|
|
211
212
|
cont[:parameters].each do |p|
|
212
213
|
if p[:in] == "path"
|
213
214
|
if create_method_name == :operationId
|
214
|
-
|
215
|
-
path_txt.gsub!("{#{
|
215
|
+
param_name = p[:name]
|
216
|
+
path_txt.gsub!("{#{param_name}}", "\#{#{param_name}}")
|
216
217
|
else
|
217
|
-
|
218
|
-
path_txt.gsub!("{#{p[:name]}}", "\#{#{
|
218
|
+
param_name = p[:name].to_s.snake_case
|
219
|
+
path_txt.gsub!("{#{p[:name]}}", "\#{#{param_name}}")
|
219
220
|
end
|
221
|
+
params_path << param_name
|
222
|
+
#params_required << param_name if p[:required].to_s=="true"
|
223
|
+
|
220
224
|
if p.keys.include?(:description)
|
221
|
-
description_parameters << "# #{p[:name]}: (#{p[:type]}) #{p[:description]}"
|
225
|
+
description_parameters << "# #{p[:name]}: (#{p[:type]}) #{"(required)" if p[:required].to_s=="true"} #{p[:description]}"
|
222
226
|
end
|
223
227
|
elsif p[:in] == "query"
|
224
228
|
params_query << p[:name]
|
229
|
+
params_required << p[:name] if p[:required].to_s=="true"
|
225
230
|
if p.keys.include?(:description)
|
226
|
-
description_parameters << "# #{p[:name]}: (#{p[:type]}) #{p[:description]}"
|
231
|
+
description_parameters << "# #{p[:name]}: (#{p[:type]}) #{"(required)" if p[:required].to_s=="true"} #{p[:description]}"
|
227
232
|
end
|
228
233
|
elsif p[:in] == "body"
|
229
234
|
if p.keys.include?(:schema)
|
@@ -294,13 +299,27 @@ class OpenApiImport
|
|
294
299
|
|
295
300
|
unless params_query.empty?
|
296
301
|
path_txt += "?"
|
302
|
+
params_required.each do |pr|
|
303
|
+
if params_query.include?(pr)
|
304
|
+
if create_method_name == :operationId
|
305
|
+
path_txt += "#{pr}=\#{#{pr}}&"
|
306
|
+
params << "#{pr}"
|
307
|
+
else
|
308
|
+
path_txt += "#{pr}=\#{#{pr.to_s.snake_case}}&"
|
309
|
+
params << "#{pr.to_s.snake_case}"
|
310
|
+
end
|
311
|
+
|
312
|
+
end
|
313
|
+
end
|
297
314
|
params_query.each do |pq|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
315
|
+
unless params_required.include?(pq)
|
316
|
+
if create_method_name == :operationId
|
317
|
+
path_txt += "#{pq}=\#{#{pq}}&"
|
318
|
+
params << "#{pq}: ''"
|
319
|
+
else
|
320
|
+
path_txt += "#{pq}=\#{#{pq.to_s.snake_case}}&"
|
321
|
+
params << "#{pq.to_s.snake_case}: ''"
|
322
|
+
end
|
304
323
|
end
|
305
324
|
end
|
306
325
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_api_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oas_parser
|