aws-sdk-code-generator 0.2.1.pre → 0.2.2.pre
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 +4 -4
- data/lib/aws-sdk-code-generator/api.rb +15 -5
- data/lib/aws-sdk-code-generator/client_operation_documentation.rb +1 -1
- data/lib/aws-sdk-code-generator/helper.rb +0 -58
- data/lib/aws-sdk-code-generator/plugin_list.rb +1 -1
- data/lib/aws-sdk-code-generator/views/features/smoke.rb +2 -1
- data/lib/aws-sdk-code-generator/views/features/step_definitions.rb +4 -2
- data/templates/features/smoke.mustache +5 -0
- data/templates/features/smoke_step_definitions.mustache +4 -0
- data/templates/features/step_definitions.mustache +5 -0
- 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: e4fa27373a270b0e11b172d68ccc2c1c5b7926f986a1fb630be00b0a591a956a
|
4
|
+
data.tar.gz: 78f1365cdb7d7b78bdb6b2269e8ce18a42907eff158f7dae9b20c7fcaf6b6a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e82e811fa8689c93762b0c590f2d12f3c0dbda5d040d932d7caeb5396096cf8b2109394bb992f0325b137993534cadd0905515f7265e74b25b9de81efb9f51
|
7
|
+
data.tar.gz: b7f27268bbc20faa1c6a6439019ca9ec57e905f509ff4b95904eb0e6b13f0bf6e87f6eca0b81b1235d60f5d961fc0bbd5fd2c97ed7076cda9c7bc8b595966c1a
|
@@ -47,12 +47,17 @@ module AwsSdkCodeGenerator
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def ruby_input_type(shape_ref, api, options = {})
|
50
|
+
def ruby_input_type(shape_ref, api, operation = nil, options = {})
|
51
51
|
nested = options.fetch(:nested, false)
|
52
52
|
_, shape = resolve(shape_ref, api)
|
53
53
|
case shape['type']
|
54
54
|
when 'byte' then 'Integer<byte>'
|
55
|
-
when 'blob'
|
55
|
+
when 'blob'
|
56
|
+
if streaming_input?(shape, operation)
|
57
|
+
'String, IO'
|
58
|
+
else
|
59
|
+
'String, StringIO, File'
|
60
|
+
end
|
56
61
|
when 'boolean' then 'Boolean'
|
57
62
|
when 'character' then 'String<character>'
|
58
63
|
when 'double' then 'Float'
|
@@ -62,14 +67,14 @@ module AwsSdkCodeGenerator
|
|
62
67
|
if nested
|
63
68
|
"Array"
|
64
69
|
else
|
65
|
-
"Array<#{ruby_input_type(shape['member'], api, nested: true)}>"
|
70
|
+
"Array<#{ruby_input_type(shape['member'], api, operation, nested: true)}>"
|
66
71
|
end
|
67
72
|
when 'long' then 'Integer'
|
68
73
|
when 'map'
|
69
74
|
if nested
|
70
75
|
"Hash"
|
71
76
|
else
|
72
|
-
"Hash<String,#{ruby_input_type(shape['value'], api, nested: true)}>"
|
77
|
+
"Hash<String,#{ruby_input_type(shape['value'], api, operation, nested: true)}>"
|
73
78
|
end
|
74
79
|
when 'string' then 'String'
|
75
80
|
when 'structure' then "Types::#{shape_ref['shape']}"
|
@@ -113,6 +118,12 @@ module AwsSdkCodeGenerator
|
|
113
118
|
ref['eventstream'] || shape['eventstream']
|
114
119
|
end
|
115
120
|
|
121
|
+
# @return [Boolean]
|
122
|
+
def streaming_input?(shape, operation)
|
123
|
+
shape['streaming'] && operation &&
|
124
|
+
operation['authtype'] == "v4-unsigned-body"
|
125
|
+
end
|
126
|
+
|
116
127
|
def plural?(resource)
|
117
128
|
plural = false
|
118
129
|
(resource['identifiers'] || []).each do |i|
|
@@ -124,7 +135,6 @@ module AwsSdkCodeGenerator
|
|
124
135
|
plural = true if resource['data'] && resource['data'].include?('[]')
|
125
136
|
plural
|
126
137
|
end
|
127
|
-
|
128
138
|
end
|
129
139
|
end
|
130
140
|
end
|
@@ -102,7 +102,7 @@ module AwsSdkCodeGenerator
|
|
102
102
|
end
|
103
103
|
YardOptionTag.new(
|
104
104
|
name: Underscore.underscore(member_name),
|
105
|
-
ruby_type: Api.ruby_input_type(member_ref, api),
|
105
|
+
ruby_type: Api.ruby_input_type(member_ref, api, operation),
|
106
106
|
required: shape.fetch('required', []).include?(member_name),
|
107
107
|
docstring: Docstring.html_to_markdown(docstring),
|
108
108
|
option_hash_name: 'params',
|
@@ -41,64 +41,6 @@ module AwsSdkCodeGenerator
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
# @option options [Boolean] :nested (false)
|
45
|
-
def ruby_input_type(shape_ref, options = {})
|
46
|
-
nested = options.fetch(:nested, false)
|
47
|
-
shape = @api['shapes'][shape_ref['shape']]
|
48
|
-
case shape['type']
|
49
|
-
when 'byte' then 'Integer<byte>'
|
50
|
-
when 'blob' then 'String, IO'
|
51
|
-
when 'boolean' then 'Boolean'
|
52
|
-
when 'character' then 'String<character>'
|
53
|
-
when 'double' then 'Float'
|
54
|
-
when 'float' then 'Float'
|
55
|
-
when 'integer' then 'Integer'
|
56
|
-
when 'list'
|
57
|
-
if nested
|
58
|
-
"Array"
|
59
|
-
else
|
60
|
-
"Array<#{ruby_input_type(shape['member'], nested:true)}>"
|
61
|
-
end
|
62
|
-
when 'long' then 'Integer'
|
63
|
-
when 'map'
|
64
|
-
if nested
|
65
|
-
"Hash"
|
66
|
-
else
|
67
|
-
"Hash<String,#{ruby_input_type(shape['value'], nested:true)}>"
|
68
|
-
end
|
69
|
-
when 'string' then 'String'
|
70
|
-
when 'structure' then "Types::#{shape_ref['shape']}"
|
71
|
-
when 'timestamp' then 'Time,DateTime,Date,Integer,String'
|
72
|
-
else
|
73
|
-
raise "unhandled type #{shape.type}.inspect"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def ruby_type(shape_ref)
|
78
|
-
shape = @api['shapes'][shape_ref['shape']]
|
79
|
-
case shape['type']
|
80
|
-
when 'blob' then streaming?(shape_ref, shape) ? 'IO' : 'String'
|
81
|
-
when 'boolean' then 'Boolean'
|
82
|
-
when 'byte' then 'Integer<byte>'
|
83
|
-
when 'character' then 'String<character>'
|
84
|
-
when 'double' then 'Float'
|
85
|
-
when 'float' then 'Float'
|
86
|
-
when 'integer' then 'Integer'
|
87
|
-
when 'list' then "Array<#{ruby_type(shape['member'])}>"
|
88
|
-
when 'long' then 'Integer'
|
89
|
-
when 'map' then "Hash<String,#{ruby_type(shape['value'])}>"
|
90
|
-
when 'string' then 'String'
|
91
|
-
when 'structure' then "Types::#{shape_ref['shape']}"
|
92
|
-
when 'timestamp' then 'Time'
|
93
|
-
else
|
94
|
-
raise "unhandled type #{shape['type'].inspect}"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def streaming?(ref, shape)
|
99
|
-
ref['streaming'] || shape['streaming']
|
100
|
-
end
|
101
|
-
|
102
44
|
# @option options [Integer] :line_width (70)
|
103
45
|
def documentation(ref_or_shape, options = {})
|
104
46
|
line_width = options.fetch(:line_width, 70)
|
@@ -15,6 +15,7 @@ module AwsSdkCodeGenerator
|
|
15
15
|
# This will only be called if this is defined
|
16
16
|
smoke_json = service.smoke_tests
|
17
17
|
@client_region = smoke_json["defaultRegion"]
|
18
|
+
@client_endpoint = smoke_json["defaultEndpoint"]
|
18
19
|
@smoke_tests = smoke_json["testCases"].map do |test|
|
19
20
|
h = {
|
20
21
|
operation: underscore(test["operationName"]),
|
@@ -37,7 +38,7 @@ module AwsSdkCodeGenerator
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
attr_reader :service, :client_region, :smoke_tests
|
41
|
+
attr_reader :service, :client_region, :client_endpoint, :smoke_tests
|
41
42
|
|
42
43
|
# @return [String|nil]
|
43
44
|
def generated_src_warning
|
@@ -11,10 +11,12 @@ module AwsSdkCodeGenerator
|
|
11
11
|
service = options.fetch(:service)
|
12
12
|
@var_name = service.identifier
|
13
13
|
@module_name = service.module_name
|
14
|
+
if service.smoke_tests
|
15
|
+
@client_endpoint = service.smoke_tests['defaultEndpoint']
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
|
-
attr_reader :var_name
|
17
|
-
attr_reader :module_name
|
19
|
+
attr_reader :var_name, :module_name, :client_endpoint
|
18
20
|
|
19
21
|
end
|
20
22
|
end
|
@@ -4,7 +4,12 @@
|
|
4
4
|
Feature: Smoke tests for {{service}}
|
5
5
|
|
6
6
|
Background:
|
7
|
+
{{#client_endpoint}}
|
8
|
+
Given I create a client with endpoint '{{client_endpoint}}'
|
9
|
+
{{/client_endpoint}}
|
10
|
+
{{^client_endpoint}}
|
7
11
|
Given I create a client in region '{{client_region}}'
|
12
|
+
{{/client_endpoint}}
|
8
13
|
{{#smoke_tests}}
|
9
14
|
|
10
15
|
{{smoke_test_tags}}
|
@@ -8,6 +8,10 @@ Given(/I create a client in region '(.*?)'/) do |region|
|
|
8
8
|
@regional_client = {{module_name}}::Client.new(region: region)
|
9
9
|
end
|
10
10
|
|
11
|
+
Given(/I create a client with endpoint '(.*?)'/) do |endpoint|
|
12
|
+
@regional_client = {{module_name}}::Client.new(endpoint: endpoint)
|
13
|
+
end
|
14
|
+
|
11
15
|
When(/I call the operation '(.*?)' with params:/) do |operation, params|
|
12
16
|
opts = JSON.parse(params, symbolize_names: true)
|
13
17
|
begin
|
@@ -1,5 +1,10 @@
|
|
1
1
|
Before("@{{var_name}}") do
|
2
|
+
{{#client_endpoint}}
|
3
|
+
@service = {{module_name}}::Resource.new(endpoint: '{{client_endpoint}}')
|
4
|
+
{{/client_endpoint}}
|
5
|
+
{{^client_endpoint}}
|
2
6
|
@service = {{module_name}}::Resource.new
|
7
|
+
{{/client_endpoint}}
|
3
8
|
@client = @service.client
|
4
9
|
end
|
5
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-code-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|