-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(python): correctly handle nested structs-as-dict (#973)
* fix(python): correctly handle nested structs-as-dict Added code to up-cast from `dict` to the relevant struct type in the generated python code whenever the value type is some unambiguous struct. Whenever a UNION of types is involved, the user must construct the struct type themselves, as the runtime would then have no way to choose which type should be used on it's own without additional information. * add None explicit test
- Loading branch information
1 parent
26aa77c
commit 9fd2499
Showing
20 changed files
with
947 additions
and
4 deletions.
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
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
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
21 changes: 21 additions & 0 deletions
21
...zon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/INestedStruct.cs
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
/// <remarks> | ||
/// stability: Experimental | ||
/// </remarks> | ||
[JsiiInterface(nativeType: typeof(INestedStruct), fullyQualifiedName: "jsii-calc.NestedStruct")] | ||
public interface INestedStruct | ||
{ | ||
/// <summary>When provided, must be > 0.</summary> | ||
/// <remarks> | ||
/// stability: Experimental | ||
/// </remarks> | ||
[JsiiProperty(name: "numberProp", typeJson: "{\"primitive\":\"number\"}")] | ||
double NumberProp | ||
{ | ||
get; | ||
} | ||
} | ||
} |
Oops, something went wrong.