From 63132cf30ad62ba59d2a8cdfaba60b92819352cd Mon Sep 17 00:00:00 2001 From: Aatman Date: Tue, 28 Dec 2021 00:46:56 +0530 Subject: [PATCH] feat(pacmak): go yaml struct tags (#3299) closes #3293 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --- .../lib/targets/go/types/type-member.ts | 6 +- .../__snapshots__/examples.test.ts.snap | 14 +- .../__snapshots__/target-go.test.ts.snap | 232 +++++++++--------- 3 files changed, 127 insertions(+), 125 deletions(-) diff --git a/packages/jsii-pacmak/lib/targets/go/types/type-member.ts b/packages/jsii-pacmak/lib/targets/go/types/type-member.ts index 843b73fd54..78c61dc69b 100644 --- a/packages/jsii-pacmak/lib/targets/go/types/type-member.ts +++ b/packages/jsii-pacmak/lib/targets/go/types/type-member.ts @@ -76,8 +76,10 @@ export class GoProperty implements GoTypeMember { ? `*${this.returnType}` : this.returnType; - // Adds json tags for easy deserialization - code.line(`${this.name} ${memberType} \`json:"${this.property.name}"\``); + // Adds json and yaml tags for easy deserialization + code.line( + `${this.name} ${memberType} \`json:"${this.property.name}" yaml:"${this.property.name}"\``, + ); // TODO add newline if not the last member } diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap index ebf8d2a3d9..24cd0361f9 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/examples.test.ts.snap @@ -421,9 +421,9 @@ import ( ) type Baz struct { - Foo *float64 \`json:"foo"\` - Bar *string \`json:"bar"\` - Baz *bool \`json:"baz"\` + Foo *float64 \`json:"foo" yaml:"foo"\` + Bar *string \`json:"bar" yaml:"bar"\` + Baz *bool \`json:"baz" yaml:"baz"\` } type Consumer interface { @@ -445,12 +445,12 @@ func Consumer_ConsumeBaz(baz *Baz) { } type Foo struct { - Foo *float64 \`json:"foo"\` + Foo *float64 \`json:"foo" yaml:"foo"\` } type FooBar struct { - Foo *float64 \`json:"foo"\` - Bar *string \`json:"bar"\` + Foo *float64 \`json:"foo" yaml:"foo"\` + Bar *string \`json:"bar" yaml:"bar"\` } @@ -1796,7 +1796,7 @@ func (n *jsiiProxy_Namespace1) Foo() { } type Namespace1_Foo struct { - Bar *string \`json:"bar"\` + Bar *string \`json:"bar" yaml:"bar"\` } type Namespace1_IBar interface { diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap index 86f1d64f4e..8a5013518a 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap @@ -296,8 +296,8 @@ func (b *jsiiProxy_Base) TypeName() interface{} { } type BaseProps struct { - Foo scopejsiicalcbaseofbase.Very \`json:"foo"\` - Bar *string \`json:"bar"\` + Foo scopejsiicalcbaseofbase.Very \`json:"foo" yaml:"foo"\` + Bar *string \`json:"bar" yaml:"bar"\` } type IBaseInterface interface { @@ -820,7 +820,7 @@ func (v *jsiiProxy_Very) Hey() *float64 { } type VeryBaseProps struct { - Foo Very \`json:"foo"\` + Foo Very \`json:"foo" yaml:"foo"\` } @@ -1201,15 +1201,15 @@ func NewNestingClass_NestedClass_Override(n NestingClass_NestedClass) { // Deprecated. type NestingClass_NestedStruct struct { // Deprecated. - Name *string \`json:"name"\` + Name *string \`json:"name" yaml:"name"\` } // Deprecated. type ReflectableEntry struct { // Deprecated. - Key *string \`json:"key"\` + Key *string \`json:"key" yaml:"key"\` // Deprecated. - Value interface{} \`json:"value"\` + Value interface{} \`json:"value" yaml:"value"\` } // Deprecated. @@ -1450,17 +1450,17 @@ func (b *jsiiProxy_BaseFor2647) Foo(obj jcb.IBaseInterface) { // Deprecated. type DiamondLeft struct { // Deprecated. - HoistedTop *string \`json:"hoistedTop"\` + HoistedTop *string \`json:"hoistedTop" yaml:"hoistedTop"\` // Deprecated. - Left *float64 \`json:"left"\` + Left *float64 \`json:"left" yaml:"left"\` } // Deprecated. type DiamondRight struct { // Deprecated. - HoistedTop *string \`json:"hoistedTop"\` + HoistedTop *string \`json:"hoistedTop" yaml:"hoistedTop"\` // Deprecated. - Right *bool \`json:"right"\` + Right *bool \`json:"right" yaml:"right"\` } // Check that enums from \\@scoped packages can be references. @@ -1554,12 +1554,12 @@ func (i *jsiiProxy_IThreeLevelsInterface) Baz() { type MyFirstStruct struct { // An awesome number value. // Deprecated. - Anumber *float64 \`json:"anumber"\` + Anumber *float64 \`json:"anumber" yaml:"anumber"\` // A string value. // Deprecated. - Astring *string \`json:"astring"\` + Astring *string \`json:"astring" yaml:"astring"\` // Deprecated. - FirstOptional *[]*string \`json:"firstOptional"\` + FirstOptional *[]*string \`json:"firstOptional" yaml:"firstOptional"\` } // Represents a concrete number. @@ -1795,11 +1795,11 @@ func (o *jsiiProxy_Operation) TypeName() interface{} { type StructWithOnlyOptionals struct { // The first optional! // Deprecated. - Optional1 *string \`json:"optional1"\` + Optional1 *string \`json:"optional1" yaml:"optional1"\` // Deprecated. - Optional2 *float64 \`json:"optional2"\` + Optional2 *float64 \`json:"optional2" yaml:"optional2"\` // Deprecated. - Optional3 *bool \`json:"optional3"\` + Optional3 *bool \`json:"optional3" yaml:"optional3"\` } @@ -2921,7 +2921,7 @@ func (j *jsiiProxy_Foo) SetBar(val *string) { } type Hello struct { - Foo *float64 \`json:"foo"\` + Foo *float64 \`json:"foo" yaml:"foo"\` } @@ -2960,7 +2960,7 @@ package interfaceinnamespaceonlyinterface type Hello struct { - Foo *float64 \`json:"foo"\` + Foo *float64 \`json:"foo" yaml:"foo"\` } @@ -4777,14 +4777,14 @@ type CalculatorProps struct { // The initial value of the calculator. // // NOTE: Any number works here, it's fine. - InitialValue *float64 \`json:"initialValue"\` + InitialValue *float64 \`json:"initialValue" yaml:"initialValue"\` // The maximum value the calculator can store. - MaximumValue *float64 \`json:"maximumValue"\` + MaximumValue *float64 \`json:"maximumValue" yaml:"maximumValue"\` } type ChildStruct982 struct { - Foo *string \`json:"foo"\` - Bar *float64 \`json:"bar"\` + Foo *string \`json:"foo" yaml:"foo"\` + Bar *float64 \`json:"bar" yaml:"bar"\` } type ClassThatImplementsTheInternalInterface interface { @@ -5506,7 +5506,7 @@ func ConfusingToJackson_MakeStructInstance() *ConfusingToJacksonStruct { } type ConfusingToJacksonStruct struct { - UnionProperty interface{} \`json:"unionProperty"\` + UnionProperty interface{} \`json:"unionProperty" yaml:"unionProperty"\` } type ConstructorPassesThisOut interface { @@ -5961,9 +5961,9 @@ func (c *jsiiProxy_ConsumersOfThisCrazyTypeSystem) ConsumeNonInternalInterface(o } type ContainerProps struct { - ArrayProp *[]*DummyObj \`json:"arrayProp"\` - ObjProp *map[string]*DummyObj \`json:"objProp"\` - RecordProp *map[string]*DummyObj \`json:"recordProp"\` + ArrayProp *[]*DummyObj \`json:"arrayProp" yaml:"arrayProp"\` + ObjProp *map[string]*DummyObj \`json:"objProp" yaml:"objProp"\` + RecordProp *map[string]*DummyObj \`json:"recordProp" yaml:"recordProp"\` } // Verifies proper type handling through dynamic overrides. @@ -6307,58 +6307,58 @@ const ( // Deprecated: it just wraps a string type DeprecatedStruct struct { // Deprecated: well, yeah - ReadonlyProperty *string \`json:"readonlyProperty"\` + ReadonlyProperty *string \`json:"readonlyProperty" yaml:"readonlyProperty"\` } // A struct which derives from another struct. type DerivedStruct struct { // An awesome number value. // Deprecated. - Anumber *float64 \`json:"anumber"\` + Anumber *float64 \`json:"anumber" yaml:"anumber"\` // A string value. // Deprecated. - Astring *string \`json:"astring"\` + Astring *string \`json:"astring" yaml:"astring"\` // Deprecated. - FirstOptional *[]*string \`json:"firstOptional"\` - AnotherRequired *time.Time \`json:"anotherRequired"\` - Bool *bool \`json:"bool"\` + FirstOptional *[]*string \`json:"firstOptional" yaml:"firstOptional"\` + AnotherRequired *time.Time \`json:"anotherRequired" yaml:"anotherRequired"\` + Bool *bool \`json:"bool" yaml:"bool"\` // An example of a non primitive property. - NonPrimitive DoubleTrouble \`json:"nonPrimitive"\` + NonPrimitive DoubleTrouble \`json:"nonPrimitive" yaml:"nonPrimitive"\` // This is optional. - AnotherOptional *map[string]scopejsiicalclib.NumericValue \`json:"anotherOptional"\` - OptionalAny interface{} \`json:"optionalAny"\` - OptionalArray *[]*string \`json:"optionalArray"\` + AnotherOptional *map[string]scopejsiicalclib.NumericValue \`json:"anotherOptional" yaml:"anotherOptional"\` + OptionalAny interface{} \`json:"optionalAny" yaml:"optionalAny"\` + OptionalArray *[]*string \`json:"optionalArray" yaml:"optionalArray"\` } type DiamondBottom struct { // Deprecated. - HoistedTop *string \`json:"hoistedTop"\` + HoistedTop *string \`json:"hoistedTop" yaml:"hoistedTop"\` // Deprecated. - Left *float64 \`json:"left"\` + Left *float64 \`json:"left" yaml:"left"\` // Deprecated. - Right *bool \`json:"right"\` - Bottom *time.Time \`json:"bottom"\` + Right *bool \`json:"right" yaml:"right"\` + Bottom *time.Time \`json:"bottom" yaml:"bottom"\` } type DiamondInheritanceBaseLevelStruct struct { - BaseLevelProperty *string \`json:"baseLevelProperty"\` + BaseLevelProperty *string \`json:"baseLevelProperty" yaml:"baseLevelProperty"\` } type DiamondInheritanceFirstMidLevelStruct struct { - BaseLevelProperty *string \`json:"baseLevelProperty"\` - FirstMidLevelProperty *string \`json:"firstMidLevelProperty"\` + BaseLevelProperty *string \`json:"baseLevelProperty" yaml:"baseLevelProperty"\` + FirstMidLevelProperty *string \`json:"firstMidLevelProperty" yaml:"firstMidLevelProperty"\` } type DiamondInheritanceSecondMidLevelStruct struct { - BaseLevelProperty *string \`json:"baseLevelProperty"\` - SecondMidLevelProperty *string \`json:"secondMidLevelProperty"\` + BaseLevelProperty *string \`json:"baseLevelProperty" yaml:"baseLevelProperty"\` + SecondMidLevelProperty *string \`json:"secondMidLevelProperty" yaml:"secondMidLevelProperty"\` } type DiamondInheritanceTopLevelStruct struct { - BaseLevelProperty *string \`json:"baseLevelProperty"\` - FirstMidLevelProperty *string \`json:"firstMidLevelProperty"\` - SecondMidLevelProperty *string \`json:"secondMidLevelProperty"\` - TopLevelProperty *string \`json:"topLevelProperty"\` + BaseLevelProperty *string \`json:"baseLevelProperty" yaml:"baseLevelProperty"\` + FirstMidLevelProperty *string \`json:"firstMidLevelProperty" yaml:"firstMidLevelProperty"\` + SecondMidLevelProperty *string \`json:"secondMidLevelProperty" yaml:"secondMidLevelProperty"\` + TopLevelProperty *string \`json:"topLevelProperty" yaml:"topLevelProperty"\` } // Verifies that null/undefined can be returned for optional collections. @@ -6692,7 +6692,7 @@ func (d *jsiiProxy_DoubleTrouble) Next() *float64 { } type DummyObj struct { - Example *string \`json:"example"\` + Example *string \`json:"example" yaml:"example"\` } // Ensures we can override a dynamic property that was inherited. @@ -7047,8 +7047,8 @@ func EraseUndefinedHashValues_Prop2IsUndefined() *map[string]interface{} { } type EraseUndefinedHashValuesOptions struct { - Option1 *string \`json:"option1"\` - Option2 *string \`json:"option2"\` + Option1 *string \`json:"option1" yaml:"option1"\` + Option2 *string \`json:"option2" yaml:"option2"\` } // Experimental. @@ -7139,7 +7139,7 @@ const ( // Experimental. type ExperimentalStruct struct { // Experimental. - ReadonlyProperty *string \`json:"readonlyProperty"\` + ReadonlyProperty *string \`json:"readonlyProperty" yaml:"readonlyProperty"\` } type ExportedBaseClass interface { @@ -7187,8 +7187,8 @@ func NewExportedBaseClass_Override(e ExportedBaseClass, success *bool) { } type ExtendsInternalInterface struct { - Boom *bool \`json:"boom"\` - Prop *string \`json:"prop"\` + Boom *bool \`json:"boom" yaml:"boom"\` + Prop *string \`json:"prop" yaml:"prop"\` } type ExternalClass interface { @@ -7272,7 +7272,7 @@ const ( ) type ExternalStruct struct { - ReadonlyProperty *string \`json:"readonlyProperty"\` + ReadonlyProperty *string \`json:"readonlyProperty" yaml:"readonlyProperty"\` } type GiveMeStructs interface { @@ -7367,7 +7367,7 @@ func (g *jsiiProxy_GiveMeStructs) ReadFirstNumber(first *scopejsiicalclib.MyFirs // These are some arguments you can pass to a method. type Greetee struct { // The name of the greetee. - Name *string \`json:"name"\` + Name *string \`json:"name" yaml:"name"\` } type GreetingAugmenter interface { @@ -8670,9 +8670,9 @@ func (j *jsiiProxy_ImplementsPrivateInterface) SetPrivate(val *string) { } type ImplictBaseOfBase struct { - Foo scopejsiicalcbaseofbase.Very \`json:"foo"\` - Bar *string \`json:"bar"\` - Goo *time.Time \`json:"goo"\` + Foo scopejsiicalcbaseofbase.Very \`json:"foo" yaml:"foo"\` + Bar *string \`json:"bar" yaml:"bar"\` + Goo *time.Time \`json:"goo" yaml:"goo"\` } type InbetweenClass interface { @@ -10182,15 +10182,15 @@ func NewLevelOne_Override(l LevelOne, props *LevelOneProps) { } type LevelOne_PropBooleanValue struct { - Value *bool \`json:"value"\` + Value *bool \`json:"value" yaml:"value"\` } type LevelOne_PropProperty struct { - Prop *LevelOne_PropBooleanValue \`json:"prop"\` + Prop *LevelOne_PropBooleanValue \`json:"prop" yaml:"prop"\` } type LevelOneProps struct { - Prop *LevelOne_PropProperty \`json:"prop"\` + Prop *LevelOne_PropProperty \`json:"prop" yaml:"prop"\` } // jsii#298: show default values in sphinx documentation, and respect newlines. @@ -10198,7 +10198,7 @@ type LoadBalancedFargateServiceProps struct { // The container port of the application load balancer attached to your Fargate service. // // Corresponds to container port mapping. - ContainerPort *float64 \`json:"containerPort"\` + ContainerPort *float64 \`json:"containerPort" yaml:"containerPort"\` // The number of cpu units used by the task. // // Valid values, which determines your range of valid values for the memory parameter: @@ -10209,7 +10209,7 @@ type LoadBalancedFargateServiceProps struct { // 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments // // This default is set in the underlying FargateTaskDefinition construct. - Cpu *string \`json:"cpu"\` + Cpu *string \`json:"cpu" yaml:"cpu"\` // The amount (in MiB) of memory used by the task. // // This field is required and you must use one of the following values, which determines your range of valid values @@ -10226,11 +10226,11 @@ type LoadBalancedFargateServiceProps struct { // Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) // // This default is set in the underlying FargateTaskDefinition construct. - MemoryMiB *string \`json:"memoryMiB"\` + MemoryMiB *string \`json:"memoryMiB" yaml:"memoryMiB"\` // Determines whether the Application Load Balancer will be internet-facing. - PublicLoadBalancer *bool \`json:"publicLoadBalancer"\` + PublicLoadBalancer *bool \`json:"publicLoadBalancer" yaml:"publicLoadBalancer"\` // Determines whether your Fargate Service will be assigned a public IP address. - PublicTasks *bool \`json:"publicTasks"\` + PublicTasks *bool \`json:"publicTasks" yaml:"publicTasks"\` } type MethodNamedProperty interface { @@ -10614,7 +10614,7 @@ func NestedClassInstance_MakeInstance() customsubmodulename.NestingClass_NestedC type NestedStruct struct { // When provided, must be > 0. - NumberProp *float64 \`json:"numberProp"\` + NumberProp *float64 \`json:"numberProp" yaml:"numberProp"\` } // Test fixture to verify that jsii modules can use the node standard library. @@ -10795,8 +10795,8 @@ func (n *jsiiProxy_NullShouldBeTreatedAsUndefined) VerifyPropertyIsUndefined() { } type NullShouldBeTreatedAsUndefinedData struct { - ArrayWithThreeElementsAndUndefinedAsSecondArgument *[]interface{} \`json:"arrayWithThreeElementsAndUndefinedAsSecondArgument"\` - ThisShouldBeUndefined interface{} \`json:"thisShouldBeUndefined"\` + ArrayWithThreeElementsAndUndefinedAsSecondArgument *[]interface{} \`json:"arrayWithThreeElementsAndUndefinedAsSecondArgument" yaml:"arrayWithThreeElementsAndUndefinedAsSecondArgument"\` + ThisShouldBeUndefined interface{} \`json:"thisShouldBeUndefined" yaml:"thisShouldBeUndefined"\` } // This allows us to test that a reference can be stored for objects that implement interfaces. @@ -11135,7 +11135,7 @@ func NewOptionalConstructorArgument_Override(o OptionalConstructorArgument, arg1 } type OptionalStruct struct { - Field *string \`json:"field"\` + Field *string \`json:"field" yaml:"field"\` } type OptionalStructConsumer interface { @@ -11344,7 +11344,7 @@ func (o *jsiiProxy_OverrideReturnsObject) Test(obj IReturnsNumber) *float64 { // https://github.com/aws/jsii/issues/982. type ParentStruct982 struct { - Foo *string \`json:"foo"\` + Foo *string \`json:"foo" yaml:"foo"\` } type PartiallyInitializedThisConsumer interface { @@ -12145,8 +12145,8 @@ func NewReturnsPrivateImplementationOfInterface_Override(r ReturnsPrivateImpleme // idiomatic" way for Pythonists. type RootStruct struct { // May not be empty. - StringProp *string \`json:"stringProp"\` - NestedStruct *NestedStruct \`json:"nestedStruct"\` + StringProp *string \`json:"stringProp" yaml:"stringProp"\` + NestedStruct *NestedStruct \`json:"nestedStruct" yaml:"nestedStruct"\` } type RootStructValidator interface { @@ -12229,9 +12229,9 @@ func (r *jsiiProxy_RuntimeTypeChecking) MethodWithOptionalArguments(arg1 *float6 type SecondLevelStruct struct { // It's long and required. - DeeperRequiredProp *string \`json:"deeperRequiredProp"\` + DeeperRequiredProp *string \`json:"deeperRequiredProp" yaml:"deeperRequiredProp"\` // It's long, but you'll almost never pass it. - DeeperOptionalProp *string \`json:"deeperOptionalProp"\` + DeeperOptionalProp *string \`json:"deeperOptionalProp" yaml:"deeperOptionalProp"\` } // Test that a single instance can be returned under two different FQNs. @@ -12364,8 +12364,8 @@ const ( ) type SmellyStruct struct { - Property *string \`json:"property"\` - YetAnoterOne *bool \`json:"yetAnoterOne"\` + Property *string \`json:"property" yaml:"property"\` + YetAnoterOne *bool \`json:"yetAnoterOne" yaml:"yetAnoterOne"\` } type SomeTypeJsii976 interface { @@ -12511,7 +12511,7 @@ const ( ) type StableStruct struct { - ReadonlyProperty *string \`json:"readonlyProperty"\` + ReadonlyProperty *string \`json:"readonlyProperty" yaml:"readonlyProperty"\` } // This is used to validate the ability to use \`this\` from within a static context. @@ -12869,24 +12869,24 @@ func (j *jsiiProxy_StripInternal) SetYouSeeMe(val *string) { // We can serialize and deserialize structs without silently ignoring optional fields. type StructA struct { - RequiredString *string \`json:"requiredString"\` - OptionalNumber *float64 \`json:"optionalNumber"\` - OptionalString *string \`json:"optionalString"\` + RequiredString *string \`json:"requiredString" yaml:"requiredString"\` + OptionalNumber *float64 \`json:"optionalNumber" yaml:"optionalNumber"\` + OptionalString *string \`json:"optionalString" yaml:"optionalString"\` } // This intentionally overlaps with StructA (where only requiredString is provided) to test htat the kernel properly disambiguates those. type StructB struct { - RequiredString *string \`json:"requiredString"\` - OptionalBoolean *bool \`json:"optionalBoolean"\` - OptionalStructA *StructA \`json:"optionalStructA"\` + RequiredString *string \`json:"requiredString" yaml:"requiredString"\` + OptionalBoolean *bool \`json:"optionalBoolean" yaml:"optionalBoolean"\` + OptionalStructA *StructA \`json:"optionalStructA" yaml:"optionalStructA"\` } // Verifies that, in languages that do keyword lifting (e.g: Python), having a struct member with the same name as a positional parameter results in the correct code being emitted. // // See: https://github.com/aws/aws-cdk/issues/4302 type StructParameterType struct { - Scope *string \`json:"scope"\` - Props *bool \`json:"props"\` + Scope *string \`json:"scope" yaml:"scope"\` + Props *bool \`json:"props" yaml:"props"\` } // Just because we can. @@ -12997,16 +12997,16 @@ func StructUnionConsumer_IsStructB(struct_ interface{}) *bool { type StructWithEnum struct { // An enum value. - Foo StringEnum \`json:"foo"\` + Foo StringEnum \`json:"foo" yaml:"foo"\` // Optional enum value (of type integer). - Bar AllTypesEnum \`json:"bar"\` + Bar AllTypesEnum \`json:"bar" yaml:"bar"\` } type StructWithJavaReservedWords struct { - Default *string \`json:"default"\` - Assert *string \`json:"assert"\` - Result *string \`json:"result"\` - That *string \`json:"that"\` + Default *string \`json:"default" yaml:"default"\` + Assert *string \`json:"assert" yaml:"assert"\` + Result *string \`json:"result" yaml:"result"\` + That *string \`json:"that" yaml:"that"\` } // An operation that sums multiple values. @@ -13266,11 +13266,11 @@ func NewSupportsNiceJavaBuilder_Override(s SupportsNiceJavaBuilder, id *float64, type SupportsNiceJavaBuilderProps struct { // Some number, like 42. - Bar *float64 \`json:"bar"\` + Bar *float64 \`json:"bar" yaml:"bar"\` // An \`id\` field here is terrible API design, because the constructor of \`SupportsNiceJavaBuilder\` already has a parameter named \`id\`. // // But here we are, doing it like we didn't care. - Id *string \`json:"id"\` + Id *string \`json:"id" yaml:"id"\` } // We can generate fancy builders in Java for classes which take a mix of positional & struct parameters. @@ -13737,11 +13737,11 @@ func (t *jsiiProxy_Thrower) ThrowError() { type TopLevelStruct struct { // This is a required field. - Required *string \`json:"required"\` + Required *string \`json:"required" yaml:"required"\` // A union to really stress test our serialization. - SecondLevel interface{} \`json:"secondLevel"\` + SecondLevel interface{} \`json:"secondLevel" yaml:"secondLevel"\` // You don't have to pass this. - Optional *string \`json:"optional"\` + Optional *string \`json:"optional" yaml:"optional"\` } // In TypeScript it is possible to have two methods with the same name but different capitalization. @@ -13948,8 +13948,8 @@ func (u *jsiiProxy_UnaryOperation) TypeName() interface{} { } type UnionProperties struct { - Bar interface{} \`json:"bar"\` - Foo interface{} \`json:"foo"\` + Bar interface{} \`json:"bar" yaml:"bar"\` + Foo interface{} \`json:"foo" yaml:"foo"\` } // Ensures submodule-imported types from dependencies can be used correctly. @@ -17293,8 +17293,8 @@ import ( ) type MyStruct struct { - BaseMap *map[string]*jcb.BaseProps \`json:"baseMap"\` - Numbers *[]scopejsiicalclib.Number \`json:"numbers"\` + BaseMap *map[string]*jcb.BaseProps \`json:"baseMap" yaml:"baseMap"\` + Numbers *[]scopejsiicalclib.Number \`json:"numbers" yaml:"numbers"\` } @@ -17330,7 +17330,7 @@ package submodule1 type Bar struct { - Bar1 *string \`json:"bar1"\` + Bar1 *string \`json:"bar1" yaml:"bar1"\` } @@ -17359,13 +17359,13 @@ package submodule2 type Bar struct { - Bar2 *string \`json:"bar2"\` + Bar2 *string \`json:"bar2" yaml:"bar2"\` } type Foo struct { - Bar2 *string \`json:"bar2"\` - Bar1 *string \`json:"bar1"\` - Foo2 *string \`json:"foo2"\` + Bar2 *string \`json:"bar2" yaml:"bar2"\` + Bar1 *string \`json:"bar1" yaml:"bar1"\` + Foo2 *string \`json:"foo2" yaml:"foo2"\` } @@ -18665,7 +18665,7 @@ func (i *jsiiProxy_IInterfaceWithSelf) Method(self *float64) *string { } type StructWithSelf struct { - Self *string \`json:"self"\` + Self *string \`json:"self" yaml:"self"\` } @@ -18728,7 +18728,7 @@ import ( ) type MyClassReference struct { - Reference submodule.MyClass \`json:"reference"\` + Reference submodule.MyClass \`json:"reference" yaml:"reference"\` } @@ -18818,8 +18818,8 @@ func InnerClass_StaticProp() *SomeStruct { } type KwargsProps struct { - Prop SomeEnum \`json:"prop"\` - Extra *string \`json:"extra"\` + Prop SomeEnum \`json:"prop" yaml:"prop"\` + Extra *string \`json:"extra" yaml:"extra"\` } // Checks that classes can self-reference during initialization. @@ -18876,11 +18876,11 @@ const ( ) type SomeStruct struct { - Prop SomeEnum \`json:"prop"\` + Prop SomeEnum \`json:"prop" yaml:"prop"\` } type Structure struct { - Bool *bool \`json:"bool"\` + Bool *bool \`json:"bool" yaml:"bool"\` } @@ -19161,7 +19161,7 @@ package param type SpecialParameter struct { - Value *string \`json:"value"\` + Value *string \`json:"value" yaml:"value"\` } @@ -19286,7 +19286,7 @@ import ( // See: https://github.com/aws/jsii/issues/2637 // type Default struct { - Foo *float64 \`json:"foo"\` + Foo *float64 \`json:"foo" yaml:"foo"\` } type MyClass interface {