Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions models/protocol_tests/input/rest-xml.json
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,9 @@
"shapes": {
"InputShape": {
"type": "structure",
"required": [
"URIFooEnum"
],
"members": {
"HeaderEnum": {
"shape": "EnumType",
Expand Down Expand Up @@ -1824,14 +1827,15 @@
},
"http": {
"method": "POST",
"requestUri": "/path"
"requestUri": "/Enum/{URIEnum}"
},
"name": "OperationName"
},
"params": {
"URIFooEnum": "bar"
},
"serialized": {
"uri": "/path",
"uri": "/Enum/bar",
"headers": {}
}
}
Expand Down
10 changes: 6 additions & 4 deletions private/model/api/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ type Shape struct {

// CanBeEmpty returns if the shape value can sent request as an empty value.
// String, blob, list, and map are types must not be empty when the member is
// decorated with HostLabel.
// serialized to the uri path, or decorated with HostLabel.
func (ref *ShapeRef) CanBeEmpty() bool {
switch ref.Shape.Type {
case "string":
return !ref.HostLabel
return !(ref.Location == "uri" || ref.HostLabel)
case "blob", "map", "list":
return !(ref.Location == "uri")
default:
return true
}
Expand Down Expand Up @@ -789,7 +791,7 @@ func (s *Shape) IsEnum() bool {
}

// IsRequired returns if member is a required field. Required fields are fields
// marked as required, or hostLabels.
// marked as required, hostLabels, or location of uri path.
func (s *Shape) IsRequired(member string) bool {
ref, ok := s.MemberRefs[member]
if !ok {
Expand All @@ -798,7 +800,7 @@ func (s *Shape) IsRequired(member string) bool {
s.ShapeName, member,
))
}
if ref.HostLabel {
if ref.Location == "uri" || ref.HostLabel {
return true
}
for _, n := range s.Required {
Expand Down
139 changes: 132 additions & 7 deletions private/protocol/restjson/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,24 @@ func (c *InputService2ProtocolTest) InputService2TestCaseOperation1WithContext(c
type InputService2TestShapeInputService2TestCaseOperation1Input struct {
_ struct{} `type:"structure"`

PipelineId *string `location:"uri" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" type:"string" required:"true"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService2TestShapeInputService2TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService2TestShapeInputService2TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetPipelineId sets the PipelineId field's value.
Expand Down Expand Up @@ -464,7 +481,24 @@ func (c *InputService3ProtocolTest) InputService3TestCaseOperation1WithContext(c
type InputService3TestShapeInputService3TestCaseOperation1Input struct {
_ struct{} `type:"structure"`

Foo *string `location:"uri" locationName:"PipelineId" type:"string"`
// Foo is a required field
Foo *string `location:"uri" locationName:"PipelineId" type:"string" required:"true"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService3TestShapeInputService3TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService3TestShapeInputService3TestCaseOperation1Input"}
if s.Foo == nil {
invalidParams.Add(request.NewErrParamRequired("Foo"))
}
if s.Foo != nil && len(*s.Foo) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Foo", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetFoo sets the Foo field's value.
Expand Down Expand Up @@ -758,11 +792,28 @@ func (c *InputService5ProtocolTest) InputService5TestCaseOperation1WithContext(c
type InputService5TestShapeInputService5TestCaseOperation1Input struct {
_ struct{} `type:"structure"`

PipelineId *string `location:"uri" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" type:"string" required:"true"`

QueryDoc map[string]*string `location:"querystring" type:"map"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService5TestShapeInputService5TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService5TestShapeInputService5TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetPipelineId sets the PipelineId field's value.
func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetPipelineId(v string) *InputService5TestShapeInputService5TestCaseOperation1Input {
s.PipelineId = &v
Expand Down Expand Up @@ -913,11 +964,28 @@ func (c *InputService6ProtocolTest) InputService6TestCaseOperation1WithContext(c
type InputService6TestShapeInputService6TestCaseOperation1Input struct {
_ struct{} `type:"structure"`

PipelineId *string `location:"uri" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" type:"string" required:"true"`

QueryDoc map[string][]*string `location:"querystring" type:"map"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService6TestShapeInputService6TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService6TestShapeInputService6TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetPipelineId sets the PipelineId field's value.
func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetPipelineId(v string) *InputService6TestShapeInputService6TestCaseOperation1Input {
s.PipelineId = &v
Expand Down Expand Up @@ -1306,7 +1374,24 @@ type InputService8TestShapeInputService8TestCaseOperation1Input struct {

PageToken *string `location:"querystring" locationName:"PageToken" type:"string"`

PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" locationName:"PipelineId" type:"string" required:"true"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService8TestShapeInputService8TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService8TestShapeInputService8TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetAscending sets the Ascending field's value.
Expand Down Expand Up @@ -1471,7 +1556,24 @@ type InputService9TestShapeInputService9TestCaseOperation1Input struct {

PageToken *string `location:"querystring" locationName:"PageToken" type:"string"`

PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" locationName:"PipelineId" type:"string" required:"true"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService9TestShapeInputService9TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService9TestShapeInputService9TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetAscending sets the Ascending field's value.
Expand Down Expand Up @@ -1664,7 +1766,24 @@ type InputService10TestShapeInputService10TestCaseOperation1Input struct {

PageToken *string `location:"querystring" locationName:"PageToken" type:"string"`

PipelineId *string `location:"uri" locationName:"PipelineId" type:"string"`
// PipelineId is a required field
PipelineId *string `location:"uri" locationName:"PipelineId" type:"string" required:"true"`
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *InputService10TestShapeInputService10TestCaseOperation1Input) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "InputService10TestShapeInputService10TestCaseOperation1Input"}
if s.PipelineId == nil {
invalidParams.Add(request.NewErrParamRequired("PipelineId"))
}
if s.PipelineId != nil && len(*s.PipelineId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("PipelineId", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}

// SetAscending sets the Ascending field's value.
Expand Down Expand Up @@ -1869,6 +1988,9 @@ func (s *InputService11TestShapeInputService11TestCaseOperation1Input) Validate(
if s.VaultName == nil {
invalidParams.Add(request.NewErrParamRequired("VaultName"))
}
if s.VaultName != nil && len(*s.VaultName) < 1 {
invalidParams.Add(request.NewErrParamMinLen("VaultName", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
Expand Down Expand Up @@ -2045,6 +2167,9 @@ func (s *InputService12TestShapeInputService12TestCaseOperation1Input) Validate(
if s.Foo == nil {
invalidParams.Add(request.NewErrParamRequired("Foo"))
}
if s.Foo != nil && len(*s.Foo) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Foo", 1))
}

if invalidParams.Len() > 0 {
return invalidParams
Expand Down
Loading