From 23cb4654140ffde786c1bcdc86f854210e09b3f4 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Wed, 19 Apr 2023 14:25:29 -0700 Subject: [PATCH] Loosen Operation Existence during Model Loading (#4804) * loosen operation existence for pagination * loosen operation existence for waiters * loosen operation existence for smoke tests --- private/model/api/pagination.go | 9 ++++----- private/model/api/smoke.go | 2 ++ private/model/api/waiters.go | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/private/model/api/pagination.go b/private/model/api/pagination.go index 4c338ab16d7..a31089ee344 100644 --- a/private/model/api/pagination.go +++ b/private/model/api/pagination.go @@ -58,6 +58,9 @@ func (p *paginationDefinitions) setup() error { if e.InputTokens == nil || e.OutputTokens == nil { continue } + if _, ok := p.Operations[n]; !ok { + continue + } paginator := e switch t := paginator.InputTokens.(type) { @@ -83,11 +86,7 @@ func (p *paginationDefinitions) setup() error { paginator.OutputTokens = toks } - if o, ok := p.Operations[n]; ok { - o.Paginator = &paginator - } else { - return fmt.Errorf("unknown operation for paginator, %s", n) - } + p.Operations[n].Paginator = &paginator } return nil diff --git a/private/model/api/smoke.go b/private/model/api/smoke.go index 5b8e79b1b37..b25b08dafac 100644 --- a/private/model/api/smoke.go +++ b/private/model/api/smoke.go @@ -173,6 +173,7 @@ func (a *API) APISmokeTestsGoCode() string { var smokeTestTmpl = template.Must(template.New(`smokeTestTmpl`).Parse(` {{- range $i, $testCase := $.TestCases }} {{- $op := index $.API.Operations $testCase.OpName }} + {{- if $op }} func TestInteg_{{ printf "%02d" $i }}_{{ $op.ExportedName }}(t *testing.T) { ctx, cancelFn := context.WithTimeout(context.Background(), 5 *time.Second) defer cancelFn() @@ -206,5 +207,6 @@ var smokeTestTmpl = template.Must(template.New(`smokeTestTmpl`).Parse(` } {{- end }} } + {{- end }} {{- end }} `)) diff --git a/private/model/api/waiters.go b/private/model/api/waiters.go index 33ccd8cec55..1da730837fc 100644 --- a/private/model/api/waiters.go +++ b/private/model/api/waiters.go @@ -98,8 +98,7 @@ func (p *waiterDefinitions) setup() error { e.OperationName = p.ExportableName(e.OperationName) e.Operation = p.API.Operations[e.OperationName] if e.Operation == nil { - return fmt.Errorf("unknown operation %s for waiter %s", - e.OperationName, n) + continue } p.API.Waiters = append(p.API.Waiters, e) }