open_api_import 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/open_api_import.rb +23 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0d8fda18486db9232fa9bc04e944b73da1e6aacdce15c0c7f3da3a7dd49b874
|
4
|
+
data.tar.gz: 532c30e33b6f9d32e3e432366bf870f7e15df6c455bff3112a59bdbbbef50efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6108beecdf144608c0714e84a0fcd58d849b734c694d8047d9886332b4499888719abd17fe3d72db9a6428f4542b33a8c56db82ab66a3f09291fd0eb50659a66
|
7
|
+
data.tar.gz: aa9593f00472d40f9e2faa88004289173258a61cca8d197ea99afb1d21d38440ab7ff7015ace1028a8c56d8ee1a9cad0c4a225052c0b23bd3de7571d84f1c2e6
|
data/lib/open_api_import.rb
CHANGED
@@ -153,7 +153,6 @@ class OpenApiImport
|
|
153
153
|
method_name = cont[:operationId]
|
154
154
|
end
|
155
155
|
end
|
156
|
-
|
157
156
|
path_txt = path.path.dup.to_s
|
158
157
|
if [:path, :path_file, :tags, :tags_file].include?(name_for_module)
|
159
158
|
old_module_requests = module_requests
|
@@ -457,6 +456,27 @@ class OpenApiImport
|
|
457
456
|
output << "},"
|
458
457
|
end
|
459
458
|
end
|
459
|
+
unless data_read_only.empty? or !data_required.empty?
|
460
|
+
reqdata = []
|
461
|
+
#remove read only fields from :data
|
462
|
+
data_examples[0].each do |edata|
|
463
|
+
read_only = false
|
464
|
+
data_read_only.each do |rdata|
|
465
|
+
if edata.scan(/^#{rdata}:/).size>0
|
466
|
+
read_only = true
|
467
|
+
break
|
468
|
+
elsif edata.scan(/:/).size==0
|
469
|
+
break
|
470
|
+
end
|
471
|
+
end
|
472
|
+
reqdata << edata unless read_only
|
473
|
+
end
|
474
|
+
unless reqdata.empty?
|
475
|
+
output << "data: {"
|
476
|
+
output << reqdata.join(", \n")
|
477
|
+
output << "},"
|
478
|
+
end
|
479
|
+
end
|
460
480
|
|
461
481
|
output << "data_examples: ["
|
462
482
|
data_examples.each do |data|
|
@@ -558,12 +578,12 @@ class OpenApiImport
|
|
558
578
|
|
559
579
|
class << self
|
560
580
|
# Retrieve the examples from the properties hash
|
561
|
-
private def get_examples(properties, type=:key_value,
|
581
|
+
private def get_examples(properties, type=:key_value, remove_readonly=false)
|
562
582
|
#todo: consider using this method also to get data examples
|
563
583
|
example = []
|
564
584
|
example << "{" unless properties.empty? or type==:only_value
|
565
585
|
properties.each do |prop, val|
|
566
|
-
unless
|
586
|
+
unless remove_readonly and val.key?(:readOnly) and val[:readOnly]==true
|
567
587
|
if val.key?(:properties) and !val.key?(:example) and !val.key?(:type)
|
568
588
|
val[:type]='object'
|
569
589
|
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.7.
|
4
|
+
version: 0.7.2
|
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-03-
|
11
|
+
date: 2019-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oas_parser
|
@@ -56,20 +56,20 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '1.
|
59
|
+
version: '1.11'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
62
|
+
version: 1.11.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
69
|
+
version: '1.11'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 1.
|
72
|
+
version: 1.11.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rspec
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|