Commit 60fc9a5
authored
Supported nested union fields (#689)
Issue #, if available:
Description of changes:
This PR adds support for nested union types to the code-generator. Prior to this change if a `union` shape contained a member that was itself a `union` the code-generator would produce non-compiling code in two ways:
1. When setting the values from the API response the generated code would not use a type switch for the nested union member and attempt directly access fields as if they were a `structure`.
2. When setting the SDK payload the generated code would attempt to dereference the union member.
To address this this PR applies two fixes.
1. In `setResourceForUnion` check if the member is a union and force `Shape.Type` to `union` before recursing
2. In `setSDKForUnion` prevent dereference of member value if member is a union itself.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent a9e2cea commit 60fc9a5
6 files changed
Lines changed: 23163 additions & 1 deletion
File tree
- pkg
- generate/code
- testdata
- codegen/sdk-codegen/aws-models
- models/apis/bedrock-agentcore-control/0000-00-00
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2473 | 2473 | | |
2474 | 2474 | | |
2475 | 2475 | | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
2476 | 2479 | | |
2477 | 2480 | | |
2478 | 2481 | | |
| |||
2561 | 2564 | | |
2562 | 2565 | | |
2563 | 2566 | | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
2564 | 2570 | | |
2565 | 2571 | | |
2566 | 2572 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5524 | 5524 | | |
5525 | 5525 | | |
5526 | 5526 | | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
| 5550 | + | |
| 5551 | + | |
| 5552 | + | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
| 5561 | + | |
| 5562 | + | |
| 5563 | + | |
| 5564 | + | |
| 5565 | + | |
| 5566 | + | |
| 5567 | + | |
| 5568 | + | |
| 5569 | + | |
| 5570 | + | |
| 5571 | + | |
| 5572 | + | |
| 5573 | + | |
| 5574 | + | |
| 5575 | + | |
| 5576 | + | |
| 5577 | + | |
| 5578 | + | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1937 | 1937 | | |
1938 | 1938 | | |
1939 | 1939 | | |
1940 | | - | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
1941 | 1945 | | |
1942 | 1946 | | |
1943 | 1947 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6708 | 6708 | | |
6709 | 6709 | | |
6710 | 6710 | | |
| 6711 | + | |
| 6712 | + | |
| 6713 | + | |
| 6714 | + | |
| 6715 | + | |
| 6716 | + | |
| 6717 | + | |
| 6718 | + | |
| 6719 | + | |
| 6720 | + | |
| 6721 | + | |
| 6722 | + | |
| 6723 | + | |
| 6724 | + | |
| 6725 | + | |
| 6726 | + | |
| 6727 | + | |
| 6728 | + | |
| 6729 | + | |
| 6730 | + | |
| 6731 | + | |
| 6732 | + | |
| 6733 | + | |
| 6734 | + | |
| 6735 | + | |
| 6736 | + | |
| 6737 | + | |
| 6738 | + | |
| 6739 | + | |
| 6740 | + | |
| 6741 | + | |
| 6742 | + | |
| 6743 | + | |
| 6744 | + | |
| 6745 | + | |
| 6746 | + | |
| 6747 | + | |
| 6748 | + | |
| 6749 | + | |
| 6750 | + | |
| 6751 | + | |
| 6752 | + | |
| 6753 | + | |
| 6754 | + | |
| 6755 | + | |
| 6756 | + | |
| 6757 | + | |
| 6758 | + | |
| 6759 | + | |
| 6760 | + | |
| 6761 | + | |
| 6762 | + | |
| 6763 | + | |
| 6764 | + | |
| 6765 | + | |
| 6766 | + | |
| 6767 | + | |
| 6768 | + | |
| 6769 | + | |
| 6770 | + | |
| 6771 | + | |
0 commit comments