-
Notifications
You must be signed in to change notification settings - Fork 21
feat: [OpenAPI] Make Spring Optional with Apache HttpClient #1046
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
base: main
Are you sure you want to change the base?
Conversation
f47b1db to
cde369f
Compare
| public class OrdersApi extends BaseApi | ||
| { | ||
|
|
||
| public OrdersApi() |
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.
(Major)
Destination constructor missing
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public Order ordersPost( @javax.annotation.Nonnull Order order ) |
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.
(Question/Optional)
It may be worth our time to check for alternatives to javax.annotation.Nonnull null-indicator annotations.
| } | ||
|
|
||
| @Override | ||
| public <T> T invokeAPI( |
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.
(Major)
I think we would prefer not to have this method public. (for now)
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id, Map<String, String> additionalHeaders ) |
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.
(Major)
I think we would prefer not have additional (public) headers-method.
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public File sodasDownloadIdGet( @javax.annotation.Nonnull Long id ) |
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.
(Question/Minor)
For better comparison, would you consider offering your byte[] fix here 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.
(Additionally)
The method is not returning @Nonnull annotation on result (?)
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public List<SodaWithId> sodasGet() |
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.
(Minor)
Missing @Nonnull or is this deliberate
| } | ||
| return o.toString().replace("\n", "\n "); | ||
| } | ||
|
|
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.
(Major)
Your model classes are missing static factory method(s)? Is this deliberate - or unwanted side-effect?
public static Fanta create()
{
return new Fanta();
}
| return apiClient; | ||
| } | ||
|
|
||
| public void setApiClient( ApiClient apiClient ) |
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.
(Major)
We do not want mutable api-client (for now).
All the other methods of this class need some alignment too.
Context
SAP/cloud-sdk-java-backlog#464.
There are two objectives to this PR
apache-httpclienttemplate based code generation. We will (soon) remove a large chunk of introduced files, reduce public API and even refactor code.To maintain backward compatibility Spring framework dependencies are marked optional but template files, or any public API are still maintained without any changes.
Feature scope:
com.sap.cloud.sdk.services.openapi.apachewithApiClient,BaseApiand other supporting classes addedopenapi-api-apache-samplemodule as e2e test with sample code generation with apache/ApiClientDefinition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated