Skip to content

Commit

Permalink
[Fix] Do not send query parameters when set to zero value (#1136)
Browse files Browse the repository at this point in the history
## What changes are proposed in this pull request?

#1124 fixed the handling of APIs that use query parameters and a body
simultaneously. After that change, query parameters are always sent,
even if set to the zero value.

This PR addresses this, using the same logic for query parameters as for
fields in the body: if a field is set to its zero value, it will be
included in the query parameter if it is present in ForceSendFields.

## How is this tested?

This behavior is dependend upon in the Terraform provider. I'll be using
it in
databricks/terraform-provider-databricks#4430
and verifying that there is no behavior change in the generated request.

When using this PR in Terraform, tests asserting that the path doesn't
include query parameters pass.
  • Loading branch information
mgyucht authored Jan 23, 2025
1 parent 28ff749 commit 18cebf1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
5 changes: 4 additions & 1 deletion service/apps/impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion service/files/impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions service/oauth2/impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions service/pkg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions service/sharing/impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 18cebf1

Please sign in to comment.