Merge remote-tracking branch 'origin/master' into 5.0-sync-master

This commit is contained in:
William Cheng
2020-04-17 15:51:00 +08:00
4730 changed files with 208746 additions and 53119 deletions

View File

@@ -1 +1,5 @@
5.0.0-SNAPSHOT
<<<<<<< HEAD
5.0.0-SNAPSHOT
=======
4.3.1-SNAPSHOT
>>>>>>> origin/master

File diff suppressed because it is too large Load Diff

View File

@@ -96,8 +96,8 @@ if(hasProperty('target') && target == 'android') {
ext {
swagger_annotations_version = "1.5.22"
jackson_version = "2.10.1"
jackson_databind_version = "2.10.1"
jackson_version = "2.10.3"
jackson_databind_version = "2.10.3"
jackson_databind_nullable_version = "0.2.1"
jackson_threetenbp_version = "2.9.10"
feign_version = "9.7.0"

View File

@@ -14,9 +14,9 @@ lazy val root = (project in file(".")).
"io.github.openfeign" % "feign-jackson" % "9.7.0" % "compile",
"io.github.openfeign" % "feign-slf4j" % "9.7.0" % "compile",
"io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile",
"com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",

View File

@@ -135,7 +135,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.1.1</version>
<configuration>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -281,9 +284,9 @@
<swagger-annotations-version>1.5.21</swagger-annotations-version>
<feign-version>9.7.0</feign-version>
<feign-form-version>2.1.0</feign-form-version>
<jackson-version>2.10.1</jackson-version>
<jackson-version>2.10.3</jackson-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<jackson-databind-version>2.10.1</jackson-databind-version>
<jackson-databind-version>2.10.3</jackson-databind-version>
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
<junit-version>4.13</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -0,0 +1,58 @@
package org.openapitools.client;
import java.util.Map;
/**
* Representing a Server configuration.
*/
public class ServerConfiguration {
public String URL;
public String description;
public Map<String, ServerVariable> variables;
/**
* @param URL A URL to the target host.
* @param description A describtion of the host designated by the URL.
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
*/
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
this.URL = URL;
this.description = description;
this.variables = variables;
}
/**
* Format URL template using given variables.
*
* @param variables A map between a variable name and its value.
* @return Formatted URL.
*/
public String URL(Map<String, String> variables) {
String url = this.URL;
// go through variables and replace placeholders
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
String name = variable.getKey();
ServerVariable serverVariable = variable.getValue();
String value = serverVariable.defaultValue;
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replaceAll("\\{" + name + "\\}", value);
}
return url;
}
/**
* Format URL template using default server variables.
*
* @return Formatted URL.
*/
public String URL() {
return URL(null);
}
}

View File

@@ -0,0 +1,23 @@
package org.openapitools.client;
import java.util.HashSet;
/**
* Representing a Server Variable for server URL template substitution.
*/
public class ServerVariable {
public String description;
public String defaultValue;
public HashSet<String> enumValues = null;
/**
* @param description A description for the server variable.
* @param defaultValue The default value to use for substitution.
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
*/
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
this.description = description;
this.defaultValue = defaultValue;
this.enumValues = enumValues;
}
}

View File

@@ -181,7 +181,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
void testEndpointParameters(@Param("number") BigDecimal number, @Param("double") Double _double, @Param("pattern_without_delimiter") String patternWithoutDelimiter, @Param("byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("callback") String paramCallback);
void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
/**
* To test enum parameters
@@ -203,7 +203,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
void testEnumParameters(@Param("enum_header_string_array") List<String> enumHeaderStringArray, @Param("enum_header_string") String enumHeaderString, @Param("enum_query_string_array") List<String> enumQueryStringArray, @Param("enum_query_string") String enumQueryString, @Param("enum_query_integer") Integer enumQueryInteger, @Param("enum_query_double") Double enumQueryDouble, @Param("enum_form_string_array") List<String> enumFormStringArray, @Param("enum_form_string") String enumFormString);
void testEnumParameters(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
/**
* To test enum parameters
@@ -234,7 +234,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
void testEnumParameters(@Param("enum_header_string_array") List<String> enumHeaderStringArray, @Param("enum_header_string") String enumHeaderString, @Param("enum_form_string_array") List<String> enumFormStringArray, @Param("enum_form_string") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
void testEnumParameters(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
* A convenience class for generating query parameters for the
@@ -276,7 +276,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
void testGroupParameters(@Param("required_string_group") Integer requiredStringGroup, @Param("required_boolean_group") Boolean requiredBooleanGroup, @Param("required_int64_group") Long requiredInt64Group, @Param("string_group") Integer stringGroup, @Param("boolean_group") Boolean booleanGroup, @Param("int64_group") Long int64Group);
void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
/**
* Fake endpoint to test group parameters (optional)
@@ -304,7 +304,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
void testGroupParameters(@Param("required_boolean_group") Boolean requiredBooleanGroup, @Param("boolean_group") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
* A convenience class for generating query parameters for the

View File

@@ -40,7 +40,7 @@ public interface PetApi extends ApiClient.Api {
"Accept: application/json",
"api_key: {apiKey}"
})
void deletePet(@Param("petId") Long petId, @Param("api_key") String apiKey);
void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey);
/**
* Finds Pets by status

View File

@@ -24,7 +24,7 @@ public interface StoreApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
void deleteOrder(@Param("order_id") String orderId);
void deleteOrder(@Param("orderId") String orderId);
/**
* Returns pet inventories by status
@@ -47,7 +47,7 @@ public interface StoreApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
Order getOrderById(@Param("order_id") Long orderId);
Order getOrderById(@Param("orderId") Long orderId);
/**
* Place an order for a pet

View File

@@ -80,14 +80,14 @@ public class OAuth implements RequestInterceptor {
}
// If first time, get the token
if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) {
updateAccessToken();
updateAccessToken(template);
}
if (getAccessToken() != null) {
template.header("Authorization", "Bearer " + getAccessToken());
}
}
public synchronized void updateAccessToken() {
public synchronized void updateAccessToken(RequestTemplate template) {
OAuthJSONAccessTokenResponse accessTokenResponse;
try {
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());