-
Notifications
You must be signed in to change notification settings - Fork 261
feat(kernel): Normalize empty structs to undefined #416
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
...n.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IOptionalStruct.cs
This file contains hidden or 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,14 @@ | ||
| using Amazon.JSII.Runtime.Deputy; | ||
|
|
||
| namespace Amazon.JSII.Tests.CalculatorNamespace | ||
| { | ||
| [JsiiInterface(typeof(IOptionalStruct), "jsii-calc.OptionalStruct")] | ||
| public interface IOptionalStruct | ||
| { | ||
| [JsiiProperty("field", "{\"primitive\":\"string\",\"optional\":true}")] | ||
| string Field | ||
| { | ||
| get; | ||
| } | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
...on.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStruct.cs
This file contains hidden or 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,15 @@ | ||
| using Amazon.JSII.Runtime.Deputy; | ||
|
|
||
| namespace Amazon.JSII.Tests.CalculatorNamespace | ||
| { | ||
| [JsiiByValue] | ||
| public class OptionalStruct : IOptionalStruct | ||
| { | ||
| [JsiiProperty("field", "{\"primitive\":\"string\",\"optional\":true}", true)] | ||
| public string Field | ||
| { | ||
| get; | ||
| set; | ||
| } | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
...Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructConsumer.cs
This file contains hidden or 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,32 @@ | ||
| using Amazon.JSII.Runtime.Deputy; | ||
|
|
||
| namespace Amazon.JSII.Tests.CalculatorNamespace | ||
| { | ||
| [JsiiClass(typeof(OptionalStructConsumer), "jsii-calc.OptionalStructConsumer", "[{\"name\":\"optionalStruct\",\"type\":{\"fqn\":\"jsii-calc.OptionalStruct\",\"optional\":true}}]")] | ||
| public class OptionalStructConsumer : DeputyBase | ||
| { | ||
| public OptionalStructConsumer(IOptionalStruct optionalStruct): base(new DeputyProps(new object[]{optionalStruct})) | ||
| { | ||
| } | ||
|
|
||
| protected OptionalStructConsumer(ByRefValue reference): base(reference) | ||
| { | ||
| } | ||
|
|
||
| protected OptionalStructConsumer(DeputyProps props): base(props) | ||
| { | ||
| } | ||
|
|
||
| [JsiiProperty("parameterWasUndefined", "{\"primitive\":\"boolean\"}")] | ||
| public virtual bool ParameterWasUndefined | ||
| { | ||
| get => GetInstanceProperty<bool>(); | ||
| } | ||
|
|
||
| [JsiiProperty("fieldValue", "{\"primitive\":\"string\",\"optional\":true}")] | ||
| public virtual string FieldValue | ||
| { | ||
| get => GetInstanceProperty<string>(); | ||
| } | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
...II.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/OptionalStructProxy.cs
This file contains hidden or 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,18 @@ | ||
| using Amazon.JSII.Runtime.Deputy; | ||
|
|
||
| namespace Amazon.JSII.Tests.CalculatorNamespace | ||
| { | ||
| [JsiiTypeProxy(typeof(IOptionalStruct), "jsii-calc.OptionalStruct")] | ||
| internal sealed class OptionalStructProxy : DeputyBase, IOptionalStruct | ||
| { | ||
| private OptionalStructProxy(ByRefValue reference): base(reference) | ||
| { | ||
| } | ||
|
|
||
| [JsiiProperty("field", "{\"primitive\":\"string\",\"optional\":true}")] | ||
| public string Field | ||
| { | ||
| get => GetInstanceProperty<string>(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
71 changes: 71 additions & 0 deletions
71
...ed.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/OptionalStruct.java
This file contains hidden or 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,71 @@ | ||
| package software.amazon.jsii.tests.calculator; | ||
|
|
||
| @javax.annotation.Generated(value = "jsii-pacmak") | ||
| public interface OptionalStruct extends software.amazon.jsii.JsiiSerializable { | ||
| java.lang.String getField(); | ||
|
|
||
| /** | ||
| * @return a {@link Builder} of {@link OptionalStruct} | ||
| */ | ||
| static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| /** | ||
| * A builder for {@link OptionalStruct} | ||
| */ | ||
| final class Builder { | ||
| @javax.annotation.Nullable | ||
| private java.lang.String _field; | ||
|
|
||
| /** | ||
| * Sets the value of Field | ||
| * @param value the value to be set | ||
| * @return {@code this} | ||
| */ | ||
| public Builder withField(@javax.annotation.Nullable final java.lang.String value) { | ||
| this._field = value; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Builds the configured instance. | ||
| * @return a new instance of {@link OptionalStruct} | ||
| * @throws NullPointerException if any required attribute was not provided | ||
| */ | ||
| public OptionalStruct build() { | ||
| return new OptionalStruct() { | ||
| @javax.annotation.Nullable | ||
| private final java.lang.String $field = _field; | ||
|
|
||
| @Override | ||
| public java.lang.String getField() { | ||
| return this.$field; | ||
| } | ||
|
|
||
| public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { | ||
| com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; | ||
| com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); | ||
| obj.set("field", om.valueToTree(this.getField())); | ||
| return obj; | ||
| } | ||
|
|
||
| }; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * A proxy class which represents a concrete javascript instance of this type. | ||
| */ | ||
| final static class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements software.amazon.jsii.tests.calculator.OptionalStruct { | ||
| protected Jsii$Proxy(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
| super(mode); | ||
| } | ||
|
|
||
| @Override | ||
| @javax.annotation.Nullable | ||
| public java.lang.String getField() { | ||
| return this.jsiiGet("field", java.lang.String.class); | ||
| } | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
...calc/java/src/main/java/software/amazon/jsii/tests/calculator/OptionalStructConsumer.java
This file contains hidden or 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,26 @@ | ||
| package software.amazon.jsii.tests.calculator; | ||
|
|
||
| @javax.annotation.Generated(value = "jsii-pacmak") | ||
| @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.OptionalStructConsumer") | ||
| public class OptionalStructConsumer extends software.amazon.jsii.JsiiObject { | ||
| protected OptionalStructConsumer(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
| super(mode); | ||
| } | ||
| public OptionalStructConsumer(@javax.annotation.Nullable final software.amazon.jsii.tests.calculator.OptionalStruct optionalStruct) { | ||
| super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
| software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, java.util.stream.Stream.of(optionalStruct).toArray()); | ||
| } | ||
| public OptionalStructConsumer() { | ||
| super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
| software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); | ||
| } | ||
|
|
||
| public java.lang.Boolean getParameterWasUndefined() { | ||
| return this.jsiiGet("parameterWasUndefined", java.lang.Boolean.class); | ||
| } | ||
|
|
||
| @javax.annotation.Nullable | ||
| public java.lang.String getFieldValue() { | ||
| return this.jsiiGet("fieldValue", java.lang.String.class); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.