-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't flatten outputs to top level for InputList and InputMap (#449)
Fixes #22 InputList and InputMap are types used to make it easier to work with lists/maps where both the overall structure or individual elements can be `Input`s. The current implementation just flattens everything to a top-level input. That is `InputList<T>` is just `Input<ImmutableArray<T>>`. So if you start with a known empty list then add an unknown input element to it you end up with an unknown list structure. This is not ideal for previews (see #22) and doesn't align with the other SDKs where if you add an unknown element to a list the overall list shape is still known and sent to the engine for preview correctly. This PR fixes the above by keeping track of non-flattened data inside InputMap/List. i.e. the internal shape of `InputList<T>` is now `Input<ImmutableArray<Input<T>>>`. This allows us to take a known list and add an unknown element to it and leave the overall shape of the list still known. We do this without changing the public surface of InputList/Map, so they still inherit from `Input<ImmutableArray<T>>`. We add another field for the nested structure and ensure that we just always update both fields (the one in InputList/Map and the one in the base Input class) together. In the property serializer we then use reflection to pull out the fully nested value (e.g. `Input<ImmutableArray<Input<T>>>`) and then recursively serialize that, rather than hitting the standard `IInput` case and getting the flattened value (e.g. `Input<ImmutableArray<T>>`).
- Loading branch information
Showing
6 changed files
with
197 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
component: sdk | ||
kind: Improvements | ||
body: InputMap and InputList no longer flatten nested unknowns/secrets to apply to | ||
the whole object. | ||
time: 2025-01-29T14:14:44.986465684Z | ||
custom: | ||
PR: "449" |
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