Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-03-28 10:37:19 +08:00
87 changed files with 991 additions and 1057 deletions

View File

@@ -30,5 +30,5 @@ ags="$@ generate -t modules/swagger-codegen/src/main/resources/MSF4J -i modules/
echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main"
rm -rf samples/server/petstore/java-msf4j/src/main
find samples/server/petstore/java-msf4j -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
find samples/server/petstore/java-msf4j -maxdepth 1 -type f ! -name "README.md" ! -name "pom.xml" ! -name "mvn_test_jdk8_only.sh" ! -name ".swagger-codegen-ignore" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags

View File

@@ -42,324 +42,324 @@ import java.util.Map;
public class ApiClient {
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
{{#hasAuthMethods}}
Interceptor auth;
{{#authMethods}}if ("{{name}}".equals(authName)) {
{{#isBasic}}
auth = new HttpBasicAuth();
{{/isBasic}}
{{#isApiKey}}
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
{{/isApiKey}}
{{#isOAuth}}
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
{{/isOAuth}}
} else {{/authMethods}}{
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
{{/hasAuthMethods}}
{{^hasAuthMethods}}
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
{{/hasAuthMethods}}
}
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
{{#hasAuthMethods}}
Interceptor auth;
{{#authMethods}}if ("{{name}}".equals(authName)) {
{{#isBasic}}
auth = new HttpBasicAuth();
{{/isBasic}}
{{#isApiKey}}
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
{{/isApiKey}}
{{#isOAuth}}
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
{{/isOAuth}}
} else {{/authMethods}}{
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
{{/hasAuthMethods}}
{{^hasAuthMethods}}
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
{{/hasAuthMethods}}
}
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
String baseUrl = "{{{basePath}}}";
if (!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
String baseUrl = "{{{basePath}}}";
if(!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
{{#useRxJava}}
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
{{/useRxJava}}{{#useRxJava2}}
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
{{/useRxJava2}}
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
{{#useRxJava}}
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
{{/useRxJava}}{{#useRxJava2}}
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
{{/useRxJava2}}
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
return this;
}
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
return this;
}
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
{{#joda}}
public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setDateTimeFormat(dateFormat);
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
return this;
}
{{/joda}}
{{#jsr310}}
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
return this;
}
{{/jsr310}}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
return this;
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
{{#joda}}
public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setDateTimeFormat(dateFormat);
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
{{/joda}}
{{#jsr310}}
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
}
{{/jsr310}}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
return this;
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
return this;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
}
/**
@@ -368,50 +368,51 @@ public class ApiClient {
* expected type is String, then just return the body string.
*/
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
private final Gson gson;
private final Type type;
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
}
class GsonCustomConverterFactory extends Converter.Factory
{
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null)
throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if(type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if (type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
}

View File

@@ -35,13 +35,16 @@ public interface {{classname}} {
{{/allParams}}
* @return Call&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object{{/returnType}}&gt;
*/
{{#formParams}}{{#-first}}
{{#isMultipart}}@retrofit2.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit2.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}}
{{#formParams}}
{{#-first}}
{{#isMultipart}}@retrofit2.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit2.http.FormUrlEncoded{{/isMultipart}}
{{/-first}}
{{/formParams}}
{{^formParams}}
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{mediaType}}"
})
{{/-first}}
{{/prioritizedContentTypes}}

View File

@@ -199,7 +199,7 @@ this.{{name}} = {{name}};
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{ {{#vars}}{{#hasValidation}}{{#maxLength}}

View File

@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}.Release|Any CPU.Build.0 = Release|Any CPU
{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -12,7 +12,7 @@ Contact: apiteam@swagger.io
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D23EBB29-C5C8-4000-BF1B-B91E26DD19DB}</ProjectGuid>
<ProjectGuid>{B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IO.Swagger</RootNamespace>

View File

@@ -130,7 +130,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -151,7 +151,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -101,7 +101,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -145,7 +145,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -145,7 +145,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -191,7 +191,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -166,7 +166,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -130,7 +130,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -166,7 +166,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -171,7 +171,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -226,7 +226,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -332,7 +332,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -127,7 +127,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -151,7 +151,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -145,7 +145,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -130,7 +130,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -169,7 +169,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -226,7 +226,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -239,7 +239,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -128,7 +128,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -115,7 +115,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -130,7 +130,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -221,7 +221,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{05E9062F-6473-433C-92E3-F7EF63B6A0CB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{6C01F92F-3611-4F84-AC86-927E3625E0A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{05E9062F-6473-433C-92E3-F7EF63B6A0CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05E9062F-6473-433C-92E3-F7EF63B6A0CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05E9062F-6473-433C-92E3-F7EF63B6A0CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05E9062F-6473-433C-92E3-F7EF63B6A0CB}.Release|Any CPU.Build.0 = Release|Any CPU
{6C01F92F-3611-4F84-AC86-927E3625E0A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C01F92F-3611-4F84-AC86-927E3625E0A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C01F92F-3611-4F84-AC86-927E3625E0A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C01F92F-3611-4F84-AC86-927E3625E0A8}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -74,7 +74,7 @@ Contact: apiteam@swagger.io
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
<Project>{05E9062F-6473-433C-92E3-F7EF63B6A0CB}</Project>
<Project>{6C01F92F-3611-4F84-AC86-927E3625E0A8}</Project>
<Name>IO.Swagger</Name>
</ProjectReference>
</ItemGroup>

View File

@@ -12,7 +12,7 @@ Contact: apiteam@swagger.io
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{05E9062F-6473-433C-92E3-F7EF63B6A0CB}</ProjectGuid>
<ProjectGuid>{6C01F92F-3611-4F84-AC86-927E3625E0A8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IO.Swagger</RootNamespace>

View File

@@ -153,7 +153,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -174,7 +174,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -124,7 +124,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -168,7 +168,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -168,7 +168,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -214,7 +214,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -189,7 +189,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -153,7 +153,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -189,7 +189,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -194,7 +194,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -249,7 +249,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -355,7 +355,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -150,7 +150,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -174,7 +174,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -168,7 +168,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -153,7 +153,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -192,7 +192,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -249,7 +249,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -262,7 +262,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -151,7 +151,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -138,7 +138,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -153,7 +153,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -244,7 +244,7 @@ namespace IO.Swagger.Model
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContex">Validation context</param>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{

View File

@@ -29,9 +29,8 @@ public interface FakeApi {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake")
F.Promise<Response<Client>> testClientModel(
@@ -57,7 +56,6 @@ public interface FakeApi {
* @param paramCallback None (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("fake")
F.Promise<Response<Void>> testEndpointParameters(
@@ -77,7 +75,6 @@ public interface FakeApi {
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@GET("fake")
F.Promise<Response<Void>> testEnumParameters(

View File

@@ -26,9 +26,8 @@ public interface FakeClassnameTags123Api {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake_classname_test")
F.Promise<Response<Client>> testClassname(

View File

@@ -28,9 +28,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@POST("pet")
F.Promise<Response<Void>> addPet(
@@ -44,7 +43,6 @@ public interface PetApi {
* @param apiKey (optional)
* @return Call&lt;Void&gt;
*/
@DELETE("pet/{petId}")
F.Promise<Response<Void>> deletePet(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Header("api_key") String apiKey
@@ -56,7 +54,6 @@ public interface PetApi {
* @param status Status values that need to be considered for filter (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByStatus")
F.Promise<Response<List<Pet>>> findPetsByStatus(
@retrofit2.http.Query("status") CSVParams status
@@ -68,7 +65,6 @@ public interface PetApi {
* @param tags Tags to filter by (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByTags")
F.Promise<Response<List<Pet>>> findPetsByTags(
@retrofit2.http.Query("tags") CSVParams tags
@@ -80,7 +76,6 @@ public interface PetApi {
* @param petId ID of pet to return (required)
* @return Call&lt;Pet&gt;
*/
@GET("pet/{petId}")
F.Promise<Response<Pet>> getPetById(
@retrofit2.http.Path("petId") Long petId
@@ -92,9 +87,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PUT("pet")
F.Promise<Response<Void>> updatePet(
@@ -109,7 +103,6 @@ public interface PetApi {
* @param status Updated status of the pet (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("pet/{petId}")
F.Promise<Response<Void>> updatePetWithForm(
@@ -124,7 +117,6 @@ public interface PetApi {
* @param file file to upload (optional)
* @return Call&lt;ModelApiResponse&gt;
*/
@retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage")
F.Promise<Response<ModelApiResponse>> uploadFile(

View File

@@ -26,7 +26,6 @@ public interface StoreApi {
* @param orderId ID of the order that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("store/order/{orderId}")
F.Promise<Response<Void>> deleteOrder(
@retrofit2.http.Path("orderId") String orderId
@@ -37,7 +36,6 @@ public interface StoreApi {
* Returns a map of status codes to quantities
* @return Call&lt;Map&lt;String, Integer&gt;&gt;
*/
@GET("store/inventory")
F.Promise<Response<Map<String, Integer>>> getInventory();
@@ -48,7 +46,6 @@ public interface StoreApi {
* @param orderId ID of pet that needs to be fetched (required)
* @return Call&lt;Order&gt;
*/
@GET("store/order/{orderId}")
F.Promise<Response<Order>> getOrderById(
@retrofit2.http.Path("orderId") Long orderId
@@ -60,7 +57,6 @@ public interface StoreApi {
* @param body order placed for purchasing the pet (required)
* @return Call&lt;Order&gt;
*/
@POST("store/order")
F.Promise<Response<Order>> placeOrder(
@retrofit2.http.Body Order body

View File

@@ -26,7 +26,6 @@ public interface UserApi {
* @param body Created user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user")
F.Promise<Response<Void>> createUser(
@retrofit2.http.Body User body
@@ -38,7 +37,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithArray")
F.Promise<Response<Void>> createUsersWithArrayInput(
@retrofit2.http.Body List<User> body
@@ -50,7 +48,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithList")
F.Promise<Response<Void>> createUsersWithListInput(
@retrofit2.http.Body List<User> body
@@ -62,7 +59,6 @@ public interface UserApi {
* @param username The name that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("user/{username}")
F.Promise<Response<Void>> deleteUser(
@retrofit2.http.Path("username") String username
@@ -74,7 +70,6 @@ public interface UserApi {
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt;
*/
@GET("user/{username}")
F.Promise<Response<User>> getUserByName(
@retrofit2.http.Path("username") String username
@@ -87,7 +82,6 @@ public interface UserApi {
* @param password The password for login in clear text (required)
* @return Call&lt;String&gt;
*/
@GET("user/login")
F.Promise<Response<String>> loginUser(
@retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password
@@ -98,7 +92,6 @@ public interface UserApi {
*
* @return Call&lt;Void&gt;
*/
@GET("user/logout")
F.Promise<Response<Void>> logoutUser();
@@ -110,7 +103,6 @@ public interface UserApi {
* @param body Updated user object (required)
* @return Call&lt;Void&gt;
*/
@PUT("user/{username}")
F.Promise<Response<Void>> updateUser(
@retrofit2.http.Path("username") String username, @retrofit2.http.Body User body

View File

@@ -28,296 +28,296 @@ import java.util.Map;
public class ApiClient {
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
Interceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
}
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
Interceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
}
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
String baseUrl = "http://petstore.swagger.io/v2";
if (!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
String baseUrl = "http://petstore.swagger.io/v2";
if(!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
return this;
}
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
return this;
}
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
return this;
}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
return this;
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
}
/**
@@ -326,50 +326,51 @@ public class ApiClient {
* expected type is String, then just return the body string.
*/
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
private final Gson gson;
private final Type type;
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
}
class GsonCustomConverterFactory extends Converter.Factory
{
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null)
throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if(type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if (type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
}

View File

@@ -27,9 +27,8 @@ public interface FakeApi {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake")
Call<Client> testClientModel(
@@ -55,7 +54,6 @@ public interface FakeApi {
* @param paramCallback None (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("fake")
Call<Void> testEndpointParameters(
@@ -75,7 +73,6 @@ public interface FakeApi {
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@GET("fake")
Call<Void> testEnumParameters(

View File

@@ -24,9 +24,8 @@ public interface FakeClassnameTags123Api {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake_classname_test")
Call<Client> testClassname(

View File

@@ -26,9 +26,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@POST("pet")
Call<Void> addPet(
@@ -42,7 +41,6 @@ public interface PetApi {
* @param apiKey (optional)
* @return Call&lt;Void&gt;
*/
@DELETE("pet/{petId}")
Call<Void> deletePet(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Header("api_key") String apiKey
@@ -54,7 +52,6 @@ public interface PetApi {
* @param status Status values that need to be considered for filter (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByStatus")
Call<List<Pet>> findPetsByStatus(
@retrofit2.http.Query("status") CSVParams status
@@ -66,7 +63,6 @@ public interface PetApi {
* @param tags Tags to filter by (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByTags")
Call<List<Pet>> findPetsByTags(
@retrofit2.http.Query("tags") CSVParams tags
@@ -78,7 +74,6 @@ public interface PetApi {
* @param petId ID of pet to return (required)
* @return Call&lt;Pet&gt;
*/
@GET("pet/{petId}")
Call<Pet> getPetById(
@retrofit2.http.Path("petId") Long petId
@@ -90,9 +85,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PUT("pet")
Call<Void> updatePet(
@@ -107,7 +101,6 @@ public interface PetApi {
* @param status Updated status of the pet (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("pet/{petId}")
Call<Void> updatePetWithForm(
@@ -122,7 +115,6 @@ public interface PetApi {
* @param file file to upload (optional)
* @return Call&lt;ModelApiResponse&gt;
*/
@retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage")
Call<ModelApiResponse> uploadFile(

View File

@@ -24,7 +24,6 @@ public interface StoreApi {
* @param orderId ID of the order that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("store/order/{orderId}")
Call<Void> deleteOrder(
@retrofit2.http.Path("orderId") String orderId
@@ -35,7 +34,6 @@ public interface StoreApi {
* Returns a map of status codes to quantities
* @return Call&lt;Map&lt;String, Integer&gt;&gt;
*/
@GET("store/inventory")
Call<Map<String, Integer>> getInventory();
@@ -46,7 +44,6 @@ public interface StoreApi {
* @param orderId ID of pet that needs to be fetched (required)
* @return Call&lt;Order&gt;
*/
@GET("store/order/{orderId}")
Call<Order> getOrderById(
@retrofit2.http.Path("orderId") Long orderId
@@ -58,7 +55,6 @@ public interface StoreApi {
* @param body order placed for purchasing the pet (required)
* @return Call&lt;Order&gt;
*/
@POST("store/order")
Call<Order> placeOrder(
@retrofit2.http.Body Order body

View File

@@ -24,7 +24,6 @@ public interface UserApi {
* @param body Created user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user")
Call<Void> createUser(
@retrofit2.http.Body User body
@@ -36,7 +35,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithArray")
Call<Void> createUsersWithArrayInput(
@retrofit2.http.Body List<User> body
@@ -48,7 +46,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithList")
Call<Void> createUsersWithListInput(
@retrofit2.http.Body List<User> body
@@ -60,7 +57,6 @@ public interface UserApi {
* @param username The name that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("user/{username}")
Call<Void> deleteUser(
@retrofit2.http.Path("username") String username
@@ -72,7 +68,6 @@ public interface UserApi {
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt;
*/
@GET("user/{username}")
Call<User> getUserByName(
@retrofit2.http.Path("username") String username
@@ -85,7 +80,6 @@ public interface UserApi {
* @param password The password for login in clear text (required)
* @return Call&lt;String&gt;
*/
@GET("user/login")
Call<String> loginUser(
@retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password
@@ -96,7 +90,6 @@ public interface UserApi {
*
* @return Call&lt;Void&gt;
*/
@GET("user/logout")
Call<Void> logoutUser();
@@ -108,7 +101,6 @@ public interface UserApi {
* @param body Updated user object (required)
* @return Call&lt;Void&gt;
*/
@PUT("user/{username}")
Call<Void> updateUser(
@retrofit2.http.Path("username") String username, @retrofit2.http.Body User body

View File

@@ -29,297 +29,297 @@ import java.util.Map;
public class ApiClient {
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
private Map<String, Interceptor> apiAuthorizations;
private OkHttpClient.Builder okBuilder;
private Retrofit.Builder adapterBuilder;
private JSON json;
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
public ApiClient() {
apiAuthorizations = new LinkedHashMap<String, Interceptor>();
createDefaultAdapter();
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
Interceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
}
}
public ApiClient(String[] authNames) {
this();
for(String authName : authNames) {
Interceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}
addAuthorization(authName, auth);
}
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Basic constructor for single auth name
* @param authName Authentication name
*/
public ApiClient(String authName) {
this(new String[]{authName});
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single api key
* @param authName Authentication name
* @param apiKey API key
*/
public ApiClient(String authName, String apiKey) {
this(authName);
this.setApiKey(apiKey);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single basic auth or password oauth2
* @param authName Authentication name
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String username, String password) {
this(authName);
this.setCredentials(username, password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
/**
* Helper constructor for single password oauth2
* @param authName Authentication name
* @param clientId Client ID
* @param secret Client Secret
* @param username Username
* @param password Password
*/
public ApiClient(String authName, String clientId, String secret, String username, String password) {
this(authName);
this.getTokenEndPoint()
.setClientId(clientId)
.setClientSecret(secret)
.setUsername(username)
.setPassword(password);
}
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
public void createDefaultAdapter() {
json = new JSON();
okBuilder = new OkHttpClient.Builder();
String baseUrl = "http://petstore.swagger.io/v2";
if (!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
String baseUrl = "http://petstore.swagger.io/v2";
if(!baseUrl.endsWith("/"))
baseUrl = baseUrl + "/";
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
adapterBuilder = new Retrofit
.Builder()
.baseUrl(baseUrl)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonCustomConverterFactory.create(json.getGson()));
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
}
public <S> S createService(Class<S> serviceClass) {
return adapterBuilder
.client(okBuilder.build())
.build()
.create(serviceClass);
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
return this;
}
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
return this;
}
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
return this;
}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
return this;
}
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
return this;
}
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
/**
* Helper method to configure the first api key found
* @param apiKey API key
* @return ApiClient
*/
public ApiClient setApiKey(String apiKey) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof ApiKeyAuth) {
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
keyAuth.setApiKey(apiKey);
return this;
}
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
/**
* Helper method to configure the username/password for basic auth or password oauth
* @param username Username
* @param password Password
* @return ApiClient
*/
public ApiClient setCredentials(String username, String password) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof HttpBasicAuth) {
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
basicAuth.setCredentials(username, password);
return this;
}
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
return this;
}
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
}
/**
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Token request builder
*/
public TokenRequestBuilder getTokenEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getTokenRequestBuilder();
}
}
return null;
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
/**
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
* @return Authentication request builder
*/
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
return oauth.getAuthenticationRequestBuilder();
}
}
return null;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
}
/**
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
* @param accessToken Access token
* @return ApiClient
*/
public ApiClient setAccessToken(String accessToken) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.setAccessToken(accessToken);
return this;
}
}
return this;
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
/**
* Helper method to configure the oauth accessCode/implicit flow parameters
* @param clientId Client ID
* @param clientSecret Client secret
* @param redirectURI Redirect URI
* @return ApiClient
*/
public ApiClient configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.getTokenRequestBuilder()
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
oauth.getAuthenticationRequestBuilder()
.setClientId(clientId)
.setRedirectURI(redirectURI);
return this;
}
}
return this;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
/**
* Configures a listener which is notified when a new access token is received.
* @param accessTokenListener Access token listener
* @return ApiClient
*/
public ApiClient registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
if (apiAuthorization instanceof OAuth) {
OAuth oauth = (OAuth) apiAuthorization;
oauth.registerAccessTokenListener(accessTokenListener);
return this;
}
}
return this;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
/**
* Adds an authorization to be used by the client
* @param authName Authentication name
* @param authorization Authorization interceptor
* @return ApiClient
*/
public ApiClient addAuthorization(String authName, Interceptor authorization) {
if (apiAuthorizations.containsKey(authName)) {
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
}
apiAuthorizations.put(authName, authorization);
okBuilder.addInterceptor(authorization);
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
public Map<String, Interceptor> getApiAuthorizations() {
return apiAuthorizations;
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
public ApiClient setApiAuthorizations(Map<String, Interceptor> apiAuthorizations) {
this.apiAuthorizations = apiAuthorizations;
return this;
}
public Retrofit.Builder getAdapterBuilder() {
return adapterBuilder;
}
public ApiClient setAdapterBuilder(Retrofit.Builder adapterBuilder) {
this.adapterBuilder = adapterBuilder;
return this;
}
public OkHttpClient.Builder getOkBuilder() {
return okBuilder;
}
public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) {
for(Interceptor apiAuthorization : apiAuthorizations.values()) {
okBuilder.addInterceptor(apiAuthorization);
}
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
/**
* Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit
* @param okClient An instance of OK HTTP client
*/
public void configureFromOkclient(OkHttpClient okClient) {
this.okBuilder = okClient.newBuilder();
addAuthsToOkBuilder(this.okBuilder);
}
}
/**
@@ -328,50 +328,51 @@ public class ApiClient {
* expected type is String, then just return the body string.
*/
class GsonResponseBodyConverterToString<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final Type type;
private final Gson gson;
private final Type type;
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
GsonResponseBodyConverterToString(Gson gson, Type type) {
this.gson = gson;
this.type = type;
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
@Override public T convert(ResponseBody value) throws IOException {
String returned = value.string();
try {
return gson.fromJson(returned, type);
}
catch (JsonParseException e) {
return (T) returned;
}
}
}
class GsonCustomConverterFactory extends Converter.Factory
{
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
private final Gson gson;
private final GsonConverterFactory gsonConverterFactory;
public static GsonCustomConverterFactory create(Gson gson) {
return new GsonCustomConverterFactory(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null) throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
private GsonCustomConverterFactory(Gson gson) {
if (gson == null)
throw new NullPointerException("gson == null");
this.gson = gson;
this.gsonConverterFactory = GsonConverterFactory.create(gson);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if(type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
if (type.equals(String.class))
return new GsonResponseBodyConverterToString<Object>(gson, type);
else
return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit);
}
}

View File

@@ -27,9 +27,8 @@ public interface FakeApi {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake")
Observable<Client> testClientModel(
@@ -55,7 +54,6 @@ public interface FakeApi {
* @param paramCallback None (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("fake")
Observable<Void> testEndpointParameters(
@@ -75,7 +73,6 @@ public interface FakeApi {
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@GET("fake")
Observable<Void> testEnumParameters(

View File

@@ -24,9 +24,8 @@ public interface FakeClassnameTags123Api {
* @param body client model (required)
* @return Call&lt;Client&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PATCH("fake_classname_test")
Observable<Client> testClassname(

View File

@@ -26,9 +26,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@POST("pet")
Observable<Void> addPet(
@@ -42,7 +41,6 @@ public interface PetApi {
* @param apiKey (optional)
* @return Call&lt;Void&gt;
*/
@DELETE("pet/{petId}")
Observable<Void> deletePet(
@retrofit2.http.Path("petId") Long petId, @retrofit2.http.Header("api_key") String apiKey
@@ -54,7 +52,6 @@ public interface PetApi {
* @param status Status values that need to be considered for filter (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByStatus")
Observable<List<Pet>> findPetsByStatus(
@retrofit2.http.Query("status") CSVParams status
@@ -66,7 +63,6 @@ public interface PetApi {
* @param tags Tags to filter by (required)
* @return Call&lt;List&lt;Pet&gt;&gt;
*/
@GET("pet/findByTags")
Observable<List<Pet>> findPetsByTags(
@retrofit2.http.Query("tags") CSVParams tags
@@ -78,7 +74,6 @@ public interface PetApi {
* @param petId ID of pet to return (required)
* @return Call&lt;Pet&gt;
*/
@GET("pet/{petId}")
Observable<Pet> getPetById(
@retrofit2.http.Path("petId") Long petId
@@ -90,9 +85,8 @@ public interface PetApi {
* @param body Pet object that needs to be added to the store (required)
* @return Call&lt;Void&gt;
*/
@Headers({
"Content-Type:application/json"
"Content-Type:application/json"
})
@PUT("pet")
Observable<Void> updatePet(
@@ -107,7 +101,6 @@ public interface PetApi {
* @param status Updated status of the pet (optional)
* @return Call&lt;Void&gt;
*/
@retrofit2.http.FormUrlEncoded
@POST("pet/{petId}")
Observable<Void> updatePetWithForm(
@@ -122,7 +115,6 @@ public interface PetApi {
* @param file file to upload (optional)
* @return Call&lt;ModelApiResponse&gt;
*/
@retrofit2.http.Multipart
@POST("pet/{petId}/uploadImage")
Observable<ModelApiResponse> uploadFile(

View File

@@ -24,7 +24,6 @@ public interface StoreApi {
* @param orderId ID of the order that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("store/order/{orderId}")
Observable<Void> deleteOrder(
@retrofit2.http.Path("orderId") String orderId
@@ -35,7 +34,6 @@ public interface StoreApi {
* Returns a map of status codes to quantities
* @return Call&lt;Map&lt;String, Integer&gt;&gt;
*/
@GET("store/inventory")
Observable<Map<String, Integer>> getInventory();
@@ -46,7 +44,6 @@ public interface StoreApi {
* @param orderId ID of pet that needs to be fetched (required)
* @return Call&lt;Order&gt;
*/
@GET("store/order/{orderId}")
Observable<Order> getOrderById(
@retrofit2.http.Path("orderId") Long orderId
@@ -58,7 +55,6 @@ public interface StoreApi {
* @param body order placed for purchasing the pet (required)
* @return Call&lt;Order&gt;
*/
@POST("store/order")
Observable<Order> placeOrder(
@retrofit2.http.Body Order body

View File

@@ -24,7 +24,6 @@ public interface UserApi {
* @param body Created user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user")
Observable<Void> createUser(
@retrofit2.http.Body User body
@@ -36,7 +35,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithArray")
Observable<Void> createUsersWithArrayInput(
@retrofit2.http.Body List<User> body
@@ -48,7 +46,6 @@ public interface UserApi {
* @param body List of user object (required)
* @return Call&lt;Void&gt;
*/
@POST("user/createWithList")
Observable<Void> createUsersWithListInput(
@retrofit2.http.Body List<User> body
@@ -60,7 +57,6 @@ public interface UserApi {
* @param username The name that needs to be deleted (required)
* @return Call&lt;Void&gt;
*/
@DELETE("user/{username}")
Observable<Void> deleteUser(
@retrofit2.http.Path("username") String username
@@ -72,7 +68,6 @@ public interface UserApi {
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return Call&lt;User&gt;
*/
@GET("user/{username}")
Observable<User> getUserByName(
@retrofit2.http.Path("username") String username
@@ -85,7 +80,6 @@ public interface UserApi {
* @param password The password for login in clear text (required)
* @return Call&lt;String&gt;
*/
@GET("user/login")
Observable<String> loginUser(
@retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password
@@ -96,7 +90,6 @@ public interface UserApi {
*
* @return Call&lt;Void&gt;
*/
@GET("user/logout")
Observable<Void> logoutUser();
@@ -108,7 +101,6 @@ public interface UserApi {
* @param body Updated user object (required)
* @return Call&lt;Void&gt;
*/
@PUT("user/{username}")
Observable<Void> updateUser(
@retrofit2.http.Path("username") String username, @retrofit2.http.Body User body

View File

@@ -6,9 +6,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs-server</artifactId>
<artifactId>swagger-msf4j-server</artifactId>
<packaging>jar</packaging>
<name>swagger-jaxrs-server</name>
<name>swagger-msf4j-server</name>
<version>1.0.0</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>