Skip to content
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

Upgrade to smithy 1.25.0 #1835

Merged
merged 2 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Gemfile.lock
/private/model/cli/gen-api/gen-api
.gradle/
build/
.idea/
2 changes: 1 addition & 1 deletion codegen/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
smithyVersion=1.23.1
smithyVersion=1.25.0
smithyGradleVersion=0.6.0
1 change: 1 addition & 0 deletions codegen/protocol-test-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ val smithyVersion: String by project
buildscript {
val smithyVersion: String by project
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
Expand Down
1 change: 1 addition & 0 deletions codegen/sdk-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ val smithyVersion: String by project
buildscript {
val smithyVersion: String by project
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package software.amazon.smithy.aws.go.codegen.customization;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import software.amazon.smithy.codegen.core.CodegenException;
import software.amazon.smithy.go.codegen.CodegenUtils;
import software.amazon.smithy.go.codegen.GoSettings;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.transform.ModelTransformer;
import software.amazon.smithy.model.shapes.MemberShape;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.shapes.ShapeType;
import software.amazon.smithy.model.traits.BoxTrait;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.traits.ClientOptionalTrait;
import software.amazon.smithy.utils.SetUtils;

public class BackfillEc2UnboxedToBoxedShapes implements GoIntegration {
Expand All @@ -26,7 +28,7 @@ public class BackfillEc2UnboxedToBoxedShapes implements GoIntegration {

/**
* /**
* Updates the API model to customize all number and boolean unboxed shapes to be boxed.
* Updates the API model to customize all structured members to be nullable.
*
* @param model API model
* @param settings Go codegen settings
Expand All @@ -39,63 +41,12 @@ public Model preprocessModel(Model model, GoSettings settings) {
return model;
}

Model.Builder builder = model.toBuilder();

for (Shape shape : model.toSet()) {
// Only consider number and boolean shapes that are unboxed
if (shape.isMemberShape()) {
continue;
}
if (!(CodegenUtils.isNumber(shape) || shape.getType() == ShapeType.BOOLEAN)) {
continue;
List<Shape> updates = new ArrayList<>();
for (StructureShape struct : model.getStructureShapes()) {
for (MemberShape member : struct.getAllMembers().values()) {
updates.add(member.toBuilder().addTrait(new ClientOptionalTrait()).build());
}
if (shape.hasTrait(BoxTrait.class)) {
continue;
}

switch (shape.getType()) {
case BYTE:
shape = shape.asByteShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case SHORT:
shape = shape.asShortShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case INTEGER:
shape = shape.asIntegerShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case LONG:
shape = shape.asLongShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case FLOAT:
shape = shape.asFloatShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case DOUBLE:
shape = shape.asDoubleShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
case BOOLEAN:
shape = shape.asBooleanShape().get().toBuilder()
.addTrait(new BoxTrait())
.build();
break;
default:
throw new CodegenException("unexpected shape type for " + shape.getId() + ", " + shape.getType());
}

builder.addShape(shape);
}

return builder.build();
return ModelTransformer.create().replaceShapes(model, updates);
}
}
4 changes: 2 additions & 2 deletions service/acmpca/deserializers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions service/acmpca/serializers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions service/acmpca/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions service/acmpca/validators.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions service/appconfig/api_op_CreateDeploymentStrategy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/appconfig/api_op_CreateExtension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/appconfig/api_op_CreateExtensionAssociation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/appconfig/api_op_DeleteExtension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/appconfig/api_op_GetDeployment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion service/appconfig/api_op_GetExtension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions service/appconfig/api_op_ListApplications.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions service/appconfig/api_op_ListConfigurationProfiles.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions service/appconfig/api_op_ListDeploymentStrategies.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading