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

[Fix] Correctly include query parameters for APIs whose request objects contain the body as a field #401

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Jan 22, 2025

What changes are proposed in this pull request?

The Databricks API spec has two different styles of APIs, those where the request body is a field in the Request structure, and those where the request body is said structure (not counting the parameters passed via the URI path and query string). The former style of APIs was incorrectly implemented, preventing such APIs from using any query parameters.

Generally, the approach taken here is to move the construction of the request object into the autogenerated Impl classes and providing a fully materialized Request object to the ApiClient. To do so, we expose the <T> T execute(Request in, Target Class<T>) method as public.

Separately, I've removed the per-HTTP-method methods from ApiClient, opting instead to use the singular execute, as they purely create more maintenance burden for us and decrease the surface area we need to maintain.

How is this tested?

Added AppsImplTest to verify that the no_compute flag is included in the request passed to the ApiClient.

}

public <I, O> O DELETE(String path, I in, Class<O> target, Map<String, String> headers) {
public <I, O> O execute(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still use this one? Now all generated code uses the one which takes the Request object, correct?

@mgyucht mgyucht temporarily deployed to test-trigger-is January 22, 2025 14:59 — with GitHub Actions Inactive
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-java

Inputs:

  • PR number: 401
  • Commit SHA: 505fabbff25c0b2e7bb84525894ba50a1f86e881

Checks will be approved automatically on success.

@mgyucht mgyucht enabled auto-merge January 22, 2025 14:59
@mgyucht mgyucht temporarily deployed to test-trigger-is January 22, 2025 14:59 — with GitHub Actions Inactive
@mgyucht mgyucht added this pull request to the merge queue Jan 22, 2025
Merged via the queue into main with commit c750aae Jan 22, 2025
15 checks passed
@mgyucht mgyucht deleted the fix-query-param-handling branch January 22, 2025 15:08
mgyucht added a commit that referenced this pull request Feb 3, 2025
### Bug Fixes

 * Correctly include query parameters for APIs whose request objects contain the body as a field ([#401](#401)).

### Internal Changes

 * Add CICD environment to User Agent ([#404](#404)).

### API Changes:

 * Added `accountClient.budgetPolicy()` service.
 * Added `accountClient.enableIpAccessLists()` service.
 * Added `workspaceClient.accessControl()` service.
 * Added `workspaceClient.lakeviewEmbedded()` service and `workspaceClient.queryExecution()` service.
 * Added `workspaceClient.redashConfig()` service.
 * Added `httpRequest()` method for `workspaceClient.servingEndpoints()` service.
 * Added `gcpOauthToken` field for `com.databricks.sdk.service.catalog.TemporaryCredentials`.
 * Added `options` field for `com.databricks.sdk.service.catalog.UpdateCatalog`.
 * Added `reviewState`, `reviews` and `runnerCollaborators` fields for `com.databricks.sdk.service.cleanrooms.CleanRoomAssetNotebook`.
 * Added `statementId` field for `com.databricks.sdk.service.dashboards.QueryAttachment`.
 * Added `effectivePerformanceTarget` field for `com.databricks.sdk.service.jobs.BaseRun`.
 * Added `performanceTarget` field for `com.databricks.sdk.service.jobs.CreateJob`.
 * Added `performanceTarget` field for `com.databricks.sdk.service.jobs.JobSettings`.
 * Added `effectivePerformanceTarget` field for `com.databricks.sdk.service.jobs.Run`.
 * Added `performanceTarget` field for `com.databricks.sdk.service.jobs.RunNow`.
 * Added `cleanRoomsNotebookOutput` field for `com.databricks.sdk.service.jobs.RunOutput`.
 * Added `disabled` and `effectivePerformanceTarget` fields for `com.databricks.sdk.service.jobs.RunTask`.
 * Added `runAsRepl` field for `com.databricks.sdk.service.jobs.SparkJarTask`.
 * Added `userAuthorizedScopes` field for `com.databricks.sdk.service.oauth2.CreateCustomAppIntegration`.
 * Added `userAuthorizedScopes` field for `com.databricks.sdk.service.oauth2.GetCustomAppIntegrationOutput`.
 * Added `scopes` and `userAuthorizedScopes` fields for `com.databricks.sdk.service.oauth2.UpdateCustomAppIntegration`.
 * Added `contents` field for `com.databricks.sdk.service.serving.GetOpenApiResponse`.
 * Added `activated`, `activationUrl`, `authenticationType`, `cloud`, `comment`, `createdAt`, `createdBy`, `dataRecipientGlobalMetastoreId`, `ipAccessList`, `metastoreId`, `name`, `owner`, `propertiesKvpairs`, `region`, `sharingCode`, `tokens`, `updatedAt` and `updatedBy` fields for `com.databricks.sdk.service.sharing.RecipientInfo`.
 * Added `expirationTime` field for `com.databricks.sdk.service.sharing.RecipientInfo`.
 * Changed `update()` method for `workspaceClient.recipients()` service to return `com.databricks.sdk.service.sharing.RecipientInfo` class.
 * Changed `update()` method for `workspaceClient.recipients()` service to type `update()` method for `workspaceClient.recipients()` service.
 * Changed `update()` method for `workspaceClient.recipients()` service return type to become non-empty.
 * Changed `create()` method for `workspaceClient.servingEndpoints()` service with new required argument order.
 * Changed `getOpenApi()` method for `workspaceClient.servingEndpoints()` service return type to become non-empty.
 * Changed `patch()` method for `workspaceClient.servingEndpoints()` service to return `com.databricks.sdk.service.serving.EndpointTags` class.
 * Changed `patch()` method for `workspaceClient.servingEndpoints()` service to type `patch()` method for `workspaceClient.servingEndpoints()` service.
 * Changed `com.databricks.sdk.service.serving.EndpointTagList` class to.
 * Changed `collaboratorAlias` field for `com.databricks.sdk.service.cleanrooms.CleanRoomCollaborator` to be required.
 * Changed `collaboratorAlias` field for `com.databricks.sdk.service.cleanrooms.CleanRoomCollaborator` to be required.
 * Changed `behavior` field for `com.databricks.sdk.service.serving.AiGatewayGuardrailPiiBehavior` to no longer be required.
 * Changed `behavior` field for `com.databricks.sdk.service.serving.AiGatewayGuardrailPiiBehavior` to no longer be required.
 * Changed `config` field for `com.databricks.sdk.service.serving.CreateServingEndpoint` to no longer be required.
 * Changed `projectId` and `region` fields for `com.databricks.sdk.service.serving.GoogleCloudVertexAiConfig` to be required.
 * Changed `projectId` and `region` fields for `com.databricks.sdk.service.serving.GoogleCloudVertexAiConfig` to be required.
 * Changed `workloadType` field for `com.databricks.sdk.service.serving.ServedEntityInput` to type `com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
 * Changed `workloadType` field for `com.databricks.sdk.service.serving.ServedEntityOutput` to type `com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
 * Changed `workloadType` field for `com.databricks.sdk.service.serving.ServedModelOutput` to type `com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
 * Removed `securableKind` field for `com.databricks.sdk.service.catalog.CatalogInfo`.
 * Removed `securableKind` field for `com.databricks.sdk.service.catalog.ConnectionInfo`.

OpenAPI SHA: c72c58f97b950fcb924a90ef164bcb10cfcd5ece, Date: 2025-02-03
@mgyucht mgyucht mentioned this pull request Feb 3, 2025
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2025
### Bug Fixes

* Correctly include query parameters for APIs whose request objects
contain the body as a field
([#401](#401)).


### Internal Changes

* Add CICD environment to User Agent
([#404](#404)).


### API Changes:

 * Added `accountClient.budgetPolicy()` service.
 * Added `accountClient.enableIpAccessLists()` service.
 * Added `workspaceClient.accessControl()` service.
* Added `workspaceClient.lakeviewEmbedded()` service and
`workspaceClient.queryExecution()` service.
 * Added `workspaceClient.redashConfig()` service.
* Added `httpRequest()` method for `workspaceClient.servingEndpoints()`
service.
* Added `gcpOauthToken` field for
`com.databricks.sdk.service.catalog.TemporaryCredentials`.
* Added `options` field for
`com.databricks.sdk.service.catalog.UpdateCatalog`.
* Added `reviewState`, `reviews` and `runnerCollaborators` fields for
`com.databricks.sdk.service.cleanrooms.CleanRoomAssetNotebook`.
* Added `statementId` field for
`com.databricks.sdk.service.dashboards.QueryAttachment`.
* Added `effectivePerformanceTarget` field for
`com.databricks.sdk.service.jobs.BaseRun`.
* Added `performanceTarget` field for
`com.databricks.sdk.service.jobs.CreateJob`.
* Added `performanceTarget` field for
`com.databricks.sdk.service.jobs.JobSettings`.
* Added `effectivePerformanceTarget` field for
`com.databricks.sdk.service.jobs.Run`.
* Added `performanceTarget` field for
`com.databricks.sdk.service.jobs.RunNow`.
* Added `cleanRoomsNotebookOutput` field for
`com.databricks.sdk.service.jobs.RunOutput`.
* Added `disabled` and `effectivePerformanceTarget` fields for
`com.databricks.sdk.service.jobs.RunTask`.
* Added `runAsRepl` field for
`com.databricks.sdk.service.jobs.SparkJarTask`.
* Added `userAuthorizedScopes` field for
`com.databricks.sdk.service.oauth2.CreateCustomAppIntegration`.
* Added `userAuthorizedScopes` field for
`com.databricks.sdk.service.oauth2.GetCustomAppIntegrationOutput`.
* Added `scopes` and `userAuthorizedScopes` fields for
`com.databricks.sdk.service.oauth2.UpdateCustomAppIntegration`.
* Added `contents` field for
`com.databricks.sdk.service.serving.GetOpenApiResponse`.
* Added `activated`, `activationUrl`, `authenticationType`, `cloud`,
`comment`, `createdAt`, `createdBy`, `dataRecipientGlobalMetastoreId`,
`ipAccessList`, `metastoreId`, `name`, `owner`, `propertiesKvpairs`,
`region`, `sharingCode`, `tokens`, `updatedAt` and `updatedBy` fields
for `com.databricks.sdk.service.sharing.RecipientInfo`.
* Added `expirationTime` field for
`com.databricks.sdk.service.sharing.RecipientInfo`.
* Changed `update()` method for `workspaceClient.recipients()` service
to return `com.databricks.sdk.service.sharing.RecipientInfo` class.
* Changed `update()` method for `workspaceClient.recipients()` service
to type `update()` method for `workspaceClient.recipients()` service.
* Changed `update()` method for `workspaceClient.recipients()` service
return type to become non-empty.
* Changed `create()` method for `workspaceClient.servingEndpoints()`
service with new required argument order.
* Changed `getOpenApi()` method for `workspaceClient.servingEndpoints()`
service return type to become non-empty.
* Changed `patch()` method for `workspaceClient.servingEndpoints()`
service to return `com.databricks.sdk.service.serving.EndpointTags`
class.
* Changed `patch()` method for `workspaceClient.servingEndpoints()`
service to type `patch()` method for
`workspaceClient.servingEndpoints()` service.
* Changed `com.databricks.sdk.service.serving.EndpointTagList` class to.
* Changed `collaboratorAlias` field for
`com.databricks.sdk.service.cleanrooms.CleanRoomCollaborator` to be
required.
* Changed `collaboratorAlias` field for
`com.databricks.sdk.service.cleanrooms.CleanRoomCollaborator` to be
required.
* Changed `behavior` field for
`com.databricks.sdk.service.serving.AiGatewayGuardrailPiiBehavior` to no
longer be required.
* Changed `behavior` field for
`com.databricks.sdk.service.serving.AiGatewayGuardrailPiiBehavior` to no
longer be required.
* Changed `config` field for
`com.databricks.sdk.service.serving.CreateServingEndpoint` to no longer
be required.
* Changed `projectId` and `region` fields for
`com.databricks.sdk.service.serving.GoogleCloudVertexAiConfig` to be
required.
* Changed `projectId` and `region` fields for
`com.databricks.sdk.service.serving.GoogleCloudVertexAiConfig` to be
required.
* Changed `workloadType` field for
`com.databricks.sdk.service.serving.ServedEntityInput` to type
`com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
* Changed `workloadType` field for
`com.databricks.sdk.service.serving.ServedEntityOutput` to type
`com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
* Changed `workloadType` field for
`com.databricks.sdk.service.serving.ServedModelOutput` to type
`com.databricks.sdk.service.serving.ServingModelWorkloadType` class.
* Removed `securableKind` field for
`com.databricks.sdk.service.catalog.CatalogInfo`.
* Removed `securableKind` field for
`com.databricks.sdk.service.catalog.ConnectionInfo`.

OpenAPI SHA: c72c58f97b950fcb924a90ef164bcb10cfcd5ece, Date: 2025-02-03
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.

2 participants