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

Fix REST-XML Codegen Bug, Move metrics to User-Agent header, Update SDKVersion to refer to goModuleVersion #1257

Merged
merged 8 commits into from
May 13, 2021

Conversation

skmcgrail
Copy link
Member

  • Make go1.16 available in Travis Java builds
  • aws: Updated SDKVersion to refer to goModuleVersion constant.
  • Add Changelog Annotation
  • Regenerated Clients
  • internal/repotools: Support specifying alternative package location for go_module_metadata.go
  • Updated middleware to temporarily direct client metadata to user-agent
  • Add serviceId and module version to user-agent header
  • Fix deserialization of enum types marked with payload trait

Copy link
Contributor

@skotambkar skotambkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, most are minor comments / questions. Can merge this PR.

Comment on lines +51 to +55
- sudo apt-get -y install golang
- go get golang.org/dl/go1.16.4
- $(go env GOPATH)/bin/go1.16.4 download
- export PATH=$HOME/sdk/go1.16.4/bin:$PATH
- export GOROOT=$HOME/sdk/go1.16.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add this for go tip - go get golang.org/dl/gotip ?

Just to be aware ahead of time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can use this strategy to replace our current gotip build process etc.

"type": "feature",
"description": "`AddSDKAgentKey` and `AddSDKAgentKeyValue` in `aws/middleware` package have been updated to direct metadata to `User-Agent` HTTP header.",
"modules": [
"."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Just for readability, it would be great if we can alias core as ..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for not doing this is mainly to avoid having to deal with that condition in multiple spots, "." automatically plays nice with path and filepath as you would expect when you are joining this relative locations to the repository path on the filesystem.

package config

// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.1.7"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can we export these ? Would be helpful when logging.

@@ -175,7 +183,7 @@ func writeModuleMetadata(dir string, goPackage string, version string) (err erro

return metadataTemplate.Execute(f, metadata{
Package: goPackage,
Version: version,
Version: strings.TrimPrefix(version, "v"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we trim v ? Is this to sort or something?

If we decide to export go module version - we may want to add that v back (to be idiomatic). In that case, may be we should handle prefix v and not trim?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly since the SDK version constant has always been reported without it. Same with the product version that is sent in the user-agent, so opt-ed for consistency here.

Comment on lines +6 to +8
[modules."."]
metadata_package = "aws"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated comment: can add another module as core pointing to aws?

@@ -41,13 +41,18 @@ public void writeAdditionalFiles(
GoDelegator goDelegator
) {
ServiceTrait serviceTrait = settings.getService(model).expectTrait(ServiceTrait.class);
String servceId = serviceTrait.getSdkId().replace("-", "").replace(" ", "").toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Java replace takes a regex. Right now it will traverse that string thrice I think.

@@ -379,7 +379,7 @@ private void writePayloadBindingDeserializer(
} else { // string
writer.addUseImports(SmithyGoDependency.SMITHY_PTR);
if (targetShape.hasTrait(EnumTrait.class)) {
writer.write("v.$L = string(bs)", memberName);
writer.write("v.$L = $T(bs)", memberName, symbolProvider.toSymbol(targetShape));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can use similar suggestion here - aws/smithy-go#296 (comment)

@@ -106,7 +106,7 @@ protected void serializeMap(GenerationContext context, MapShape shape) {
writer.insertTrailingNewline();

// Serialize zero values as empty values.
GoValueAccessUtils.writeIfZeroValue(context.getModel(), writer, shape.getValue(), "v[i]", () -> {
GoValueAccessUtils.writeIfZeroValue(context.getModel(), writer, shape.getValue(), "v[key]", () -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me wonder if queryParamsMap serialization need something similar. What is this changing exactly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was not a valid variable here, looks like this was some sort of copy paste error, but there was no code-gen that exercised this path before. the variable in scope that it should have been using was key. Probably was copied from the code that handled lists.

@skmcgrail skmcgrail merged commit 0ec7bfe into aws:main May 13, 2021
@skmcgrail skmcgrail deleted the regenModels branch May 13, 2021 20:15
jrichard8 pushed a commit to jrichard8/aws-sdk-go-v2 that referenced this pull request Feb 14, 2022
…DKVersion to refer to goModuleVersion (aws#1257)

* Fix deserialization of enum types marked with payload trait
* Add serviceId and module version to user-agent header
* Updated middleware to temporarily direct client metadata to user-agent
* internal/repotools: Support specifying alternative package location for go_module_metadata.go
* Regenerated Clients
* Add Changelog Annotation
* aws: Updated SDKVersion to refer to goModuleVersion constant.
* Make go1.16 available in Travis Java builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants