-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generator implementation for V2 smoke tests for C2J files. #3578
Draft
AlexDaines
wants to merge
2
commits into
normj/v4-smoketests
Choose a base branch
from
feature/smoke-tests-v2-generator
base: normj/v4-smoketests
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Bug fix for cases of null errorId, small changes to align with SEP.
- Loading branch information
commit dcef01bdf41452ee37501e33f5624f9c2c4c93ea
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ namespace AWSSDK_DotNet.IntegrationTests.SmokeTestsV2 | |
} | ||
} | ||
#> | ||
public async Task <#=testCase["id"]?.ToString() ?? "Test"#>() | ||
public async Task <#=testCase["id"]#>() | ||
{ | ||
var serviceConfig = new Amazon<#=this.Config.ClassName#>Config(); | ||
<# | ||
|
@@ -126,32 +126,33 @@ namespace AWSSDK_DotNet.IntegrationTests.SmokeTestsV2 | |
var input = testCase["input"] as JsonData; | ||
if (input != null && input.IsObject) | ||
{ | ||
foreach (string key in input.PropertyNames) | ||
foreach (string jsonKey in input.PropertyNames) | ||
{ | ||
var value = input[key]; | ||
var propertyName = FindPropertyName(modeledOperation, jsonKey); | ||
var value = input[jsonKey]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: since the name is |
||
if (value != null) | ||
{ | ||
if (value.IsString) | ||
{ | ||
#> | ||
request.<#=key#> = "<#=value.ToString()#>"; | ||
request.<#=propertyName#> = "<#=value.ToString()#>"; | ||
<# | ||
} | ||
else if (value.IsInt) | ||
{ | ||
#> | ||
request.<#=key#> = (int)<#=value#>; | ||
request.<#=propertyName#> = (int)<#=value#>; | ||
<# | ||
} | ||
else if (value.IsBoolean) | ||
{ | ||
#> | ||
request.<#=key#> = <#=value.ToString().ToLower()#>; | ||
request.<#=propertyName#> = <#=value.ToString().ToLower()#>; | ||
<# | ||
} | ||
else if (value.IsArray) | ||
{ | ||
if (key == "Tags") | ||
if (propertyName == "Tags") | ||
{ | ||
#> | ||
request.Tags = new List<Tag>(); | ||
|
@@ -168,28 +169,80 @@ namespace AWSSDK_DotNet.IntegrationTests.SmokeTestsV2 | |
} | ||
else | ||
{ | ||
var arrayValues = new List<string>(); | ||
// Check if all items are strings | ||
bool allStrings = true; | ||
foreach (JsonData item in value) | ||
{ | ||
if (item != null && item.IsString) | ||
if (item != null && !item.IsString) | ||
{ | ||
arrayValues.Add($"\"{item.ToString()}\""); | ||
allStrings = false; | ||
break; | ||
} | ||
} | ||
if (arrayValues.Count > 0) | ||
|
||
if (allStrings) | ||
{ | ||
#> | ||
request.<#=key#> = new List<string> { <#=string.Join(", ", arrayValues)#> }; | ||
request.<#=propertyName#> = new List<string> | ||
{ | ||
<# | ||
} | ||
else | ||
{ | ||
#> | ||
request.<#=propertyName#> = new List<object> | ||
{ | ||
<# | ||
} | ||
var isFirst = true; | ||
foreach (JsonData item in value) | ||
{ | ||
if (item != null) | ||
{ | ||
if (!isFirst) | ||
{ | ||
#> | ||
, | ||
<# | ||
} | ||
if (item.IsString) | ||
{ | ||
#> | ||
"<#=item.ToString()#>" | ||
<# | ||
} | ||
else if (item.IsInt) | ||
{ | ||
#> | ||
<#=item.ToString()#> | ||
<# | ||
} | ||
else if (item.IsBoolean) | ||
{ | ||
#> | ||
<#=item.ToString().ToLower()#> | ||
<# | ||
} | ||
else if (item.IsDouble) | ||
{ | ||
#> | ||
<#=item.ToString()#> | ||
<# | ||
} | ||
isFirst = false; | ||
} | ||
} | ||
#> | ||
}; | ||
<# | ||
} | ||
} | ||
else if (value.IsObject) | ||
{ | ||
if (key == "Includes") | ||
if (propertyName == "Includes") | ||
{ | ||
#> | ||
request.<#=key#> = new Filters | ||
request.<#=propertyName#> = new Filters | ||
{ | ||
<# | ||
var keyTypes = value["keyTypes"] as JsonData; | ||
|
@@ -236,7 +289,14 @@ namespace AWSSDK_DotNet.IntegrationTests.SmokeTestsV2 | |
} | ||
catch (Amazon<#=this.Config.ClassName#>Exception ex) | ||
{ | ||
<# | ||
if (!string.IsNullOrEmpty(errorId)) | ||
{ | ||
#> | ||
Assert.AreEqual("<#=errorId#>", ex.ErrorCode); | ||
AlexDaines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<# | ||
} | ||
#> | ||
} | ||
<# | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason we need to check
input.IsObject
? if input != null, then we are guaranteed to be given a json object wityh the input so I think we can remove theIsObject
check.