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

Loosen Operation Existence during Model Loading #4804

Merged
merged 3 commits into from
Apr 19, 2023

Conversation

syall
Copy link
Contributor

@syall syall commented Apr 17, 2023

For changes to files under the /model/ folder, and manual edits to autogenerated code (e.g. /service/s3/api.go) please create an Issue instead of a PR for those type of changes.

N/A.


If there is an existing bug or feature this PR is answers please reference it here.

N/A.


aws-sdk-go doesn't support document types, so they are removed from the API JSON models upstream (and anything that references it, i.e. structures and even operations).

Paginators do not have the same upstream removal process, so there could be "orphaned" operations. This change loosens restrictions when loading paginators, waiters, and smoke tests when an operation cannot be found in the API JSON model.

Loosen operation existence during model loading so generation won't fail when operations don't exist in the model:

  • loosen operation existence for pagination
  • loosen operation existence for waiters
  • loosen operation existence for smoke tests

@syall syall marked this pull request as ready for review April 18, 2023 18:37
@@ -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 }}
Copy link
Contributor Author

@syall syall Apr 18, 2023

Choose a reason for hiding this comment

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

I'm not familiar with go templates, but this path should only get triggered if $op is truthy (in this case, not nil).

Copy link
Contributor

Choose a reason for hiding this comment

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

Would appear correct according to https://pkg.go.dev/text/template#hdr-Actions

@@ -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 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would appear correct according to https://pkg.go.dev/text/template#hdr-Actions

@syall syall force-pushed the loosen-operation-existence-model-loading branch from 906c507 to ff97bd3 Compare April 19, 2023 20:19
@syall syall merged commit 23cb465 into aws:main Apr 19, 2023
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.

None yet

3 participants