swagger_autogenerate 1.0.3 → 1.0.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 +2 -0
- data/README.md +8 -15
- data/lib/swagger_autogenerate/{swagger_public_methods.rb → configuration.rb} +30 -1
- data/lib/swagger_autogenerate/swagger_trace.rb +4 -11
- data/lib/swagger_autogenerate/version.rb +1 -1
- data/swagger_autogenerate-1.0.3.gem +0 -0
- data/swagger_autogenerate-1.0.4.gem +0 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de7c3c54299bca0310e57c2dc60c2750f9e2049be3b0aa7c5ad20d5be5275649
|
4
|
+
data.tar.gz: 112e76465590e54d7143f5ea6069070cdf2d998d1a2569546d731ff7479b15d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174038de8425e12176b7683a13d0d7f66146d28c5abec0c38d6df5c05e5fcafe0e560977b852c19a26908174804fd9b967089d9981d8646279e1d148b2af601e
|
7
|
+
data.tar.gz: fb37e2cf72776a59a7de9c320a579a0dcc57c86e4e4dc38464f5d370c7d26ab54ea689c1a3d39b6b3c4cbbd6c2e56043b265a348a10b611a58074f0d32b79fa6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -37,28 +37,21 @@ To configure the swagger_autogenerate gem in your Rails application, follow thes
|
|
37
37
|
2) Inside the class ApplicationController block.
|
38
38
|
3) Add the following code:
|
39
39
|
```
|
40
|
-
include SwaggerAutogenerate if Rails.env.test?
|
40
|
+
include SwaggerAutogenerate if Rails.env.test?
|
41
41
|
```
|
42
|
-
in the #Example-step you will set the ENV['SWAGGER'],
|
43
|
-
|
44
|
-
By setting the ENV['SWAGGER'] environment variable, you can specify the path to the new file,
|
45
|
-
whether it's a specific file (e.g., ../myfile.yaml) or a directory (e.g., ../docs).
|
46
|
-
This flexibility ensures that the documentation can be easily integrated into your project's structure and workflow.
|
47
42
|
|
48
43
|
### Step 2 (optional)
|
49
44
|
1) Create a file called swagger_autogenerate.rb in the ./config/initializers
|
50
|
-
2) Open the ./config/initializers/
|
45
|
+
2) Open the ./config/initializers/swagger_autogenerate.rb
|
51
46
|
3) Add the following code to the swagger_autogenerate.rb
|
52
47
|
```
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
WITH_RESPONSE_DESCRIPTION = true
|
59
|
-
SWAGGER_ENVIRONMENT_VARIABLE = 'SWAGGER'
|
60
|
-
end
|
48
|
+
SwaggerAutogenerate.configure do |config|
|
49
|
+
config.with_config = true
|
50
|
+
config.with_example_description = true
|
51
|
+
config.with_multiple_examples = true
|
52
|
+
config.with_response_description = true
|
61
53
|
end
|
54
|
+
|
62
55
|
```
|
63
56
|
$ This file is optional and allows you to customize the behavior of the gem by providing additional options.
|
64
57
|
|
@@ -1,5 +1,19 @@
|
|
1
1
|
module SwaggerAutogenerate
|
2
|
-
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :with_config, :with_multiple_examples, :with_example_description,
|
4
|
+
:with_response_description, :swagger_environment_variable
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@with_config = true
|
8
|
+
@with_multiple_examples = true
|
9
|
+
@with_example_description = true
|
10
|
+
@with_response_description = true
|
11
|
+
@swagger_environment_variable = 'SWAGGER'
|
12
|
+
@security = security
|
13
|
+
@swagger_config = swagger_config
|
14
|
+
@response_status = response_status
|
15
|
+
end
|
16
|
+
|
3
17
|
def response_status
|
4
18
|
{
|
5
19
|
100 => 'The initial part of the request has been received, and the client should proceed with sending the remainder of the request',
|
@@ -46,5 +60,20 @@ module SwaggerAutogenerate
|
|
46
60
|
}
|
47
61
|
}
|
48
62
|
end
|
63
|
+
|
64
|
+
def security
|
65
|
+
[
|
66
|
+
{ 'org_slug' => [] },
|
67
|
+
{ 'locale' => [] }
|
68
|
+
]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.configuration
|
73
|
+
@configuration ||= Configuration.new
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.configure
|
77
|
+
yield(configuration)
|
49
78
|
end
|
50
79
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require_relative 'swagger_public_methods'
|
2
1
|
require_relative 'configuration'
|
3
2
|
|
4
3
|
module SwaggerAutogenerate
|
5
4
|
class SwaggerTrace
|
6
|
-
include SwaggerPublicMethods
|
7
|
-
|
8
5
|
def initialize(request, response)
|
9
6
|
@with_config = ::SwaggerAutogenerate.configuration.with_config
|
10
7
|
@with_multiple_examples = ::SwaggerAutogenerate.configuration.with_multiple_examples
|
11
8
|
@with_example_description = ::SwaggerAutogenerate.configuration.with_example_description
|
12
9
|
@with_response_description = ::SwaggerAutogenerate.configuration.with_response_description
|
10
|
+
@security = ::SwaggerAutogenerate.configuration.security
|
11
|
+
@swagger_config = ::SwaggerAutogenerate.configuration.swagger_config
|
12
|
+
@response_status = ::SwaggerAutogenerate.configuration.response_status
|
13
13
|
@request = request
|
14
14
|
@response = response
|
15
15
|
@@paths = {}
|
@@ -34,7 +34,7 @@ module SwaggerAutogenerate
|
|
34
34
|
|
35
35
|
attr_reader :request, :response, :current_path, :yaml_file, :configuration,
|
36
36
|
:with_config, :with_multiple_examples, :with_example_description,
|
37
|
-
:with_response_description
|
37
|
+
:with_response_description, :security, :response_status
|
38
38
|
|
39
39
|
# main methods
|
40
40
|
|
@@ -310,13 +310,6 @@ module SwaggerAutogenerate
|
|
310
310
|
@@paths ||= {}
|
311
311
|
end
|
312
312
|
|
313
|
-
def security
|
314
|
-
[
|
315
|
-
'org_slug' => [],
|
316
|
-
'locale' => []
|
317
|
-
]
|
318
|
-
end
|
319
|
-
|
320
313
|
def controller_name
|
321
314
|
request.params['controller'].split('/').last.to_s
|
322
315
|
end
|
Binary file
|
Binary file
|
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.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MohammedBuraiah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-01 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
|
@@ -25,13 +25,15 @@ files:
|
|
25
25
|
- Rakefile
|
26
26
|
- lib/config/initializers/swagger_autogenerate.rb
|
27
27
|
- lib/swagger_autogenerate.rb
|
28
|
-
- lib/swagger_autogenerate/
|
28
|
+
- lib/swagger_autogenerate/configuration.rb
|
29
29
|
- lib/swagger_autogenerate/swagger_trace.rb
|
30
30
|
- lib/swagger_autogenerate/version.rb
|
31
31
|
- sig/swagger_autogenerate.rbs
|
32
32
|
- swagger_autogenerate-0.1.0.gem
|
33
33
|
- swagger_autogenerate-0.1.1.gem
|
34
34
|
- swagger_autogenerate-1.0.2.gem
|
35
|
+
- swagger_autogenerate-1.0.3.gem
|
36
|
+
- swagger_autogenerate-1.0.4.gem
|
35
37
|
- swagger_autogenerate.gemspec
|
36
38
|
homepage: https://github.com/MohammedBuraiah/swagger_autogenerate
|
37
39
|
licenses:
|