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

feat(codegen): generate paginators and waiters with default parameters for all optional inputs #959

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Sep 25, 2023

Issue #

n/a

Description of changes

  • feat: We generate service client operation methods with a default parameter whenever the input shape to the operation has all optional members. This PR adds the same default parameter convenience for paginators and waiters.
  • fix: Fix test utility to actually return null when no index is found (indexOf returns -1 when not found, our test logic was predicating off null and silently passing tests that should fail).
  • fix: misc: add visibility build setting #951 added API settings for internal vs external visibility but we missed paginators and waiters as part of this, updated codegen to respect the visibility for generated paginators and waiters.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aajtodd aajtodd requested a review from a team as a code owner September 25, 2023 16:23
@@ -124,6 +116,12 @@ class PaginatorGenerator : KotlinIntegration {
""".trimIndent()
val docReturn = "@return A [kotlinx.coroutines.flow.Flow] that can collect [${outputSymbol.name}]"

val inputParameter = if (paginationInfo.input.hasAllOptionalMembers) {
writer.format("initialRequest: #1T = #1T{}", inputSymbol)
Copy link
Contributor

@lauzadis lauzadis Sep 25, 2023

Choose a reason for hiding this comment

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

nit (style): #1T { }

If you think it's a good suggestion, also applies to the same change in waiters

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
47.4% 47.4% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@aajtodd aajtodd merged commit 24f9441 into main Sep 26, 2023
8 of 9 checks passed
@aajtodd aajtodd deleted the fix-signatures branch September 26, 2023 15:36
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.

4 participants