open_api-loader 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +15 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +28 -0
  6. data/.travis.yml +24 -0
  7. data/CHANGELOG.md +10 -0
  8. data/Gemfile +8 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +99 -0
  11. data/Rakefile +10 -0
  12. data/bin/console +6 -0
  13. data/bin/setup +6 -0
  14. data/lib/open_api-loader.rb +1 -0
  15. data/lib/open_api/loader.rb +44 -0
  16. data/lib/open_api/loader/collector.rb +61 -0
  17. data/lib/open_api/loader/denormalizer.rb +27 -0
  18. data/lib/open_api/loader/denormalizer/parameters.rb +46 -0
  19. data/lib/open_api/loader/denormalizer/security.rb +35 -0
  20. data/lib/open_api/loader/denormalizer/servers.rb +36 -0
  21. data/lib/open_api/loader/denormalizer/variables.rb +54 -0
  22. data/lib/open_api/loader/reader.rb +47 -0
  23. data/lib/open_api/loader/ref.rb +85 -0
  24. data/lib/open_api/loader/translator.rb +50 -0
  25. data/lib/open_api/loader/translator/clean_definitions.rb +16 -0
  26. data/lib/open_api/loader/translator/convert_bodies.rb +77 -0
  27. data/lib/open_api/loader/translator/convert_forms.rb +71 -0
  28. data/lib/open_api/loader/translator/convert_parameters.rb +135 -0
  29. data/lib/open_api/loader/translator/convert_responses.rb +63 -0
  30. data/lib/open_api/loader/translator/convert_security_schemes.rb +49 -0
  31. data/lib/open_api/loader/translator/convert_servers.rb +46 -0
  32. data/lib/open_api/loader/translator/convert_version.rb +12 -0
  33. data/lib/open_api/loader/translator/denormalize_consumes.rb +44 -0
  34. data/lib/open_api/loader/translator/denormalize_parameters.rb +55 -0
  35. data/lib/open_api/loader/translator/denormalize_produces.rb +53 -0
  36. data/open_api-loader.gemspec +25 -0
  37. data/spec/fixtures/oas2/collected.yaml +1012 -0
  38. data/spec/fixtures/oas2/denormalized.yaml +1462 -0
  39. data/spec/fixtures/oas2/loaded.yaml +564 -0
  40. data/spec/fixtures/oas2/models.yaml +118 -0
  41. data/spec/fixtures/oas2/source.json +1 -0
  42. data/spec/fixtures/oas2/source.yaml +569 -0
  43. data/spec/fixtures/oas2/translated.yaml +1396 -0
  44. data/spec/fixtures/oas3/collected.yaml +233 -0
  45. data/spec/fixtures/oas3/denormalized.yaml +233 -0
  46. data/spec/fixtures/oas3/source.json +1 -0
  47. data/spec/fixtures/oas3/source.yaml +217 -0
  48. data/spec/loader_spec.rb +53 -0
  49. data/spec/spec_helper.rb +17 -0
  50. data/spec/support/fixture_helpers.rb +18 -0
  51. data/spec/support/path_helpers.rb +27 -0
  52. data/spec/unit/collector_spec.rb +31 -0
  53. data/spec/unit/denormalizer_spec.rb +17 -0
  54. data/spec/unit/reader_spec.rb +53 -0
  55. data/spec/unit/ref_spec.rb +107 -0
  56. data/spec/unit/translator_spec.rb +15 -0
  57. metadata +232 -0
@@ -0,0 +1,15 @@
1
+ RSpec.describe OpenAPI::Loader::Translator, ".call" do
2
+ subject { described_class.call(source) }
3
+
4
+ context "OAS 2" do
5
+ let(:source) { yaml_fixture_file "oas2/collected.yaml" }
6
+ let(:target) { yaml_fixture_file "oas2/translated.yaml" }
7
+
8
+ it { is_expected.to eq target }
9
+ end
10
+
11
+ context "OAS 3" do
12
+ let(:source) { yaml_fixture_file "oas3/collected.yaml" }
13
+ it { is_expected.to eq source }
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: open_api-loader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kozin (nepalez)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-initializer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: constructor_shortcut
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: inch
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">"
60
+ - !ruby/object:Gem::Version
61
+ version: '10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: '10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.55'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.55'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.4'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.4'
125
+ description:
126
+ email: andrew.kozin@gmail.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files:
130
+ - README.md
131
+ - CHANGELOG.md
132
+ files:
133
+ - ".codeclimate.yml"
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".rubocop.yml"
137
+ - ".travis.yml"
138
+ - CHANGELOG.md
139
+ - Gemfile
140
+ - LICENSE.txt
141
+ - README.md
142
+ - Rakefile
143
+ - bin/console
144
+ - bin/setup
145
+ - lib/open_api-loader.rb
146
+ - lib/open_api/loader.rb
147
+ - lib/open_api/loader/collector.rb
148
+ - lib/open_api/loader/denormalizer.rb
149
+ - lib/open_api/loader/denormalizer/parameters.rb
150
+ - lib/open_api/loader/denormalizer/security.rb
151
+ - lib/open_api/loader/denormalizer/servers.rb
152
+ - lib/open_api/loader/denormalizer/variables.rb
153
+ - lib/open_api/loader/reader.rb
154
+ - lib/open_api/loader/ref.rb
155
+ - lib/open_api/loader/translator.rb
156
+ - lib/open_api/loader/translator/clean_definitions.rb
157
+ - lib/open_api/loader/translator/convert_bodies.rb
158
+ - lib/open_api/loader/translator/convert_forms.rb
159
+ - lib/open_api/loader/translator/convert_parameters.rb
160
+ - lib/open_api/loader/translator/convert_responses.rb
161
+ - lib/open_api/loader/translator/convert_security_schemes.rb
162
+ - lib/open_api/loader/translator/convert_servers.rb
163
+ - lib/open_api/loader/translator/convert_version.rb
164
+ - lib/open_api/loader/translator/denormalize_consumes.rb
165
+ - lib/open_api/loader/translator/denormalize_parameters.rb
166
+ - lib/open_api/loader/translator/denormalize_produces.rb
167
+ - open_api-loader.gemspec
168
+ - spec/fixtures/oas2/collected.yaml
169
+ - spec/fixtures/oas2/denormalized.yaml
170
+ - spec/fixtures/oas2/loaded.yaml
171
+ - spec/fixtures/oas2/models.yaml
172
+ - spec/fixtures/oas2/source.json
173
+ - spec/fixtures/oas2/source.yaml
174
+ - spec/fixtures/oas2/translated.yaml
175
+ - spec/fixtures/oas3/collected.yaml
176
+ - spec/fixtures/oas3/denormalized.yaml
177
+ - spec/fixtures/oas3/source.json
178
+ - spec/fixtures/oas3/source.yaml
179
+ - spec/loader_spec.rb
180
+ - spec/spec_helper.rb
181
+ - spec/support/fixture_helpers.rb
182
+ - spec/support/path_helpers.rb
183
+ - spec/unit/collector_spec.rb
184
+ - spec/unit/denormalizer_spec.rb
185
+ - spec/unit/reader_spec.rb
186
+ - spec/unit/ref_spec.rb
187
+ - spec/unit/translator_spec.rb
188
+ homepage: https://github.com/nepalez/open_api-loader
189
+ licenses:
190
+ - MIT
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '2.3'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.6.14
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: Loads OAS scheme and updates it to OAS3 standard
212
+ test_files:
213
+ - spec/fixtures/oas2/collected.yaml
214
+ - spec/fixtures/oas2/denormalized.yaml
215
+ - spec/fixtures/oas2/loaded.yaml
216
+ - spec/fixtures/oas2/models.yaml
217
+ - spec/fixtures/oas2/source.json
218
+ - spec/fixtures/oas2/source.yaml
219
+ - spec/fixtures/oas2/translated.yaml
220
+ - spec/fixtures/oas3/collected.yaml
221
+ - spec/fixtures/oas3/denormalized.yaml
222
+ - spec/fixtures/oas3/source.json
223
+ - spec/fixtures/oas3/source.yaml
224
+ - spec/loader_spec.rb
225
+ - spec/spec_helper.rb
226
+ - spec/support/fixture_helpers.rb
227
+ - spec/support/path_helpers.rb
228
+ - spec/unit/collector_spec.rb
229
+ - spec/unit/denormalizer_spec.rb
230
+ - spec/unit/reader_spec.rb
231
+ - spec/unit/ref_spec.rb
232
+ - spec/unit/translator_spec.rb