Skip to content

Commit e389126

Browse files
authored
Backport union types for pre-smithy services from smithy models into codegen customizations. (#3135)
1 parent 170bc73 commit e389126

File tree

14 files changed

+88
-7
lines changed

14 files changed

+88
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"contributor": "",
4+
"type": "feature",
5+
"description": "Extend union type improvements to additional services: dynamodb, dynamodbstreams, iot, sagemaker, clouddirectory, iotanalytics, kendra, marketplaceentitlement, quicksight, s3, xray."
6+
}

codegen/src/main/java/software/amazon/awssdk/codegen/customization/processors/ShapeModifiersProcessor.java

+4
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ private void preprocessModifyShapeMembers(ServiceModel serviceModel, Shape shape
204204
shape.getMembers().putAll(injects);
205205
}
206206
}
207+
208+
if (modifier.isUnion() != null) {
209+
shape.setUnion(modifier.isUnion());
210+
}
207211
}
208212

209213
private void doModifyShapeMembers(ServiceModel serviceModel, Shape shape, String memberToModify,

codegen/src/main/java/software/amazon/awssdk/codegen/model/config/customization/ShapeModifier.java

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class ShapeModifier {
3030
private List<Map<String, ModifyModelShapeModifier>> modify;
3131
private List<Map<String, Member>> inject;
3232
private Integer staxTargetDepthOffset;
33+
private Boolean union;
3334

3435
/**
3536
* @return true if the whole shape should be excluded.
@@ -87,4 +88,12 @@ public Integer getStaxTargetDepthOffset() {
8788
public void setStaxTargetDepthOffset(Integer staxTargetDepthOffset) {
8889
this.staxTargetDepthOffset = staxTargetDepthOffset;
8990
}
91+
92+
public Boolean isUnion() {
93+
return union;
94+
}
95+
96+
public void setUnion(Boolean union) {
97+
this.union = union;
98+
}
9099
}

services/clouddirectory/src/main/resources/codegen-resources/customization.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44
"listDirectories",
55
"listManagedSchemaArns",
66
"listPublishedSchemaArns"
7-
]
7+
],
8+
"shapeModifiers": {
9+
"TypedAttributeValue": {
10+
"union": true
11+
}
12+
}
813
}

services/dynamodb/src/main/resources/codegen-resources/dynamodb/customization.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"emitPropertyName": "NUL"
99
}
1010
}
11-
]
11+
],
12+
"union": true
1213
}
1314
},
1415
"verifiedSimpleMethods" : [

services/dynamodb/src/main/resources/codegen-resources/dynamodbstreams/customization.config

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"emitPropertyName": "NUL"
99
}
1010
}
11-
]
11+
],
12+
"union": true
1213
}
1314
},
1415
"sdkModeledExceptionBaseClassName": "DynamoDbException",

services/iot/src/main/resources/codegen-resources/customization.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,10 @@
4949
"DetachPrincipalPolicy",
5050
"ListPolicyPrincipals",
5151
"ListPrincipalPolicies"
52-
]
52+
],
53+
"shapeModifiers": {
54+
"AssetPropertyVariant": {
55+
"union": true
56+
}
57+
}
5358
}

services/iotanalytics/src/main/resources/codegen-resources/customization.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77
],
88
"blacklistedSimpleMethods": [
99
"describeLoggingOptions"
10-
]
10+
],
11+
"shapeModifiers": {
12+
"DatastoreStorage": {
13+
"union": true
14+
}
15+
}
1116
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"shapeModifiers": {
3+
"DocumentAttributeValue": {
4+
"union": true
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"shapeModifiers": {
3+
"EntitlementValue": {
4+
"union": true
5+
}
6+
}
7+
}

services/quicksight/src/main/resources/codegen-resources/customization.config

+9
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@
134134
}
135135
}
136136
]
137+
},
138+
"TransformOperation": {
139+
"union": true
140+
},
141+
"PhysicalTable": {
142+
"union": true
143+
},
144+
"DataSourceParameters": {
145+
"union": true
137146
}
138147
}
139148
}

services/s3/src/main/resources/codegen-resources/customization.config

+12
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@
111111
"suffix": { "emitEnumValue": "Suffix" }
112112
}
113113
]
114+
},
115+
"ReplicationRuleFilter": {
116+
"union": true
117+
},
118+
"MetricsFilter": {
119+
"union": true
120+
},
121+
"AnalyticsFilter": {
122+
"union": true
123+
},
124+
"LifecycleRuleFilter": {
125+
"union": true
114126
}
115127
},
116128
"serviceConfig": {

services/sagemaker/src/main/resources/codegen-resources/customization.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@
1515
"listTrainingJobs",
1616
"listTransformJobs",
1717
"listWorkteams"
18-
]
18+
],
19+
"shapeModifiers": {
20+
"TrialComponentParameterValue": {
21+
"union": true
22+
}
23+
}
1924
}

services/xray/src/main/resources/codegen-resources/customization.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
"blacklistedSimpleMethods": [
99
"deleteSamplingRule",
1010
"getGroup"
11-
]
11+
],
12+
"shapeModifiers": {
13+
"AnnotationValue": {
14+
"union": true
15+
}
16+
}
1217
}

0 commit comments

Comments
 (0)