swagger_autogenerate 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d62d2b3204e47e668408ea353aa7f5015a9f1a8f86e727e635b1030e999f587
4
- data.tar.gz: 7cbcbfc449684fe35db3c76c7c8bb0ae357ebabf8585ba7289c3b6d58abec9a9
3
+ metadata.gz: 7fbb1ab2c8c24337c43f68b09a4452cbbf5256ac31f44d1b35ea392488c43708
4
+ data.tar.gz: 89f43851ca840877b888e5e83217af2b42ba0fa694943885e67e76b5178e63ed
5
5
  SHA512:
6
- metadata.gz: f9dea5813fe7a651d4fa59d618b86a02a2e909a23bdcb8744aa56bd96ff667143482d52316b70f78868c2cbbf3de5e2e6104b9cdb8f13e00e6a2483f15ac2da7
7
- data.tar.gz: a7fa27d728d65a7e8d2fb58dcb052c81d1486a1d3c89b3326851797419cff037e28322eec8284a19f81be1c4121ed9dd33a83605a31ee1606bdccfa61b30c813
6
+ metadata.gz: a8f034a350700b4b0a73e6d8b935d659c5b2c470da0a510f1652e182ba044f20eacebd1c7127b3591c37b7b18f54a599d92fbe7de4301595e3d8526a55a948c2
7
+ data.tar.gz: 5ec0cb3486777df804a45f8e7c0f49e2f05c0dc8906e808f6378fecacd5d3776330ab99f3d3a59a0477b1dbd7428ba8a8e51f1b6843816f7412d4f43b3a8c3d7
data/CHANGELOG.md CHANGED
@@ -17,5 +17,6 @@
17
17
  ## [1.2.2] - 2024-09-12
18
18
  ## [1.2.3] - 2024-09-12
19
19
  ## [1.2.4] - 2024-09-15
20
+ ## [1.2.5] - 2024-09-15
20
21
 
21
22
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swagger_autogenerate (1.2.4)
4
+ swagger_autogenerate (1.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -47,8 +47,8 @@ To configure the swagger_autogenerate gem in your Rails application, follow thes
47
47
  ```
48
48
  SwaggerAutogenerate.configure do |config|
49
49
  config.with_config = true
50
- config.with_example_description = true
51
50
  config.with_multiple_examples = true
51
+ action_for_old_examples = :append # :replace or :append
52
52
  config.with_response_description = true
53
53
  end
54
54
 
@@ -64,7 +64,7 @@ This file should contain the test scenarios for each action (e.g., index, show,
64
64
 
65
65
  3) Run the spec code using the rspec command and set the environment variable SWAGGER to the desired YAML file name. For example:
66
66
  ```
67
- SWAGGER_PATH='employee_apis.yaml' rspec spec/your_path/employees_controller_spec.rb
67
+ SWAGGER_GENERATE_PATH='employee_apis.yaml' rspec spec/your_path/employees_controller_spec.rb
68
68
  ```
69
69
  4) This command runs the spec file and instructs the swagger_autogenerate gem to generate Swagger YAML documentation and save it to the file named employee_apis.yaml.
70
70
  5) Once the command finishes executing, you will have the Swagger YAML documentation generated based on the test scenarios in the employees_controller_spec.rb file.
@@ -198,6 +198,15 @@ module SwaggerAutogenerate
198
198
  hash
199
199
  end
200
200
 
201
+ def schema_type(value)
202
+ return 'integer' if number?(value)
203
+ return 'boolean' if (value.try(:downcase) == 'true') || (value.try(:downcase) == 'false')
204
+ return 'string' if value.instance_of?(String) || value.instance_of?(Symbol)
205
+ return 'array' if value.instance_of?(Array)
206
+
207
+ 'object'
208
+ end
209
+
201
210
  def set_parameters(parameters, parameter, required: false)
202
211
  return if parameter.blank?
203
212
 
@@ -403,15 +412,6 @@ module SwaggerAutogenerate
403
412
  false
404
413
  end
405
414
 
406
- def schema_type(value)
407
- return 'integer' if number?(value)
408
- return 'boolean' if (value.try(:downcase) == 'true') || (value.try(:downcase) == 'false')
409
- return 'string' if value.instance_of?(String) || value.instance_of?(Symbol)
410
- return 'array' if value.instance_of?(Array)
411
-
412
- 'object'
413
- end
414
-
415
415
  def example(value)
416
416
  return value.to_i if number?(value)
417
417
  return convert_to_date(value) if value.instance_of?(String) && is_valid_date?(value)
@@ -428,7 +428,7 @@ module SwaggerAutogenerate
428
428
  end
429
429
 
430
430
  def convert_to_date(string)
431
- datetime = DateTime.strptime(string)
431
+ datetime = Date.strptime(string)
432
432
  datetime.strftime('%Y-%m-%d')
433
433
  rescue ArgumentError
434
434
  string
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwaggerAutogenerate
4
- VERSION = "1.2.4"
4
+ VERSION = "1.2.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_autogenerate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - MohammedBuraiah