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

Better constructor for generated clients (Cloud SDK 5.14.0 update) #148

Merged

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 11, 2024

Bumps the production-minor-patch group with 3 updates: com.sap.cloud.sdk:sdk-bom, com.sap.cloud.sdk.datamodel:openapi-generator-maven-plugin and com.puppycrawl.tools:checkstyle.

Updates com.sap.cloud.sdk:sdk-bom from 5.13.0 to 5.14.0

Updates com.sap.cloud.sdk.datamodel:openapi-generator-maven-plugin from 5.13.0 to 5.14.0

Updates com.puppycrawl.tools:checkstyle from 10.20.0 to 10.20.1

Release notes

Sourced from com.puppycrawl.tools:checkstyle's releases.

checkstyle-10.20.1

Checkstyle 10.20.1 - https://checkstyle.org/releasenotes.html#Release_10.20.1

Bug fixes:

#15851 - google_checks: False positive on left curly brace in switch statement with lambda-like construct

Commits
  • 892800d [maven-release-plugin] prepare release checkstyle-10.20.1
  • 9a03ea8 doc: release notes for 10.20.1
  • aef0bf1 Issue #13345: Enabled example tests for DefaultComesLast
  • c4eaaba Issue #14631: Updated JAVADOC_INLINE_TAG_START of JavadocTokenTypes to new AS...
  • c2a03ae Issue #13345: Enable examples tests for IllegalInstantiationCheck
  • f75123e Issue #15851: suppress LeftCurlyNl for switch expressions
  • 3dc2a3d Issue #13345: Enable examples tests for IllegalCatchCheck
  • 2a843c0 Issue #13345: Enabled example tests for TrailingCommentCheck
  • 3015216 Issue #13345: Enable examples tests for StringLiteralEqualityCheck
  • aadc377 Issue #14625: fix noinspectionreason for TestMethodWithoutAssertion
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
  • @dependabot unignore <dependency name> will remove all of the ignore conditions of the specified dependency
  • @dependabot unignore <dependency name> <ignore condition> will remove the ignore condition of the specified dependency and ignore conditions

Bumps the production-minor-patch group with 3 updates: com.sap.cloud.sdk:sdk-bom, com.sap.cloud.sdk.datamodel:openapi-generator-maven-plugin and [com.puppycrawl.tools:checkstyle](/~https://github.com/checkstyle/checkstyle).


Updates `com.sap.cloud.sdk:sdk-bom` from 5.13.0 to 5.14.0

Updates `com.sap.cloud.sdk.datamodel:openapi-generator-maven-plugin` from 5.13.0 to 5.14.0

Updates `com.puppycrawl.tools:checkstyle` from 10.20.0 to 10.20.1
- [Release notes](/~https://github.com/checkstyle/checkstyle/releases)
- [Commits](checkstyle/checkstyle@checkstyle-10.20.0...checkstyle-10.20.1)

---
updated-dependencies:
- dependency-name: com.sap.cloud.sdk:sdk-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: production-minor-patch
- dependency-name: com.sap.cloud.sdk.datamodel:openapi-generator-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: production-minor-patch
- dependency-name: com.puppycrawl.tools:checkstyle
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: production-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Nov 11, 2024
@bot-sdk-js bot-sdk-js enabled auto-merge (squash) November 11, 2024 04:00
bot-sdk-js
bot-sdk-js previously approved these changes Nov 11, 2024
@@ -27,7 +27,7 @@
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes">
<priority>3</priority>
</rule>
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement">
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitch">
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines 255 to +257
### _"How to add a custom header to AI Core requests?"_

To add a header to AI Core requests, use the following code:

```java
ApiClient client = new AiCoreService().client().addDefaultHeader("header-key", "header-value");
DeploymentApi api = new DeploymentApi(client);
```

For more customization, creating a [HeaderProvider](https://sap.github.io/cloud-sdk/docs/java/features/connectivity/http-destinations#about-headerproviders) is also possible.
Create a [HeaderProvider](https://sap.github.io/cloud-sdk/docs/java/features/connectivity/http-destinations#about-headerproviders).
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be improved, maybe by overriding getApiClient?

@@ -182,6 +182,7 @@
<removeOperationIdPrefix>true</removeOperationIdPrefix>
<removeOperationIdPrefixDelimiter>\.</removeOperationIdPrefixDelimiter>
<removeOperationIdPrefixCount>3</removeOperationIdPrefixCount>
<aiSdkConstructor>true</aiSdkConstructor>
Copy link
Contributor

Choose a reason for hiding this comment

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

New Cloud SDK 5.14.0 feature that changes all generated client constructors

val logs =
new DeploymentApi(client.addDefaultHeader("Ai-Resource-Group", "default"))
.getLogs("d19b998f347341aa");
val logs = new DeploymentApi(aiCoreService).getLogs("d19b998f347341aa");
Copy link
Contributor

Choose a reason for hiding this comment

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

The fix is now broken

@@ -86,7 +86,7 @@ Refer to the [DeploymentController.java](../../sample-code/spring-app/src/main/j
AiDeploymentCreationResponse deployment; // provided
String deploymentId = deployment.getId();

var api = new DeploymentApi(new AiCoreService().client());
var api = new DeploymentApi();
Copy link
Contributor

Choose a reason for hiding this comment

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

User experience improvement that the new constructor allows

@CharlesDuboisSAP CharlesDuboisSAP changed the title chore: [DevOps] bump the production-minor-patch group with 3 updates Better constructor for generated clients Nov 11, 2024
@CharlesDuboisSAP CharlesDuboisSAP changed the title Better constructor for generated clients Better constructor for generated clients (Cloud SDK 5.14.0 update) Nov 11, 2024
Copy link
Contributor

@newtork newtork left a comment

Choose a reason for hiding this comment

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

lgtm

@bot-sdk-js bot-sdk-js merged commit 3b92a72 into main Nov 11, 2024
5 checks passed
@bot-sdk-js bot-sdk-js deleted the dependabot/maven/main/production-minor-patch-05abf7a640 branch November 11, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants