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 +4 -4
- data/CHANGELOG.md +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/swagger_autogenerate/swagger_trace.rb +10 -10
- data/lib/swagger_autogenerate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fbb1ab2c8c24337c43f68b09a4452cbbf5256ac31f44d1b35ea392488c43708
|
4
|
+
data.tar.gz: 89f43851ca840877b888e5e83217af2b42ba0fa694943885e67e76b5178e63ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f034a350700b4b0a73e6d8b935d659c5b2c470da0a510f1652e182ba044f20eacebd1c7127b3591c37b7b18f54a599d92fbe7de4301595e3d8526a55a948c2
|
7
|
+
data.tar.gz: 5ec0cb3486777df804a45f8e7c0f49e2f05c0dc8906e808f6378fecacd5d3776330ab99f3d3a59a0477b1dbd7428ba8a8e51f1b6843816f7412d4f43b3a8c3d7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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
|
-
|
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 =
|
431
|
+
datetime = Date.strptime(string)
|
432
432
|
datetime.strftime('%Y-%m-%d')
|
433
433
|
rescue ArgumentError
|
434
434
|
string
|