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

@@ -95,8 +95,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"
threetenbp_version = "2.9.10"
resteasy_version = "3.1.3.Final"

View File

@@ -13,9 +13,9 @@ lazy val root = (project in file(".")).
"org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final" % "compile",
"org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final" % "compile",
"org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final" % "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.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile",
"joda-time" % "joda-time" % "2.9.9" % "compile",

View File

@@ -142,7 +142,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>
@@ -243,8 +246,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.22</swagger-annotations-version>
<resteasy-version>3.1.3.Final</resteasy-version>
<jackson-version>2.10.1</jackson-version>
<jackson-databind-version>2.10.1</jackson-databind-version>
<jackson-version>2.10.3</jackson-version>
<jackson-databind-version>2.10.3</jackson-databind-version>
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
<threetenbp-version>2.9.10</threetenbp-version>
<jodatime-version>2.9.9</jodatime-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;
}
}