Skip to content

Commit

Permalink
Revert RESTJSON and RESTXML changes of SDK v1.11.0 (#1551)
Browse files Browse the repository at this point in the history
* Revert "API Marshaler: Add generated marshalers for RESTJSON protocol (#1547)"

This reverts commit 1a10a10.

Reverts RESTJSON marshaler improvement due to bug in RESTXML

* Revert "API Marshaling: Add generated marshalers for RESTXML protocol (#1409)"

This reverts commit 37448a9.

Reverts RESTXML due to #1550
  • Loading branch information
jasdel authored Sep 26, 2017
1 parent e0f1555 commit 6a946b2
Show file tree
Hide file tree
Showing 56 changed files with 247 additions and 49,594 deletions.
4 changes: 0 additions & 4 deletions models/protocol_tests/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ func generateTestSuite(filename string) string {
svcPrefix := inout + "Service" + strconv.Itoa(i+1)
suite.API.Metadata.ServiceAbbreviation = svcPrefix + "ProtocolTest"
suite.API.Operations = map[string]*api.Operation{}

for idx, c := range suite.Cases {
c.Given.ExportedName = svcPrefix + "TestCaseOperation" + strconv.Itoa(idx+1)
suite.API.Operations[c.Given.ExportedName] = c.Given
Expand All @@ -371,9 +370,6 @@ func generateTestSuite(filename string) string {
suite.API.Setup()
suite.API.Metadata.EndpointPrefix = suite.API.PackageName()

// TODO until generated marshalers are all supported
suite.API.EnableSelectGeneratedMarshalers()

// Sort in order for deterministic test generation
names := make([]string, 0, len(suite.API.Shapes))
for n := range suite.API.Shapes {
Expand Down
7 changes: 0 additions & 7 deletions private/model/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ type API struct {
// Set to true to not generate struct field accessors
NoGenStructFieldAccessors bool

// Set to true to not generate (un)marshalers
NoGenMarshalers bool
NoGenUnmarshalers bool

SvcClientImportPath string

initialized bool
Expand Down Expand Up @@ -276,9 +272,6 @@ func (a *API) APIGoCode() string {
a.imports["github.com/aws/aws-sdk-go/private/protocol/"+a.ProtocolPackage()] = true
a.imports["github.com/aws/aws-sdk-go/private/protocol"] = true
}
if !a.NoGenMarshalers || !a.NoGenUnmarshalers {
a.imports["github.com/aws/aws-sdk-go/private/protocol"] = true
}

for _, op := range a.Operations {
if op.AuthType == "none" {
Expand Down
15 changes: 0 additions & 15 deletions private/model/api/customization_passes.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@ func (a *API) customizationPasses() {
if fn := svcCustomizations[a.PackageName()]; fn != nil {
fn(a)
}

// TODO until generated marshalers are all supported
a.EnableSelectGeneratedMarshalers()
}

func (a *API) EnableSelectGeneratedMarshalers() {
// Selectivily enable generated marshalers as available
a.NoGenMarshalers = true
a.NoGenUnmarshalers = true

// Enable generated marshalers
switch a.Metadata.Protocol {
case "rest-xml", "rest-json":
a.NoGenMarshalers = false
}
}

// s3Customizations customizes the API generation to replace values specific to S3.
Expand Down
9 changes: 0 additions & 9 deletions private/model/api/passes.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ func (a *API) resolveReferences() {
o.ErrorRefs[i].Shape.IsError = true
}
}

for _, s := range a.Shapes {
switch s.Type {
case "list":
s.MemberRef.Shape.UsedInList = true
case "map":
s.ValueRef.Shape.UsedInMap = true
}
}
}

// A referenceResolver provides a way to resolve shape references to
Expand Down
24 changes: 2 additions & 22 deletions private/model/api/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ type Shape struct {

OrigShapeName string `json:"-"`

UsedInMap bool
UsedInList bool

// Defines if the shape is a placeholder and should not be used directly
Placeholder bool

Expand Down Expand Up @@ -188,18 +185,10 @@ func (s *Shape) GoStructValueType(name string, ref *ShapeRef) string {
return v
}

func (s *Shape) IsRefPayload(name string) bool {
return s.Payload == name
}

func (s *Shape) IsRefPayloadReader(name string, ref *ShapeRef) bool {
return (ref.Streaming || ref.Shape.Streaming) && s.IsRefPayload(name)
}

// GoStructType returns the type of a struct field based on the API
// model definition.
func (s *Shape) GoStructType(name string, ref *ShapeRef) string {
if s.IsRefPayloadReader(name, ref) {
if (ref.Streaming || ref.Shape.Streaming) && s.Payload == name {
rtype := "io.ReadSeeker"
if strings.HasSuffix(s.ShapeName, "Output") {
rtype = "io.ReadCloser"
Expand Down Expand Up @@ -524,9 +513,7 @@ func (s *Shape) NestedShape() *Shape {
}

var structShapeTmpl = template.Must(template.New("StructShape").Funcs(template.FuncMap{
"GetCrosslinkURL": GetCrosslinkURL,
"MarshalShapeGoCode": MarshalShapeGoCode,
"UnmarshalShapeGoCode": UnmarshalShapeGoCode,
"GetCrosslinkURL": GetCrosslinkURL,
}).Parse(`
{{ .Docstring }}
{{ if ne $.OrigShapeName "" -}}
Expand Down Expand Up @@ -610,13 +597,6 @@ func (s *{{ $builderShapeName }}) get{{ $name }}() (v {{ $context.GoStructValueT
{{ end }}
{{ end }}
{{ if not $.API.NoGenMarshalers -}}
{{ MarshalShapeGoCode $ }}
{{- end }}
{{ if not $.API.NoGenUnmarshalers -}}
{{ UnmarshalShapeGoCode $ }}
{{- end }}
`))

var enumShapeTmpl = template.Must(template.New("EnumShape").Parse(`
Expand Down
Loading

0 comments on commit 6a946b2

Please sign in to comment.