-
Notifications
You must be signed in to change notification settings - Fork 50
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
tools/generator-go-sdk: generate custom pager for list method #3958
tools/generator-go-sdk: generate custom pager for list method #3958
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @teowa
Thanks for this PR - I've taken a look through and left some comments inline, but if we can fix those up then this should otherwise be good to go. Out of interest have you run the unit tests on the generated SDK to validate the output too?
Thanks!
tools/generator-go-sdk/internal/generator/templater_methods_test.go
Outdated
Show resolved
Hide resolved
tools/generator-go-sdk/internal/generator/templater_methods_test.go
Outdated
Show resolved
Hide resolved
tools/generator-go-sdk/internal/generator/templater_methods_test.go
Outdated
Show resolved
Hide resolved
tools/generator-go-sdk/internal/generator/templater_methods_discriminators_test.go
Outdated
Show resolved
Hide resolved
tools/generator-go-sdk/internal/generator/templater_methods_discriminators_test.go
Outdated
Show resolved
Hide resolved
NextLink *odata.Link %[2]s | ||
} | ||
|
||
func (p *ListCustomPager) NextPageLink() *odata.Link { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we nil check here like in https://github.com/hashicorp/go-azure-sdk/blob/8ee56b008ba9275ff6c3282052e6b50e83073f9a/sdk/client/client_test.go#L166-L173, and should we introduce log
package here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that's mostly for testing purposes, so this is fine. If NextPageLink
returns nil then we assume we're at the end of the dataset, so that's fine/should be logged elsewhere
@teowa to pull the comment out from the last PR review - out of interest have you run the unit tests on the generated SDK to validate the output too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @teowa, this LGTM pending test results 👍
Hi, I just find some test failures, because customPager struct for long-running operation was not generated but pager option in request was generated, which causes go build failure. Some POST APIs are long-running opertion with pageable response, e.g., AppServiceEnvironments_ChangeVnet. I have added these struct to pass the unit test but it won't take effect since long-running operation does not use Or I should not generate The list of 59 POST operations with `x-ms-pageable` and `x-ms-long-running-operation`:
|
any update? |
…tom_pager_for_list_method
I have added logic to generate |
resolves hashicorp/terraform-provider-azurerm#24948
handle x-ms-pageable.nextLinkName, so the custom nextlink can be processed.