-
Notifications
You must be signed in to change notification settings - Fork 248
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
Failure to parse json from response for aws_sdk_quicksight::Client::list_data_sources() #1095
Comments
seems like either a parsing bug or a service side bug. We're investigating and will get this fixed |
Bug on our side. Fixed here: smithy-lang/smithy-rs#3481 It just missed the train for the new release of the code generator but it will go out in the next one or a patch. |
Thanks so much for the quick response and fix on this! |
## 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._
Edit: I see now the changes actually are in |
The fix was merged into smithy-rs, so it'll go out the next time we do a smithy-rs release, which should be pretty soon. |
Confirmed the reproduction steps were executed successfully with |
Comments on closed issues are hard for our team to see. |
Describe the bug
In aws-models/quicksight.json DataSourceParameters has the union type, but the api appears to return a structure type with nulls for the other variants. Due to this, when calling aws_sdk_quicksight::Client::list_data_sources() it errors due to AmazonElasticsearchParameters being returned as null.
Expected Behavior
Calling aws_sdk_quicksight::Client::list_data_sources() should correctly parse the returned api response and provide a single enum variant of DataSourceParameters.
Current Behavior
The api appears to return a structure type instead of a union type, so it has a null value for all possible variants, except the variant it actually is. The generated code bounces off of the first variant check which is AmazonElasticsearchParameters.
https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/quicksight/src/protocol_serde/shape_data_source_parameters.rs#L195
body of datasourceparameters from the trace logs:
stdout from test to reproduce issue
Reproduction Steps
resp will be a service error about failing to parse json.
Possible Solution
A quick fix that I validated works is to use a structure type instead of a union type in the aws-model, like boto3 does. This severely limits the usability of the type however since you can no longer match against it to determine which DataSourceParameters variant it used. It's possible this is more of a QuickSight api problem, as it returns surprising/unexpected data.
Additional Information/Context
No response
Version
The text was updated successfully, but these errors were encountered: