-
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?
Changes from all commits
888bc4d
3473fff
7991ce9
6638e7a
c08ceb6
a697b6e
28e8135
c3e438f
c934b1f
ea0eeb6
b81f4c2
50a57bb
6a33cf6
cde369f
50a0e0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| <?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.26.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>openapi-api-apache-sample</artifactId> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>22</maven.compiler.source> | ||
| <maven.compiler.target>22</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.sap.cloud.sdk.datamodel</groupId> | ||
| <artifactId>openapi-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| </dependency> | ||
| </dependencies> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>com.sap.cloud.sdk.datamodel</groupId> | ||
| <artifactId>openapi-generator-maven-plugin</artifactId> | ||
| <configuration> | ||
| <outputDirectory>${project.basedir}/src/main/java</outputDirectory> | ||
| <enableOneOfAnyOfGeneration>true</enableOneOfAnyOfGeneration> | ||
| <deleteOutputDirectory>true</deleteOutputDirectory> | ||
| </configuration> | ||
| <executions> | ||
| <execution> | ||
| <id>sample-generation</id> | ||
| <goals> | ||
| <goal>generate</goal> | ||
| </goals> | ||
| <phase>generate-sources</phase> | ||
| <configuration> | ||
| <inputSpec>${project.basedir}/src/main/resources/sodastore.yaml</inputSpec> | ||
| <apiPackage>com.sap.cloud.sdk.datamodel.openapi.apache.sample.api</apiPackage> | ||
| <modelPackage>com.sap.cloud.sdk.datamodel.openapi.apache.sample.model</modelPackage> | ||
| <additionalProperties> | ||
| <supportingFiles>true</supportingFiles> | ||
| <invokerPackage>com.sap.cloud.sdk.services.openapi.apache</invokerPackage> | ||
| <library>apache-httpclient</library> | ||
| <supportUrlQuery>false</supportUrlQuery> | ||
| <useOneOfInterfaces>true</useOneOfInterfaces> | ||
| <enumUnknownDefaultCase>true</enumUnknownDefaultCase> | ||
| <removeOperationIdPrefix>true</removeOperationIdPrefix> | ||
| <removeOperationIdPrefixDelimiter>\.</removeOperationIdPrefixDelimiter> | ||
| <removeOperationIdPrefixCount>3</removeOperationIdPrefixCount> | ||
| <!-- Custom Cloud SDK settings --> | ||
| <pojoConstructorVisibility>protected</pojoConstructorVisibility> | ||
| <useOneOfCreators>true</useOneOfCreators> | ||
| </additionalProperties> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>net.revelc.code.formatter</groupId> | ||
| <artifactId>formatter-maven-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>format</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| <configuration> | ||
| <skip>false</skip> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>net.revelc.code</groupId> | ||
| <artifactId>impsort-maven-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>sort</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| <configuration> | ||
| <skip>false</skip> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| /* | ||
| * SodaStore API | ||
| * API for managing soda products and orders in SodaStore. | ||
| * | ||
| * | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit the class manually. | ||
| */ | ||
|
|
||
| package com.sap.cloud.sdk.datamodel.openapi.apache.sample.api; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.StringJoiner; | ||
|
|
||
| import com.fasterxml.jackson.core.type.TypeReference; | ||
| import com.sap.cloud.sdk.datamodel.openapi.apache.sample.model.Order; | ||
| import com.sap.cloud.sdk.services.openapi.apache.ApiClient; | ||
| import com.sap.cloud.sdk.services.openapi.apache.ApiException; | ||
| import com.sap.cloud.sdk.services.openapi.apache.BaseApi; | ||
| import com.sap.cloud.sdk.services.openapi.apache.Configuration; | ||
| import com.sap.cloud.sdk.services.openapi.apache.Pair; | ||
|
|
||
| public class OrdersApi extends BaseApi | ||
| { | ||
|
|
||
| public OrdersApi() | ||
| { | ||
| super(Configuration.getDefaultApiClient()); | ||
| } | ||
|
|
||
| public OrdersApi( ApiClient apiClient ) | ||
| { | ||
| super(apiClient); | ||
| } | ||
|
|
||
| /** | ||
| * Create a new order | ||
| * | ||
| * @param order | ||
| * The order details (required) | ||
| * @return Order | ||
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public Order ordersPost( @javax.annotation.Nonnull Order order ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| throws ApiException | ||
| { | ||
| return this.ordersPost(order, Collections.emptyMap()); | ||
| } | ||
|
|
||
| /** | ||
| * Create a new order | ||
| * | ||
| * @param order | ||
| * The order details (required) | ||
| * @param additionalHeaders | ||
| * additionalHeaders for this call | ||
| * @return Order | ||
| * @throws ApiException | ||
| * if fails to make API call | ||
| */ | ||
| public Order ordersPost( @javax.annotation.Nonnull Order order, Map<String, String> additionalHeaders ) | ||
| throws ApiException | ||
| { | ||
| Object localVarPostBody = order; | ||
|
|
||
| // verify the required parameter 'order' is set | ||
| if( order == null ) { | ||
| throw new ApiException(400, "Missing the required parameter 'order' when calling ordersPost"); | ||
| } | ||
|
|
||
| // create path and map variables | ||
| String localVarPath = "/orders"; | ||
|
|
||
| StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); | ||
| String localVarQueryParameterBaseName; | ||
| List<Pair> localVarQueryParams = new ArrayList<Pair>(); | ||
| List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); | ||
| Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
| Map<String, String> localVarCookieParams = new HashMap<String, String>(); | ||
| Map<String, Object> localVarFormParams = new HashMap<String, Object>(); | ||
|
|
||
| localVarHeaderParams.putAll(additionalHeaders); | ||
|
|
||
| final String[] localVarAccepts = { "application/json" }; | ||
| final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
|
|
||
| final String[] localVarContentTypes = { "application/json" }; | ||
| final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
|
||
| String[] localVarAuthNames = new String[] { "apiKeyAuth" }; | ||
|
|
||
| TypeReference<Order> localVarReturnType = new TypeReference<Order>() | ||
| { | ||
| }; | ||
| return apiClient | ||
| .invokeAPI( | ||
| localVarPath, | ||
| "POST", | ||
| localVarQueryParams, | ||
| localVarCollectionQueryParams, | ||
| localVarQueryStringJoiner.toString(), | ||
| localVarPostBody, | ||
| localVarHeaderParams, | ||
| localVarCookieParams, | ||
| localVarFormParams, | ||
| localVarAccept, | ||
| localVarContentType, | ||
| localVarAuthNames, | ||
| localVarReturnType); | ||
| } | ||
|
|
||
| @Override | ||
| public <T> T invokeAPI( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) |
||
| String url, | ||
| String method, | ||
| Object request, | ||
| TypeReference<T> returnType, | ||
| Map<String, String> additionalHeaders ) | ||
| throws ApiException | ||
| { | ||
| String localVarPath = url.replace(apiClient.getBaseURL(), ""); | ||
| StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); | ||
| List<Pair> localVarQueryParams = new ArrayList<Pair>(); | ||
| List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); | ||
| Map<String, String> localVarHeaderParams = new HashMap<String, String>(); | ||
| Map<String, String> localVarCookieParams = new HashMap<String, String>(); | ||
| Map<String, Object> localVarFormParams = new HashMap<String, Object>(); | ||
|
|
||
| localVarHeaderParams.putAll(additionalHeaders); | ||
|
|
||
| final String[] localVarAccepts = { "application/json" }; | ||
| final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); | ||
|
|
||
| final String[] localVarContentTypes = { "application/json" }; | ||
| final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); | ||
|
|
||
| String[] localVarAuthNames = new String[] { "apiKeyAuth" }; | ||
|
|
||
| return apiClient | ||
| .invokeAPI( | ||
| localVarPath, | ||
| method, | ||
| localVarQueryParams, | ||
| localVarCollectionQueryParams, | ||
| localVarQueryStringJoiner.toString(), | ||
| request, | ||
| localVarHeaderParams, | ||
| localVarCookieParams, | ||
| localVarFormParams, | ||
| localVarAccept, | ||
| localVarContentType, | ||
| localVarAuthNames, | ||
| returnType); | ||
| } | ||
| } | ||
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