lambda_open_api 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d36e338d14f7ec73fa44a6dcff28a9318d8232211e060ff4b9e831b1c32592
|
4
|
+
data.tar.gz: ec5683c9cae85aeddfd0c391d7ee46ecda7b7ba221c766cf63cd0ee64185e846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50a309862a63e87bc791ffff8740deb6e6cdbfb28885045576acd767479997548321ef29a0c0d489a432f8031d71c6b3c9c110e3e1cadca376709a311b027b48
|
7
|
+
data.tar.gz: 3b2dad01c575f9df59d532608de110617f2f9ee2378504410669c27d0f1573d6cc41dea41693c2096d93a26e605451541a0a09eac3a09b0f119ea9b94660b0eb
|
data/Gemfile.lock
CHANGED
@@ -4,14 +4,8 @@ module LambdaOpenApi
|
|
4
4
|
class BodyParameter
|
5
5
|
attr_accessor :data
|
6
6
|
|
7
|
-
def initialize(data = nil
|
8
|
-
@file_name = file_name
|
9
|
-
|
7
|
+
def initialize(data = nil)
|
10
8
|
@data = data
|
11
|
-
if data.nil? && File.exists?("lib/lambda_open_api/examples/requests/#{file_name}.json")
|
12
|
-
json = File.open("lib/lambda_open_api/examples/requests/#{file_name}.json").read
|
13
|
-
@data = JSON.parse(json)
|
14
|
-
end
|
15
9
|
end
|
16
10
|
|
17
11
|
def json
|
@@ -15,6 +15,22 @@ module LambdaOpenApi
|
|
15
15
|
"type"=> "object",
|
16
16
|
"properties"=> hash.props
|
17
17
|
}
|
18
|
+
elsif value.is_a?(Array)
|
19
|
+
item_props = {}
|
20
|
+
|
21
|
+
value.each do |item|
|
22
|
+
hash = LambdaOpenApi::BodyProperty.new
|
23
|
+
hash.generate(item)
|
24
|
+
item_props.merge!(hash.props)
|
25
|
+
end
|
26
|
+
|
27
|
+
props[key.to_s] = {
|
28
|
+
"type"=> "array",
|
29
|
+
"items"=> {
|
30
|
+
"type" => "object",
|
31
|
+
"properties" => item_props
|
32
|
+
}
|
33
|
+
}
|
18
34
|
else
|
19
35
|
props[key.to_s] = {
|
20
36
|
"type"=> value_type(value)
|
@@ -115,7 +115,7 @@ module LambdaOpenApi
|
|
115
115
|
def self.invoke
|
116
116
|
invokcation = LambdaOpenApi::Invoker.new(klass: @klass, method: "process", event: @event.json, context: OpenStruct.new(aws_request_id: "123"))
|
117
117
|
@action.set_response(invokcation.response_body)
|
118
|
-
invokcation.
|
118
|
+
invokcation.response
|
119
119
|
end
|
120
120
|
def self.set_action(action)
|
121
121
|
@action = action
|