swagger_autogenerate 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +1 -1
- data/lib/swagger_autogenerate/configuration.rb +0 -5
- data/lib/swagger_autogenerate/swagger_trace.rb +12 -4
- data/lib/swagger_autogenerate/version.rb +1 -1
- data/lib/swagger_autogenerate.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baeb0333fe686eb9c041d44e0a37f816ea1467b5eff9acb59189bf2c8ee1ca22
|
4
|
+
data.tar.gz: b4a9d7f8bcbacd061cc7f61058e81d3eebf31908ddb47058155ba45b8d6d0df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78da25f6d4ff424ecfe162016f2f5565c4ac1f9995767f45efa4030d95df9a15132a2ebaf692620fd5bc500916b69689dac5fd8aeac6ee53ea67ee64a2764779
|
7
|
+
data.tar.gz: 87d783020090efc560b3ae50dc21846a7e9b3f682119fbc4c61b8610450e165dc1b7fd6c9fd64b6648a809d6a7c14c3bdb7ff0e5c34b723ea8cea86f5e39fc1d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -82,9 +82,4 @@ module SwaggerAutogenerate
|
|
82
82
|
def self.configure
|
83
83
|
yield(configuration)
|
84
84
|
end
|
85
|
-
|
86
|
-
def self.extract_description(full_rspec_description)
|
87
|
-
parts = full_rspec_description.split(' ')
|
88
|
-
parts&.length > 1 ? parts[2..-1].join(" ") : full_rspec_description
|
89
|
-
end
|
90
85
|
end
|
@@ -303,13 +303,19 @@ module SwaggerAutogenerate
|
|
303
303
|
{ 'type' => 'array', 'items' => { 'oneOf' => item_schemas.uniq } }
|
304
304
|
end
|
305
305
|
when String
|
306
|
-
|
306
|
+
if is_valid_date?(json)
|
307
|
+
{ 'type' => 'Date', 'example' => json.to_date.to_s }
|
308
|
+
else
|
309
|
+
{ 'type' => 'string', 'example' => json.to_s }
|
310
|
+
end
|
307
311
|
when Integer
|
308
312
|
{ 'type' => 'integer', 'example' => json }
|
309
313
|
when Float
|
310
314
|
{ 'type' => 'number', 'example' => json }
|
311
315
|
when TrueClass, FalseClass
|
312
316
|
{ 'type' => 'boolean', 'example' => json }
|
317
|
+
when Date, Time, DateTime
|
318
|
+
{ 'type' => 'Date', 'example' => json.to_date.to_s }
|
313
319
|
else
|
314
320
|
{ 'type' => 'string', 'example' => json.to_s }
|
315
321
|
end
|
@@ -522,9 +528,11 @@ module SwaggerAutogenerate
|
|
522
528
|
end
|
523
529
|
|
524
530
|
def handel_name_last_example(old_examples)
|
525
|
-
last_example = old_examples.keys.last
|
526
|
-
|
527
|
-
|
531
|
+
last_example = full_rspec_description || old_examples.keys.last
|
532
|
+
if old_examples.keys.include?(last_example)
|
533
|
+
last_example += '-1'
|
534
|
+
json_example_plus_one(last_example)
|
535
|
+
end
|
528
536
|
end
|
529
537
|
|
530
538
|
def add_properties_to_schema(last_example, main_path = yaml_file['paths'][current_path])
|
data/lib/swagger_autogenerate.rb
CHANGED
@@ -25,7 +25,7 @@ if defined?(RSpec) && SwaggerAutogenerate.allow_swagger?
|
|
25
25
|
|
26
26
|
RSpec.configure do |config|
|
27
27
|
config.before(:each) do |example|
|
28
|
-
SwaggerAutogenerate::SwaggerTrace.rspec_description =
|
28
|
+
SwaggerAutogenerate::SwaggerTrace.rspec_description = example&.metadata.dig(:example_group, :description)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagger_autogenerate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MohammedBuraiah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Generating Swagger YAML Automatically Based on Existing Test Cases in
|
14
14
|
Ruby on Rails
|