docraptor 2.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.docker_env.list +5 -0
  3. data/.docker_mounts.list +4 -0
  4. data/.generator-language-identifier +1 -0
  5. data/.generator-revision +1 -0
  6. data/.github/pull_request_template.txt +17 -0
  7. data/.gitignore +20 -14
  8. data/.gitlab-ci.yml +26 -0
  9. data/.openapi-generator/FILES +32 -0
  10. data/.openapi-generator/VERSION +1 -0
  11. data/{.swagger-codegen-ignore → .openapi-generator-ignore} +13 -7
  12. data/.review/README.md +16 -0
  13. data/.review/generated_files/.gitignore +39 -0
  14. data/.review/generated_files/README.md +108 -0
  15. data/.review/generated_files/docs/AsyncDoc.md +18 -0
  16. data/.review/generated_files/docs/Doc.md +50 -0
  17. data/.review/generated_files/docs/DocApi.md +503 -0
  18. data/.review/generated_files/docs/DocStatus.md +28 -0
  19. data/.review/generated_files/docs/PrinceOptions.md +82 -0
  20. data/.review/generated_files/spec/api/doc_api_spec.rb +112 -0
  21. data/{spec → .review/generated_files/spec}/api_client_spec.rb +6 -21
  22. data/{spec → .review/generated_files/spec}/configuration_spec.rb +6 -6
  23. data/.review/generated_files/spec/models/async_doc_spec.rb +34 -0
  24. data/.review/generated_files/spec/models/doc_spec.rb +138 -0
  25. data/.review/generated_files/spec/models/doc_status_spec.rb +64 -0
  26. data/.review/generated_files/spec/models/prince_options_spec.rb +234 -0
  27. data/{spec → .review/generated_files/spec}/spec_helper.rb +3 -3
  28. data/.rubocop.yml +148 -0
  29. data/.runtime-environments +13 -0
  30. data/.travis.yml +9 -7
  31. data/CHANGELOG.md +8 -0
  32. data/Gemfile +3 -1
  33. data/README.md +8 -8
  34. data/Rakefile +1 -2
  35. data/docraptor.gemspec +5 -19
  36. data/docraptor.yaml +283 -284
  37. data/examples/async.rb +24 -30
  38. data/examples/hosted_async.rb +21 -33
  39. data/examples/hosted_sync.rb +19 -32
  40. data/examples/sync.rb +20 -26
  41. data/gemfiles/Gemfile.2.5.lock +70 -0
  42. data/gemfiles/Gemfile.2.6.lock +70 -0
  43. data/gemfiles/Gemfile.2.7.lock +70 -0
  44. data/gemfiles/Gemfile.3.0.lock +70 -0
  45. data/gemfiles/Gemfile.3.1.lock +72 -0
  46. data/gemfiles/Gemfile.3.2.lock +72 -0
  47. data/gemfiles/Gemfile.3.3.lock +72 -0
  48. data/{swagger-config.json → generator-config.json} +3 -2
  49. data/lib/docraptor/api/doc_api.rb +180 -85
  50. data/lib/docraptor/api_client.rb +91 -90
  51. data/lib/docraptor/api_error.rb +23 -3
  52. data/lib/docraptor/configuration.rb +101 -15
  53. data/lib/docraptor/models/async_doc.rb +53 -18
  54. data/lib/docraptor/models/doc.rb +80 -50
  55. data/lib/docraptor/models/doc_status.rb +58 -23
  56. data/lib/docraptor/models/prince_options.rb +149 -75
  57. data/lib/docraptor/version.rb +4 -4
  58. data/lib/docraptor.rb +3 -3
  59. data/script/clean +2 -2
  60. data/script/console +5 -0
  61. data/script/docker +56 -0
  62. data/script/fix_gemspec.rb +3 -18
  63. data/script/generate_language +43 -4
  64. data/script/inside_container/README.md +6 -0
  65. data/script/inside_container/test +87 -0
  66. data/script/post_generate_language +8 -2
  67. data/script/release +13 -0
  68. data/script/setup +25 -14
  69. data/script/swagger +6 -33
  70. data/script/test +30 -27
  71. data/test/async.rb +2 -2
  72. data/test/expire_hosted.rb +2 -2
  73. data/test/hosted_async.rb +7 -1
  74. data/test/hosted_sync.rb +2 -2
  75. data/test/iframes_default.rb +40 -0
  76. data/test/iframes_false.rb +40 -0
  77. data/test/iframes_true.rb +40 -0
  78. data/test/prince_options.rb +45 -0
  79. data/test/sync.rb +2 -2
  80. data/test/xlsx.rb +10 -3
  81. metadata +52 -214
  82. data/.swagger-codegen/VERSION +0 -1
  83. data/.swagger-revision +0 -1
@@ -3,14 +3,15 @@
3
3
 
4
4
  #A native client library for the DocRaptor HTML to PDF/XLS service.
5
5
 
6
- OpenAPI spec version: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.19
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module DocRaptor
16
17
  class PrinceOptions
@@ -86,7 +87,7 @@ module DocRaptor
86
87
  # Enable Prince debug mode.
87
88
  attr_accessor :debug
88
89
 
89
- # Specify the input format.
90
+ # Specify the input format, defaults to html.
90
91
  attr_accessor :input
91
92
 
92
93
  # Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.
@@ -104,6 +105,15 @@ module DocRaptor
104
105
  # Specify the PDF title, part of the document's metadata.
105
106
  attr_accessor :pdf_title
106
107
 
108
+ # Enable loading of iframes.
109
+ attr_accessor :iframes
110
+
111
+ # Specify the page margin distance.
112
+ attr_accessor :page_margin
113
+
114
+ # Make form fields editable by default.
115
+ attr_accessor :pdf_forms
116
+
107
117
  class EnumAttributeValidator
108
118
  attr_reader :datatype
109
119
  attr_reader :allowable_values
@@ -158,177 +168,210 @@ module DocRaptor
158
168
  :'javascript' => :'javascript',
159
169
  :'css_dpi' => :'css_dpi',
160
170
  :'profile' => :'profile',
161
- :'pdf_title' => :'pdf_title'
171
+ :'pdf_title' => :'pdf_title',
172
+ :'iframes' => :'iframes',
173
+ :'page_margin' => :'page_margin',
174
+ :'pdf_forms' => :'pdf_forms'
162
175
  }
163
176
  end
164
177
 
178
+ # Returns all the JSON keys this model knows about
179
+ def self.acceptable_attributes
180
+ attribute_map.values
181
+ end
182
+
165
183
  # Attribute type mapping.
166
- def self.swagger_types
184
+ def self.openapi_types
167
185
  {
168
186
  :'baseurl' => :'String',
169
- :'no_xinclude' => :'BOOLEAN',
170
- :'no_network' => :'BOOLEAN',
171
- :'no_parallel_downloads' => :'BOOLEAN',
187
+ :'no_xinclude' => :'Boolean',
188
+ :'no_network' => :'Boolean',
189
+ :'no_parallel_downloads' => :'Boolean',
172
190
  :'http_user' => :'String',
173
191
  :'http_password' => :'String',
174
192
  :'http_proxy' => :'String',
175
193
  :'http_timeout' => :'Integer',
176
- :'insecure' => :'BOOLEAN',
194
+ :'insecure' => :'Boolean',
177
195
  :'media' => :'String',
178
- :'no_author_style' => :'BOOLEAN',
179
- :'no_default_style' => :'BOOLEAN',
180
- :'no_embed_fonts' => :'BOOLEAN',
181
- :'no_subset_fonts' => :'BOOLEAN',
182
- :'no_compress' => :'BOOLEAN',
183
- :'encrypt' => :'BOOLEAN',
196
+ :'no_author_style' => :'Boolean',
197
+ :'no_default_style' => :'Boolean',
198
+ :'no_embed_fonts' => :'Boolean',
199
+ :'no_subset_fonts' => :'Boolean',
200
+ :'no_compress' => :'Boolean',
201
+ :'encrypt' => :'Boolean',
184
202
  :'key_bits' => :'Integer',
185
203
  :'user_password' => :'String',
186
204
  :'owner_password' => :'String',
187
- :'disallow_print' => :'BOOLEAN',
188
- :'disallow_copy' => :'BOOLEAN',
189
- :'disallow_annotate' => :'BOOLEAN',
190
- :'disallow_modify' => :'BOOLEAN',
191
- :'debug' => :'BOOLEAN',
205
+ :'disallow_print' => :'Boolean',
206
+ :'disallow_copy' => :'Boolean',
207
+ :'disallow_annotate' => :'Boolean',
208
+ :'disallow_modify' => :'Boolean',
209
+ :'debug' => :'Boolean',
192
210
  :'input' => :'String',
193
211
  :'version' => :'String',
194
- :'javascript' => :'BOOLEAN',
212
+ :'javascript' => :'Boolean',
195
213
  :'css_dpi' => :'Integer',
196
214
  :'profile' => :'String',
197
- :'pdf_title' => :'String'
215
+ :'pdf_title' => :'String',
216
+ :'iframes' => :'Boolean',
217
+ :'page_margin' => :'String',
218
+ :'pdf_forms' => :'Boolean'
198
219
  }
199
220
  end
200
221
 
222
+ # List of attributes with nullable: true
223
+ def self.openapi_nullable
224
+ Set.new([
225
+ :'iframes',
226
+ ])
227
+ end
228
+
201
229
  # Initializes the object
202
230
  # @param [Hash] attributes Model attributes in the form of hash
203
231
  def initialize(attributes = {})
204
- return unless attributes.is_a?(Hash)
232
+ if (!attributes.is_a?(Hash))
233
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DocRaptor::PrinceOptions` initialize method"
234
+ end
205
235
 
206
- # convert string to symbol for hash key
207
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
236
+ # check to see if the attribute exists and convert string to symbol for hash key
237
+ attributes = attributes.each_with_object({}) { |(k, v), h|
238
+ if (!self.class.attribute_map.key?(k.to_sym))
239
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DocRaptor::PrinceOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
240
+ end
241
+ h[k.to_sym] = v
242
+ }
208
243
 
209
- if attributes.has_key?(:'baseurl')
244
+ if attributes.key?(:'baseurl')
210
245
  self.baseurl = attributes[:'baseurl']
211
246
  end
212
247
 
213
- if attributes.has_key?(:'no_xinclude')
248
+ if attributes.key?(:'no_xinclude')
214
249
  self.no_xinclude = attributes[:'no_xinclude']
215
250
  end
216
251
 
217
- if attributes.has_key?(:'no_network')
252
+ if attributes.key?(:'no_network')
218
253
  self.no_network = attributes[:'no_network']
219
254
  end
220
255
 
221
- if attributes.has_key?(:'no_parallel_downloads')
256
+ if attributes.key?(:'no_parallel_downloads')
222
257
  self.no_parallel_downloads = attributes[:'no_parallel_downloads']
223
258
  end
224
259
 
225
- if attributes.has_key?(:'http_user')
260
+ if attributes.key?(:'http_user')
226
261
  self.http_user = attributes[:'http_user']
227
262
  end
228
263
 
229
- if attributes.has_key?(:'http_password')
264
+ if attributes.key?(:'http_password')
230
265
  self.http_password = attributes[:'http_password']
231
266
  end
232
267
 
233
- if attributes.has_key?(:'http_proxy')
268
+ if attributes.key?(:'http_proxy')
234
269
  self.http_proxy = attributes[:'http_proxy']
235
270
  end
236
271
 
237
- if attributes.has_key?(:'http_timeout')
272
+ if attributes.key?(:'http_timeout')
238
273
  self.http_timeout = attributes[:'http_timeout']
239
274
  end
240
275
 
241
- if attributes.has_key?(:'insecure')
276
+ if attributes.key?(:'insecure')
242
277
  self.insecure = attributes[:'insecure']
243
278
  end
244
279
 
245
- if attributes.has_key?(:'media')
280
+ if attributes.key?(:'media')
246
281
  self.media = attributes[:'media']
247
- else
248
- self.media = 'print'
249
282
  end
250
283
 
251
- if attributes.has_key?(:'no_author_style')
284
+ if attributes.key?(:'no_author_style')
252
285
  self.no_author_style = attributes[:'no_author_style']
253
286
  end
254
287
 
255
- if attributes.has_key?(:'no_default_style')
288
+ if attributes.key?(:'no_default_style')
256
289
  self.no_default_style = attributes[:'no_default_style']
257
290
  end
258
291
 
259
- if attributes.has_key?(:'no_embed_fonts')
292
+ if attributes.key?(:'no_embed_fonts')
260
293
  self.no_embed_fonts = attributes[:'no_embed_fonts']
261
294
  end
262
295
 
263
- if attributes.has_key?(:'no_subset_fonts')
296
+ if attributes.key?(:'no_subset_fonts')
264
297
  self.no_subset_fonts = attributes[:'no_subset_fonts']
265
298
  end
266
299
 
267
- if attributes.has_key?(:'no_compress')
300
+ if attributes.key?(:'no_compress')
268
301
  self.no_compress = attributes[:'no_compress']
269
302
  end
270
303
 
271
- if attributes.has_key?(:'encrypt')
304
+ if attributes.key?(:'encrypt')
272
305
  self.encrypt = attributes[:'encrypt']
273
306
  end
274
307
 
275
- if attributes.has_key?(:'key_bits')
308
+ if attributes.key?(:'key_bits')
276
309
  self.key_bits = attributes[:'key_bits']
277
310
  end
278
311
 
279
- if attributes.has_key?(:'user_password')
312
+ if attributes.key?(:'user_password')
280
313
  self.user_password = attributes[:'user_password']
281
314
  end
282
315
 
283
- if attributes.has_key?(:'owner_password')
316
+ if attributes.key?(:'owner_password')
284
317
  self.owner_password = attributes[:'owner_password']
285
318
  end
286
319
 
287
- if attributes.has_key?(:'disallow_print')
320
+ if attributes.key?(:'disallow_print')
288
321
  self.disallow_print = attributes[:'disallow_print']
289
322
  end
290
323
 
291
- if attributes.has_key?(:'disallow_copy')
324
+ if attributes.key?(:'disallow_copy')
292
325
  self.disallow_copy = attributes[:'disallow_copy']
293
326
  end
294
327
 
295
- if attributes.has_key?(:'disallow_annotate')
328
+ if attributes.key?(:'disallow_annotate')
296
329
  self.disallow_annotate = attributes[:'disallow_annotate']
297
330
  end
298
331
 
299
- if attributes.has_key?(:'disallow_modify')
332
+ if attributes.key?(:'disallow_modify')
300
333
  self.disallow_modify = attributes[:'disallow_modify']
301
334
  end
302
335
 
303
- if attributes.has_key?(:'debug')
336
+ if attributes.key?(:'debug')
304
337
  self.debug = attributes[:'debug']
305
338
  end
306
339
 
307
- if attributes.has_key?(:'input')
340
+ if attributes.key?(:'input')
308
341
  self.input = attributes[:'input']
309
- else
310
- self.input = 'html'
311
342
  end
312
343
 
313
- if attributes.has_key?(:'version')
344
+ if attributes.key?(:'version')
314
345
  self.version = attributes[:'version']
315
346
  end
316
347
 
317
- if attributes.has_key?(:'javascript')
348
+ if attributes.key?(:'javascript')
318
349
  self.javascript = attributes[:'javascript']
319
350
  end
320
351
 
321
- if attributes.has_key?(:'css_dpi')
352
+ if attributes.key?(:'css_dpi')
322
353
  self.css_dpi = attributes[:'css_dpi']
323
354
  end
324
355
 
325
- if attributes.has_key?(:'profile')
356
+ if attributes.key?(:'profile')
326
357
  self.profile = attributes[:'profile']
327
358
  end
328
359
 
329
- if attributes.has_key?(:'pdf_title')
360
+ if attributes.key?(:'pdf_title')
330
361
  self.pdf_title = attributes[:'pdf_title']
331
362
  end
363
+
364
+ if attributes.key?(:'iframes')
365
+ self.iframes = attributes[:'iframes']
366
+ end
367
+
368
+ if attributes.key?(:'page_margin')
369
+ self.page_margin = attributes[:'page_margin']
370
+ end
371
+
372
+ if attributes.key?(:'pdf_forms')
373
+ self.pdf_forms = attributes[:'pdf_forms']
374
+ end
332
375
  end
333
376
 
334
377
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -341,17 +384,29 @@ module DocRaptor
341
384
  # Check to see if the all the properties in the model are valid
342
385
  # @return true if the model is valid
343
386
  def valid?
344
- input_validator = EnumAttributeValidator.new('String', ['html', 'xml', 'auto'])
387
+ key_bits_validator = EnumAttributeValidator.new('Integer', [40, 128])
388
+ return false unless key_bits_validator.valid?(@key_bits)
389
+ input_validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
345
390
  return false unless input_validator.valid?(@input)
346
391
  true
347
392
  end
348
393
 
394
+ # Custom attribute writer method checking allowed values (enum).
395
+ # @param [Object] key_bits Object to be assigned
396
+ def key_bits=(key_bits)
397
+ validator = EnumAttributeValidator.new('Integer', [40, 128])
398
+ unless validator.valid?(key_bits)
399
+ fail ArgumentError, "invalid value for \"key_bits\", must be one of #{validator.allowable_values}."
400
+ end
401
+ @key_bits = key_bits
402
+ end
403
+
349
404
  # Custom attribute writer method checking allowed values (enum).
350
405
  # @param [Object] input Object to be assigned
351
406
  def input=(input)
352
- validator = EnumAttributeValidator.new('String', ['html', 'xml', 'auto'])
407
+ validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
353
408
  unless validator.valid?(input)
354
- fail ArgumentError, 'invalid value for "input", must be one of #{validator.allowable_values}.'
409
+ fail ArgumentError, "invalid value for \"input\", must be one of #{validator.allowable_values}."
355
410
  end
356
411
  @input = input
357
412
  end
@@ -390,7 +445,10 @@ module DocRaptor
390
445
  javascript == o.javascript &&
391
446
  css_dpi == o.css_dpi &&
392
447
  profile == o.profile &&
393
- pdf_title == o.pdf_title
448
+ pdf_title == o.pdf_title &&
449
+ iframes == o.iframes &&
450
+ page_margin == o.page_margin &&
451
+ pdf_forms == o.pdf_forms
394
452
  end
395
453
 
396
454
  # @see the `==` method
@@ -400,9 +458,16 @@ module DocRaptor
400
458
  end
401
459
 
402
460
  # Calculates hash code according to all attributes.
403
- # @return [Fixnum] Hash code
461
+ # @return [Integer] Hash code
404
462
  def hash
405
- [baseurl, no_xinclude, no_network, no_parallel_downloads, http_user, http_password, http_proxy, http_timeout, insecure, media, no_author_style, no_default_style, no_embed_fonts, no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, debug, input, version, javascript, css_dpi, profile, pdf_title].hash
463
+ [baseurl, no_xinclude, no_network, no_parallel_downloads, http_user, http_password, http_proxy, http_timeout, insecure, media, no_author_style, no_default_style, no_embed_fonts, no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, debug, input, version, javascript, css_dpi, profile, pdf_title, iframes, page_margin, pdf_forms].hash
464
+ end
465
+
466
+ # Builds the object from hash
467
+ # @param [Hash] attributes Model attributes in the form of hash
468
+ # @return [Object] Returns the model itself
469
+ def self.build_from_hash(attributes)
470
+ new.build_from_hash(attributes)
406
471
  end
407
472
 
408
473
  # Builds the object from hash
@@ -410,8 +475,11 @@ module DocRaptor
410
475
  # @return [Object] Returns the model itself
411
476
  def build_from_hash(attributes)
412
477
  return nil unless attributes.is_a?(Hash)
413
- self.class.swagger_types.each_pair do |key, type|
414
- if type =~ /\AArray<(.*)>/i
478
+ attributes = attributes.transform_keys(&:to_sym)
479
+ self.class.openapi_types.each_pair do |key, type|
480
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
481
+ self.send("#{key}=", nil)
482
+ elsif type =~ /\AArray<(.*)>/i
415
483
  # check to ensure the input is an array given that the attribute
416
484
  # is documented as an array but the input is not
417
485
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -419,7 +487,7 @@ module DocRaptor
419
487
  end
420
488
  elsif !attributes[self.class.attribute_map[key]].nil?
421
489
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
422
- end # or else data not found in attributes(hash), not an issue as the data can be optional
490
+ end
423
491
  end
424
492
 
425
493
  self
@@ -431,8 +499,8 @@ module DocRaptor
431
499
  # @return [Object] Deserialized data
432
500
  def _deserialize(type, value)
433
501
  case type.to_sym
434
- when :DateTime
435
- DateTime.parse(value)
502
+ when :Time
503
+ Time.parse(value)
436
504
  when :Date
437
505
  Date.parse(value)
438
506
  when :String
@@ -441,7 +509,7 @@ module DocRaptor
441
509
  value.to_i
442
510
  when :Float
443
511
  value.to_f
444
- when :BOOLEAN
512
+ when :Boolean
445
513
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
446
514
  true
447
515
  else
@@ -462,8 +530,9 @@ module DocRaptor
462
530
  end
463
531
  end
464
532
  else # model
465
- temp_model = DocRaptor.const_get(type).new
466
- temp_model.build_from_hash(value)
533
+ # models (e.g. Pet) or oneOf
534
+ klass = DocRaptor.const_get(type)
535
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
467
536
  end
468
537
  end
469
538
 
@@ -485,7 +554,11 @@ module DocRaptor
485
554
  hash = {}
486
555
  self.class.attribute_map.each_pair do |attr, param|
487
556
  value = self.send(attr)
488
- next if value.nil?
557
+ if value.nil?
558
+ is_nullable = self.class.openapi_nullable.include?(attr)
559
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
560
+ end
561
+
489
562
  hash[param] = _to_hash(value)
490
563
  end
491
564
  hash
@@ -510,4 +583,5 @@ module DocRaptor
510
583
  end
511
584
 
512
585
  end
586
+
513
587
  end
@@ -3,13 +3,13 @@
3
3
 
4
4
  #A native client library for the DocRaptor HTML to PDF/XLS service.
5
5
 
6
- OpenAPI spec version: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.19
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  module DocRaptor
14
- VERSION = '2.0.0'
14
+ VERSION = '3.1.0'
15
15
  end
data/lib/docraptor.rb CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  #A native client library for the DocRaptor HTML to PDF/XLS service.
5
5
 
6
- OpenAPI spec version: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.19
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
data/script/clean CHANGED
@@ -1,5 +1,5 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  set -e
3
- cd "`dirname \"$0\"`/.."
3
+ cd "$(dirname "$0")/.."
4
4
 
5
5
  rm -rf lib/
data/script/console ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -e
3
+ cd "$(dirname "$0")/.."
4
+
5
+ script/docker "$@" /bin/bash
data/script/docker ADDED
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+ set -e
3
+ [[ "$TRACE" == "true" ]] && set -x
4
+ cd "$(dirname "$0")/.."
5
+
6
+ OPTIND=1
7
+
8
+ image=""
9
+
10
+ while getopts "h?i:" opt; do
11
+ case "$opt" in
12
+ h|\?)
13
+ show_help
14
+ exit 0
15
+ ;;
16
+ i) image="$OPTARG"
17
+ ;;
18
+ esac
19
+ done
20
+
21
+ shift $((OPTIND-1))
22
+
23
+ if [[ "$image" == "" ]]; then
24
+ image="$(cat .runtime-environments | grep -v '^#' | tail -n 1)"
25
+ echo "docker image (-i) unset, defaulting to: $image"
26
+ fi
27
+
28
+ if ! docker pull "$image"; then
29
+ echo "Pulling the latest version of ${image} failed, but we'll continue in"
30
+ echo "the hopes that there's a previous version of the container available."
31
+ echo "This probably isn't an issue unless you really want to verify"
32
+ echo "everything works with a :latest container image."
33
+ fi
34
+
35
+ command="$1"
36
+
37
+ mounts=()
38
+ while IFS=':' read -r source target; do
39
+ # Create the directory if it's not a special/magic path (like for ssh)
40
+ mkdir -p -m 700 "$source" &> /dev/null || true
41
+
42
+ mounts+=(--volume)
43
+ mounts+=("${source}:${target}")
44
+
45
+ # Can't pipe to the while loop because that causes a subshell, which means
46
+ # the variables set in the loop aren't available outside of it.
47
+ done < <(eval echo "\"$(grep -v '^#' .docker_mounts.list)\"")
48
+
49
+ set -x
50
+ docker run -it --rm \
51
+ --env-file .docker_env.list \
52
+ --env RUNTIME_ENV="${image}" \
53
+ --mount type=bind,source="$(pwd)",target=/app \
54
+ "${mounts[@]}" \
55
+ "$image" \
56
+ "$command"
@@ -1,28 +1,16 @@
1
- # coding: utf-8
1
+ # These, at least the first two, significantly increase speed of a test run by
2
+ # limiting the filesystem interaction that occurs with bundler installing and
3
+ # requiring files.
2
4
  bad_files = %q{s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }}
3
5
  good_files = %q{s.files = `git ls-files`.split("\n").uniq.sort.select { |f| !f.empty? }}
4
6
  bad_test_files = %q{s.test_files = `find spec/*`.split("\n")}
5
7
  good_test_files = %q{s.test_files = `git ls-files spec test`.split("\n")}
6
- bad_ruby_version = %q{s.required_ruby_version = ">= 1.9"}
7
- good_ruby_version = %q{s.required_ruby_version = ">= 2.3"}
8
-
9
- development_dependency_marker = %q{ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'}
10
- development_dependency_marker_plus_injection =
11
- " s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
12
-
13
- # added by script/fix_gemspec.rb.
14
- s.add_development_dependency 'rake', '~>11.2', '>= 11.2.2'
15
- s.add_development_dependency 'pry', '~>0.10', '>= 0.10.4'
16
- # </added> : if the above lines are missing in the gemspec, then
17
- # the matcher for autotest is probably broken"
18
8
 
19
9
  filename = "docraptor.gemspec"
20
10
  content = File.read(filename)
21
11
  [
22
12
  bad_files,
23
13
  bad_test_files,
24
- bad_ruby_version,
25
- development_dependency_marker
26
14
  ].each do |bad_content_to_check|
27
15
  unless content.include?(bad_content_to_check)
28
16
  raise "Couldn't find content in docraptor.gemspec. Check matchers in there for: “#{bad_content_to_check}”"
@@ -31,9 +19,6 @@ end
31
19
  updated_content = content.dup
32
20
  updated_content.sub!(bad_files, good_files)
33
21
  updated_content.sub!(bad_test_files, good_test_files)
34
- updated_content.sub!(bad_ruby_version, good_ruby_version)
35
- updated_content.sub!(development_dependency_marker,
36
- development_dependency_marker_plus_injection)
37
22
 
38
23
  File.open(filename, "w") do |file|
39
24
  file.write(updated_content)
@@ -1,9 +1,10 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  set -e
3
+ [[ "$TRACE" == "true" ]] && set -x
3
4
  cd "$(dirname "$0")/.."
4
5
 
5
- LANGUAGE="$1"
6
- CONFIG_FILE="swagger-config.json"
6
+ LANGUAGE="$(cat .generator-language-identifier)"
7
+ CONFIG_FILE="generator-config.json"
7
8
 
8
9
  if [ "$LANGUAGE" = "" ]; then
9
10
  ./script/swagger # prints languages
@@ -18,12 +19,50 @@ fi
18
19
 
19
20
  ./script/clean
20
21
 
22
+ # See .review/README.md
23
+ echo "Facilitating generated content review"
24
+ tmp_dir=".review/tmp"
25
+ review_root=".review/generated_files"
26
+ # Clear the tmp_dir, where we'll temporarily store our files so they aren't
27
+ # overwritten by the generated files.
28
+ rm -rf "$tmp_dir"
29
+ (cd "$review_root" && find . -type f) | while read file_path; do
30
+ # Move our file out of the way so it doesn't get overwritten by the generated
31
+ # file, but only if the file exists. Some files, like the generated docs and
32
+ # tests, aren't useful to users to we generally remove them, but we still
33
+ # want to facilitate review of these generated files.
34
+ if [ -e "$file_path" ]; then
35
+ mkdir -p "$(dirname "${tmp_dir}/$file_path")"
36
+ mv -v "$file_path" "${tmp_dir}/$file_path"
37
+ fi
38
+ done
39
+
21
40
  ./script/swagger generate \
22
41
  -i docraptor.yaml \
23
- -l "$LANGUAGE" \
42
+ -g "$LANGUAGE" \
24
43
  -c "$CONFIG_FILE"
25
44
 
26
45
  # call a generator cleanup script
27
46
  if [ -f "script/post_generate_language" ]; then
28
47
  ./script/post_generate_language
29
48
  fi
49
+
50
+ # See .review/README.md
51
+ echo "Facilitating generated content review"
52
+ (cd "$review_root" && find . -type f) | while read file_path; do
53
+ # Update $review_root to match the generated files.
54
+ if [ -e "$file_path" ]; then
55
+ # Move the newly generated file into the review directory so we'll be able to
56
+ # see it in the diff.
57
+ mv -v "$file_path" "$review_root/$file_path"
58
+ else
59
+ # If the file doesn't exist, then it was removed by the generator, so we
60
+ # should remove it from the review directory as well.
61
+ rm -v "$review_root/$file_path"
62
+ fi
63
+ # If we temporarily stored a file (meaning it existed before the generation)
64
+ # then move it back into place.
65
+ if [ -e "${tmp_dir}/$file_path" ]; then
66
+ mv -v "${tmp_dir}/$file_path" "$file_path"
67
+ fi
68
+ done
@@ -0,0 +1,6 @@
1
+ This folder contains scripts that are only intended to be run inside
2
+ of a relevant docker container. For example, `script/test` may run
3
+ `script/inside_container/test` inside a container with particular
4
+ versions of libraries to make it easy to test the agent in multiple
5
+ settings. It's possible these scripts will work outside of any
6
+ particular container, but that may or may not mean anything.