generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 23
fix: [OpenAPI] Introduce openapi-core-apache module
#1083
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
Open
rpanackal
wants to merge
4
commits into
main
Choose a base branch
from
fix/new-openai-core-apache
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>com.sap.cloud.sdk.datamodel</groupId> | ||
| <artifactId>openapi-parent</artifactId> | ||
| <version>5.27.0-SNAPSHOT</version> | ||
| </parent> | ||
| <artifactId>openapi-core-apache</artifactId> | ||
| <name>Data Model - OpenAPI Services - Apache Core</name> | ||
| <description>Generic OpenAPI API Core Wrapper for Apache client</description> | ||
| <url>https://sap.github.io/cloud-sdk/docs/java/getting-started</url> | ||
| <organization> | ||
| <name>SAP SE</name> | ||
| <url>https://www.sap.com</url> | ||
| </organization> | ||
| <licenses> | ||
| <license> | ||
| <name>The Apache Software License, Version 2.0</name> | ||
| <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
| </license> | ||
| </licenses> | ||
| <developers> | ||
| <developer> | ||
| <name>SAP</name> | ||
| <email>cloudsdk@sap.com</email> | ||
| <organization>SAP SE</organization> | ||
| <organizationUrl>https://www.sap.com</organizationUrl> | ||
| </developer> | ||
| </developers> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.sap.cloud.sdk.cloudplatform</groupId> | ||
| <artifactId>cloudplatform-connectivity</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.sap.cloud.sdk.cloudplatform</groupId> | ||
| <artifactId>connectivity-apache-httpclient5</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents.client5</groupId> | ||
| <artifactId>httpclient5</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.httpcomponents.core5</groupId> | ||
| <artifactId>httpcore5</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.datatype</groupId> | ||
| <artifactId>jackson-datatype-jsr310</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
| <!-- scope "provided" --> | ||
| <dependency> | ||
| <groupId>org.projectlombok</groupId> | ||
| <artifactId>lombok</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| <!-- scope "test" --> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.assertj</groupId> | ||
| <artifactId>assertj-core</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.wiremock</groupId> | ||
| <artifactId>wiremock</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-params</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../src/main/java/com/sap/cloud/sdk/services/openapi/apache/apiclient/RFC3339DateFormat.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package com.sap.cloud.sdk.services.openapi.apache.apiclient; | ||
|
|
||
| import java.text.DateFormat; | ||
| import java.text.DecimalFormat; | ||
| import java.text.FieldPosition; | ||
| import java.text.ParsePosition; | ||
| import java.util.Date; | ||
| import java.util.GregorianCalendar; | ||
| import java.util.TimeZone; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
|
||
| /** | ||
| * Date format according to the <a href="https://www.rfc-editor.org/rfc/rfc3339">RFC3339</a>. | ||
| */ | ||
| class RFC3339DateFormat extends DateFormat | ||
| { | ||
| private static final long serialVersionUID = 1L; | ||
| private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
|
|
||
| private final StdDateFormat fmt = new StdDateFormat().withTimeZone(TIMEZONE_Z).withColonInTimeZone(true); | ||
|
|
||
| /** | ||
| * Default constructor | ||
| */ | ||
| RFC3339DateFormat() | ||
| { | ||
| calendar = new GregorianCalendar(); | ||
| numberFormat = new DecimalFormat(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public Date parse( @Nonnull final String source ) | ||
| { | ||
| return parse(source, new ParsePosition(0)); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public Date parse( @Nonnull final String source, @Nonnull final ParsePosition pos ) | ||
| { | ||
| return fmt.parse(source, pos); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public StringBuffer format( | ||
| @Nonnull final Date date, | ||
| @Nonnull final StringBuffer toAppendTo, | ||
| @Nullable final FieldPosition fieldPosition ) | ||
| { | ||
| return fmt.format(date, toAppendTo, fieldPosition); | ||
| } | ||
| } |
64 changes: 64 additions & 0 deletions
64
...src/main/java/com/sap/cloud/sdk/services/openapi/apache/core/OpenApiRequestException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package com.sap.cloud.sdk.services.openapi.apache.core; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import lombok.experimental.Accessors; | ||
|
|
||
| /** | ||
| * Thrown if an error occurs during the invocation of a OpenAPI service. | ||
| */ | ||
| @Accessors( fluent = true ) | ||
| @Getter | ||
| @Setter | ||
| public class OpenApiRequestException extends RuntimeException | ||
| { | ||
| private static final long serialVersionUID = -8248392392632616674L; | ||
|
|
||
| @Nullable | ||
| private Integer statusCode; | ||
| @Nullable | ||
| private transient Map<String, List<String>> responseHeaders; | ||
| @Nullable | ||
| private transient String responseBody; | ||
|
|
||
| /** | ||
| * Thrown if an error occurs during the invocation of a OpenAPI service. | ||
| * | ||
| * @param message | ||
| * The message of this exception | ||
| */ | ||
| public OpenApiRequestException( @Nonnull final String message ) | ||
| { | ||
| super(message); | ||
| } | ||
|
|
||
| /** | ||
| * Thrown if an error occurs during the invocation of a OpenAPI service. | ||
| * | ||
| * @param message | ||
| * The message of this exception | ||
| * @param cause | ||
| * The cause of this exception | ||
| */ | ||
| public OpenApiRequestException( @Nonnull final String message, @Nonnull final Throwable cause ) | ||
| { | ||
| super(message, cause); | ||
| } | ||
|
|
||
| /** | ||
| * Thrown if an error occurs during the invocation of a OpenAPI service. | ||
| * | ||
| * @param cause | ||
| * The cause of this exception | ||
| */ | ||
| public OpenApiRequestException( @Nonnull final Throwable cause ) | ||
| { | ||
| super(cause); | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
...vices/openapi/apache/OpenApiResponse.java → .../openapi/apache/core/OpenApiResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...enapi/apache/OpenApiResponseListener.java → .../apache/core/OpenApiResponseListener.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/Major)
This is a breaking change for users that may have depended on the new classes, right?
Is this an accepted risk?
Uh oh!
There was an error while loading. Please reload this page.
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.
My assumption is that risk is very low since the newly released classes were never advertised, therefore this shouldn't be a problem.
I can also remove the
apiclientpackage and extract the classes within to the outer packagecom.sap.cloud.sdk.services.openapi. I original intention was to we keep the same module structure as inopenapi-core.This will not entirely solve the issue because classes in
corepackage eg:OpenApiResponse,OpenApiRequestExceptionwill still be affected.Do you have a different take?