swagger_autogenerate 1.0.9 → 1.1.1
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 +9 -7
- data/lib/swagger_autogenerate/swagger_trace.rb +20 -5
- data/lib/swagger_autogenerate/version.rb +1 -1
- data/lib/swagger_autogenerate.rb +8 -3
- 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: 2a323ab35e5b839c6b85294fdf080ce0053fe43854eafbc1d1046b26cf14b7f2
|
4
|
+
data.tar.gz: 996cd6d73b26711cc59cefe81f720fb747d1a38d5442fa713b3284528f3b8d2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5794de7918cd298fab142696ff91a6873563fc2a31f6fa9ea60d8ea5a8c483c4467f64c5736f97ebdb92509059ab888032de8d903e8ef1caea486796384693b9
|
7
|
+
data.tar.gz: 82593525706f167db50f96ead26c6e6ef4f6f1ba5911b761838bd5bf6ab0772d3cd9378fd8b4e1648d9fc0bf85a87868078bfe642175fd7994c7998258a3dfa5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module SwaggerAutogenerate
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :with_config, :with_multiple_examples, :with_example_description,
|
4
|
-
:with_response_description, :swagger_environment_variable
|
4
|
+
:with_response_description, :swagger_environment_variable,
|
5
|
+
:environment_name, :security, :swagger_config, :response_status
|
5
6
|
|
6
7
|
def initialize
|
7
8
|
@with_config = true
|
@@ -9,12 +10,13 @@ module SwaggerAutogenerate
|
|
9
10
|
@with_example_description = true
|
10
11
|
@with_response_description = true
|
11
12
|
@swagger_environment_variable = 'SWAGGER'
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
13
|
+
@environment_name = :test
|
14
|
+
@security = default_security
|
15
|
+
@swagger_config = default_swagger_config
|
16
|
+
@response_status = default_response_status
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
19
|
+
def default_response_status
|
18
20
|
{
|
19
21
|
100 => 'The initial part of the request has been received, and the client should proceed with sending the remainder of the request',
|
20
22
|
101 => 'The server agrees to switch protocols and is acknowledging the client\'s request to change the protocol being used',
|
@@ -40,7 +42,7 @@ module SwaggerAutogenerate
|
|
40
42
|
}
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
45
|
+
def default_swagger_config
|
44
46
|
{
|
45
47
|
'openapi' => '3.0.0',
|
46
48
|
'info' => {
|
@@ -61,7 +63,7 @@ module SwaggerAutogenerate
|
|
61
63
|
}
|
62
64
|
end
|
63
65
|
|
64
|
-
def
|
66
|
+
def default_security
|
65
67
|
[
|
66
68
|
{ 'org_slug' => [] },
|
67
69
|
{ 'locale' => [] }
|
@@ -16,10 +16,8 @@ module SwaggerAutogenerate
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
|
20
|
-
|
21
|
-
write_swagger_trace
|
22
|
-
end
|
19
|
+
read_swagger_trace
|
20
|
+
write_swagger_trace
|
23
21
|
end
|
24
22
|
|
25
23
|
def self.swagger_environment_variable
|
@@ -30,6 +28,14 @@ module SwaggerAutogenerate
|
|
30
28
|
SwaggerTrace.swagger_environment_variable
|
31
29
|
end
|
32
30
|
|
31
|
+
def self.environment_name
|
32
|
+
::SwaggerAutogenerate.configuration.environment_name
|
33
|
+
end
|
34
|
+
|
35
|
+
def environment_name
|
36
|
+
SwaggerTrace.environment_name
|
37
|
+
end
|
38
|
+
|
33
39
|
private
|
34
40
|
|
35
41
|
attr_reader :request, :response, :current_path, :yaml_file, :configuration,
|
@@ -220,7 +226,16 @@ module SwaggerAutogenerate
|
|
220
226
|
end
|
221
227
|
|
222
228
|
def content_form_data(data)
|
223
|
-
|
229
|
+
hash_data = {}
|
230
|
+
data.map do |key, value|
|
231
|
+
if value.is_a?(Hash)
|
232
|
+
hash_data.merge!({ key => value })
|
233
|
+
else
|
234
|
+
payload_hash.merge!({ key => { 'type' => schema_type(value), 'example' => example(value) } })
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
convert_to_multipart(hash_data)
|
224
239
|
converted_payload = @payload_hash.clone
|
225
240
|
@payload_hash = nil
|
226
241
|
@payload_keys = nil
|
data/lib/swagger_autogenerate.rb
CHANGED
@@ -5,12 +5,17 @@ module SwaggerAutogenerate
|
|
5
5
|
require_relative 'swagger_autogenerate/swagger_trace.rb'
|
6
6
|
|
7
7
|
included do
|
8
|
-
|
9
|
-
|
10
|
-
super
|
8
|
+
def process_action(*args)
|
9
|
+
super
|
11
10
|
|
11
|
+
if ENV[SwaggerTrace.swagger_environment_variable].present? && Rails.env.send("#{SwaggerTrace.environment_name.to_s}?")
|
12
12
|
SwaggerTrace.new(request, response).call
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
# fix []
|
19
|
+
# create command to direct add configuration file in test environment
|
20
|
+
# handel headers
|
21
|
+
# can the SWAGGER accespt empty value?
|
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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MohammedBuraiah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-27 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
|