Skip to content

Commit

Permalink
don't serde the bucket (aws#2204)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws authored and isaiahvita committed Jul 25, 2023
1 parent efb08f7 commit 262596c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 679 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ generate: smithy-generate update-requires gen-repo-mod-replace update-module-met
gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-dropreplace-smithy-. min-go-version-. \
tidy-modules-. add-module-license-files gen-aws-ptrs format

generate-tmpreplace-smithy: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-replace-smithy-. min-go-version-. \
tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-.

smithy-generate:
cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import software.amazon.smithy.go.codegen.GoSettings;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.go.codegen.trait.NoSerializeTrait;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.traits.HttpLabelTrait;
import software.amazon.smithy.model.transform.ModelTransformer;
Expand All @@ -14,13 +15,13 @@ public Model preprocessModel(Model model, GoSettings settings) {
return model;
}

return ModelTransformer.create().removeTraitsIf(model, (shape, trait) -> {
if (trait instanceof HttpLabelTrait) {
return shape.asMemberShape()
return ModelTransformer.create().mapTraits(model, (shape, trait) -> {
if (!(trait instanceof HttpLabelTrait)) return trait;

boolean isBucket = shape.asMemberShape()
.map(s -> s.getMemberName().equals("Bucket"))
.orElse(false);
}
return false;
return isBucket ? new NoSerializeTrait() : trait;
});
}
}
Loading

0 comments on commit 262596c

Please sign in to comment.