open_api_import 0.7.1 → 0.7.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/open_api_import.rb +23 -3
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f90808a3947a8a9a3959f0db36d9880f1754fcc02c4a2da84a3102f07311ae60
4
- data.tar.gz: d58962782d54e780988c02ef5df6d8777c16f55b8545d432266f7a689ba1de01
3
+ metadata.gz: d0d8fda18486db9232fa9bc04e944b73da1e6aacdce15c0c7f3da3a7dd49b874
4
+ data.tar.gz: 532c30e33b6f9d32e3e432366bf870f7e15df6c455bff3112a59bdbbbef50efa
5
5
  SHA512:
6
- metadata.gz: a4058dbc2bc5d3c0515c9a986e1827730768bf8f300c85204332b9763593aa35b008c4ac1db1f1fb239bb0e22db61e94430d0b697fa5a6c1307cd181a40241df
7
- data.tar.gz: 89f0896c5411ef3a27b3826971e62326511963ca06d1f8a766a5af4f4090da5e1482004e4a3a70ea56949b00b6f3d47a99e24af45c16106231cef9036efa9ddc
6
+ metadata.gz: 6108beecdf144608c0714e84a0fcd58d849b734c694d8047d9886332b4499888719abd17fe3d72db9a6428f4542b33a8c56db82ab66a3f09291fd0eb50659a66
7
+ data.tar.gz: aa9593f00472d40f9e2faa88004289173258a61cca8d197ea99afb1d21d38440ab7ff7015ace1028a8c56d8ee1a9cad0c4a225052c0b23bd3de7571d84f1c2e6
@@ -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, remove_read_only=false)
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 remove_read_only and val.key?(:readOnly) and val[:readOnly]==true
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.1
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-15 00:00:00.000000000 Z
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.9'
59
+ version: '1.11'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.9.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.9'
69
+ version: '1.11'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.9.1
72
+ version: 1.11.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rspec
75
75
  requirement: !ruby/object:Gem::Requirement