-
Notifications
You must be signed in to change notification settings - Fork 218
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
Protocol test for : null
values in unions
#2180
Conversation
Servers are allowed (but not recommmended) to send `"key": null` for unset fields in unions. However, this behavior was not covered by protocol tests. These tests were dry-run on the Rust SDK.
@@ -43,6 +43,7 @@ union MyUnion { | |||
listValue: StringList, | |||
mapValue: StringMap, | |||
structureValue: GreetingStruct, | |||
unitValue: Unit, |
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.
Can the Unit
target entry be separated out to its own test operation and case?
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.
removed—I thought it was just an oversight that it was missing. Turns out this actually causes compilation failure in the Rust server codegen: smithy-lang/smithy-rs#2546
So we should definitely get a test with this at some point but it will probably break a few folks
## Motivation and Context - awslabs/aws-sdk-rust#1095 ## Description Update the JSON parser generator to allow for `null` to be set in unions. Servers can send unions like this: ```json { "AmazonElasticsearchParameters": null, "AmazonOpenSearchParameters": null, "AppFlowParameters": null, "AthenaParameters": null, "AuroraParameters": null, "AuroraPostgreSqlParameters": null, "AwsIotAnalyticsParameters": null, "BigQueryParameters": null, "DatabricksParameters": null, "Db2Parameters": null, "DenodoParameters": null, "DocumentDBParameters": null, "DremioParameters": null, "ExasolParameters": null, "GoogleAnalyticsParameters": null, "JiraParameters": null, "MariaDbParameters": null, "MongoAtlasParameters": null, "MongoDBParameters": null, "MySqlParameters": null, "OracleParameters": null, "PostgreSqlParameters": null, "PrestoParameters": null, "RdsParameters": null, "RedshiftParameters": null, "S3Parameters": { "IsUploaded": false, "ManifestFileLocation": { "Bucket": "deided-bucket.prod.us-east-1", "Key": "sales/manifest.json" }, "RoleArn": null }, "SalesforceParameters": null, "SapHanaParameters": null, "ServiceNowParameters": null, "SnowflakeParameters": null, "SparkParameters": null, "SqlServerParameters": null, "StarburstParameters": null, "TeradataParameters": null, "TrinoParameters": null, "TwitterParameters": null } ``` This caused our parser to fail. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> - [x] New unit test - [x] Dry run against new [smithy protocol test](smithy-lang/smithy#2180) ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Background
Servers are allowed (but not recommended) to send
"key": null
for unset fields in unions. However, this behavior was not covered by protocol tests.Testing
These tests were dry-run on the Rust SDK.
Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.