-
Notifications
You must be signed in to change notification settings - Fork 21
refactor: [OpenAPI] Refactor Apache related files and templates #1048
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: feat/openapi/optional-spring-base
Are you sure you want to change the base?
refactor: [OpenAPI] Refactor Apache related files and templates #1048
Conversation
- no more shared client in *Api.java instances
… apiclient package
- *Api.invoke method bugged and unused
- Remove debugging, connectionTimeout, defaultHeaderMap, defaultCookieMap - add TODOs - public setBasePath - Remove addDefaultHeader, setUserAgent,
- Make as manny methods static - Remove deprecated getStatusCode and getResponseHeaders - public parameterToPairs
- Make as many methods static - rename ApiClientResponseHandler to DefaultApiResponseHandler - finish up ApiClient todos
- Enhance JavaDoc - Support Vendor extension `x-sap-cloud-sdk-operation-name`
- Method overloading for required and options param in operations
- final on local vars
| return this; | ||
| } | ||
| return fromHttpClient((CloseableHttpClient) ApacheHttpClient5Accessor.getHttpClient(destination)) | ||
| .withBasePath(destination.asHttp().getUri().toString()); |
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)
I'm not sure whether the following is unnecessary: withBasePath(destination.asHttp().getUri().toString())
unit tests will show.
| import lombok.Value; | ||
| import lombok.With; | ||
|
|
||
| @Value |
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)
Happy about making it an immuatable class!
Unfortunately it's final implicitly, meaning it can never be customized e.g. for future workarounds. Potential solution could be non-value or introduction of interface.
| protected DateFormat dateFormat; | ||
| @With | ||
| @Nullable | ||
| String tempFolderPath; |
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)
You mentioned you want this field to have public getter (?)
| * {{#appDescription}}{{{appDescription}}}{{/appDescription}}{{^appDescription}}No description provided.{{/appDescription}} | ||
| */ | ||
| {{!>generatedAnnotation}} | ||
| {{^isReleased}}@Beta{{/isReleased}} |
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)
Please use fully-qualified-name for optional (deendency) anotations, e.g.
@com.google.common.annotations.Beta
Context
SAP/cloud-sdk-java-backlog#464.
The parent PR contains all files as they would be if we purely relied on generation via OpenAPI code generator with commonly generated files packages with
openapi-coremodule.The scope of this PR is to reduce public API, achieve feature parity with resttemplate based generation and refactoring code for readability.
Feature scope:
auth/*.javafiles - We support authentication via destinationApiExceptionremoved in favour existingOpenApiRequestException(modified)ServerConfiguration,ServerVariable,StringUtilremoved as we do not support single client instance pointing to multi urlsapiClient/RFC3339DateFormatBaseApiImprovements in
ApiClientdefaultHeaderMaps: headers expected to be set request level, destination header provider or customClosableHttpClientdefaultCookieMap: no cookie supportservers,serverIndex,serverVariables: only singlebaseUrlsupportlastStatusCode,lastResponseHeaders: Removed due to feature engineering concerns. To compensate, new api introduced inOpenApiRequestException.debuggingflag,connectionTimeout: useless and to be configured elsewhere.cookieParamsandauthNamesthat sets request level configuration for cookies and authorization (but unused) are removed frominvokeAPIsignature@Betaon jackson exposing apistaticDefaultApiResponseHandlerFeature Parity with resttemplate (template modifications)
finalon local vars, parameters, returns as appropriate.x-sap-cloud-sdk-operation-name,x-return-nullableapache/OpenApiResponseinstead ofvoidas return type for remote calls. Existingcore/OpenApiResponsehas Spring components in public contract. 😿Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated