From b32fe8230a591a077bccaac3da770b8628454551 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 27 Mar 2017 17:21:45 +0800 Subject: [PATCH 1/4] fix retrofit2 indentation (#5221) --- .../libraries/retrofit2/ApiClient.mustache | 752 +++++++++--------- .../Java/libraries/retrofit2/api.mustache | 9 +- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 4 - .../java/io/swagger/client/api/UserApi.java | 8 - .../java/io/swagger/client/ApiClient.java | 635 ++++++++------- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 4 - .../java/io/swagger/client/api/UserApi.java | 8 - .../java/io/swagger/client/ApiClient.java | 635 ++++++++------- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../java/io/swagger/client/api/PetApi.java | 12 +- .../java/io/swagger/client/api/StoreApi.java | 4 - .../java/io/swagger/client/api/UserApi.java | 8 - 16 files changed, 1025 insertions(+), 1093 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index 6c2502db8d80..a0daf87c9cb6 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -22,8 +22,12 @@ import java.time.format.DateTimeFormatter; {{/java8}} import retrofit2.Converter; import retrofit2.Retrofit; -{{#useRxJava}}import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;{{/useRxJava}} -{{#useRxJava2}}import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;{{/useRxJava2}} +{{#useRxJava}} +import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; +{{/useRxJava}} +{{#useRxJava2}} +import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +{{/useRxJava2}} import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory; @@ -38,292 +42,293 @@ import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.ResponseBody; - import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.ApiKeyAuth; import {{invokerPackage}}.auth.OAuth; import {{invokerPackage}}.auth.OAuth.AccessTokenListener; import {{invokerPackage}}.auth.OAuthFlow; - public class ApiClient { - private Map apiAuthorizations; - private OkHttpClient.Builder okBuilder; - private Retrofit.Builder adapterBuilder; + private Map apiAuthorizations; + private OkHttpClient.Builder okBuilder; + private Retrofit.Builder adapterBuilder; - public ApiClient() { - apiAuthorizations = new LinkedHashMap(); - createDefaultAdapter(); + public ApiClient() { + apiAuthorizations = new LinkedHashMap(); + 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}); + } + + /** + * 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 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() { + Gson gson = new GsonBuilder() + .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + {{^java8}} + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + {{/java8}} + {{#java8}} + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) + {{/java8}} + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) + .create(); + + okBuilder = new OkHttpClient.Builder(); + + 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(gson)); + } + + public S createService(Class serviceClass) { + return adapterBuilder + .client(okBuilder.build()) + .build() + .create(serviceClass); + + } + + /** + * Helper method to configure the first api key found + * @param apiKey API key + */ + private void setApiKey(String apiKey) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof ApiKeyAuth) { + ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; + keyAuth.setApiKey(apiKey); + return; + } } + } - /** - * Basic constructor for single auth name - * @param authName Authentication name - */ - public ApiClient(String authName) { - this(new String[]{authName}); + /** + * Helper method to configure the username/password for basic auth or password oauth + * @param username Username + * @param password Password + */ + private void setCredentials(String username, String password) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof HttpBasicAuth) { + HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; + basicAuth.setCredentials(username, password); + return; + } + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); + return; + } } + } - /** - * 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 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 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 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 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 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 + */ + public void setAccessToken(String accessToken) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.setAccessToken(accessToken); + return; + } } + } - public void createDefaultAdapter() { - Gson gson = new GsonBuilder() - .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - {{^java8}} - .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) - {{/java8}} - {{#java8}} - .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) - {{/java8}} - .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) - .create(); - - okBuilder = new OkHttpClient.Builder(); - - 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(gson)); + /** + * Helper method to configure the oauth accessCode/implicit flow parameters + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI + */ + public void 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; + } } + } - public S createService(Class serviceClass) { - return adapterBuilder - .client(okBuilder.build()) - .build() - .create(serviceClass); - + /** + * Configures a listener which is notified when a new access token is received. + * @param accessTokenListener Access token listener + */ + public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.registerAccessTokenListener(accessTokenListener); + return; + } } + } - /** - * Helper method to configure the first api key found - * @param apiKey API key - */ - private void setApiKey(String apiKey) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return; - } - } + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Authorization interceptor + */ + public void 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); + } - /** - * Helper method to configure the username/password for basic auth or password oauth - * @param username Username - * @param password Password - */ - private void setCredentials(String username, String password) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - } + public Map getApiAuthorizations() { + return apiAuthorizations; + } + + public void setApiAuthorizations(Map apiAuthorizations) { + this.apiAuthorizations = apiAuthorizations; + } + + public Retrofit.Builder getAdapterBuilder() { + return adapterBuilder; + } + + public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { + this.adapterBuilder = adapterBuilder; + } + + public OkHttpClient.Builder getOkBuilder() { + return okBuilder; + } + + public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + okBuilder.addInterceptor(apiAuthorization); } + } - /** - * 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 - */ - public void setAccessToken(String accessToken) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken); - return; - } - } - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - */ - public void 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; - } - } - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - */ - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - */ - public void 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); - } - - public Map getApiAuthorizations() { - return apiAuthorizations; - } - - public void setApiAuthorizations(Map apiAuthorizations) { - this.apiAuthorizations = apiAuthorizations; - } - - public Retrofit.Builder getAdapterBuilder() { - return adapterBuilder; - } - - public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { - this.adapterBuilder = adapterBuilder; - } - - 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); + } } /** @@ -332,52 +337,54 @@ public class ApiClient { * expected type is String, then just return the body string. */ class GsonResponseBodyConverterToString implements Converter { - private final Gson gson; - private final Type type; - GsonResponseBodyConverterToString(Gson gson, Type type) { - this.gson = gson; - this.type = type; - } + private final Gson gson; + private final 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; - } - } + 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; + } + } } -class GsonCustomConverterFactory extends Converter.Factory -{ - public static GsonCustomConverterFactory create(Gson gson) { - return new GsonCustomConverterFactory(gson); - } +class GsonCustomConverterFactory extends Converter.Factory { - private final Gson gson; - private final GsonConverterFactory gsonConverterFactory; + private final Gson gson; + private final GsonConverterFactory gsonConverterFactory; - private GsonCustomConverterFactory(Gson gson) { - if (gson == null) throw new NullPointerException("gson == null"); - this.gson = gson; - this.gsonConverterFactory = GsonConverterFactory.create(gson); - } + public static GsonCustomConverterFactory create(Gson gson) { + return new GsonCustomConverterFactory(gson); + } - @Override - public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { - if(type.equals(String.class)) - return new GsonResponseBodyConverterToString(gson, type); - else - return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); - } + private GsonCustomConverterFactory(Gson gson) { + if (gson == null) + throw new NullPointerException("gson == null"); + this.gson = gson; + this.gsonConverterFactory = GsonConverterFactory.create(gson); + } - @Override - public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { - return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); - } + @Override + public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { + if (type.equals(String.class)) + return new GsonResponseBodyConverterToString(gson, type); + else + return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); + } + + @Override + public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { + return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); + } } {{^java8}} @@ -386,29 +393,29 @@ class GsonCustomConverterFactory extends Converter.Factory */ class DateTimeTypeAdapter extends TypeAdapter { - private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); - private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); + private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); + private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); - @Override - public void write(JsonWriter out, DateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(printFormatter.print(date)); - } + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(printFormatter.print(date)); } + } - @Override - public DateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return parseFormatter.parseDateTime(date); - } + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return parseFormatter.parseDateTime(date); } + } } /** @@ -416,28 +423,28 @@ class DateTimeTypeAdapter extends TypeAdapter { */ class LocalDateTypeAdapter extends TypeAdapter { - private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.print(date)); - } + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); } + } - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return formatter.parseLocalDate(date); - } + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); } + } } {{/java8}} {{#java8}} @@ -446,32 +453,31 @@ class LocalDateTypeAdapter extends TypeAdapter { */ class OffsetDateTimeTypeAdapter extends TypeAdapter { - private final DateTimeFormatter formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + private final DateTimeFormatter formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); } + } - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length()-5) + "Z"; - } - - return OffsetDateTime.parse(date, formatter); + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; } + return OffsetDateTime.parse(date, formatter); } + } } /** @@ -479,27 +485,27 @@ class OffsetDateTimeTypeAdapter extends TypeAdapter { */ class LocalDateTypeAdapter extends TypeAdapter { - private final DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE; + private final DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE; - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); } + } - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); } + } } {{/java8}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache index 047c4931f01b..98d511179fbb 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache @@ -35,13 +35,16 @@ public interface {{classname}} { {{/allParams}} * @return Call<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object{{/returnType}}> */ - {{#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}} diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java index c28161906f48..05c6ba8da52f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java @@ -29,9 +29,8 @@ public interface FakeApi { * @param body client model (required) * @return Call<Client> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PATCH("fake") F.Promise> testClientModel( @@ -57,7 +56,6 @@ public interface FakeApi { * @param paramCallback None (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("fake") F.Promise> testEndpointParameters( @@ -77,7 +75,6 @@ public interface FakeApi { * @param enumQueryDouble Query parameter enum test (double) (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @GET("fake") F.Promise> testEnumParameters( diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/PetApi.java index 7b32044e838b..8f841a8f1e23 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/PetApi.java @@ -28,9 +28,8 @@ public interface PetApi { * @param body Pet object that needs to be added to the store (required) * @return Call<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @POST("pet") F.Promise> addPet( @@ -44,7 +43,6 @@ public interface PetApi { * @param apiKey (optional) * @return Call<Void> */ - @DELETE("pet/{petId}") F.Promise> 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<List<Pet>> */ - @GET("pet/findByStatus") F.Promise>> findPetsByStatus( @retrofit2.http.Query("status") CSVParams status @@ -68,7 +65,6 @@ public interface PetApi { * @param tags Tags to filter by (required) * @return Call<List<Pet>> */ - @GET("pet/findByTags") F.Promise>> findPetsByTags( @retrofit2.http.Query("tags") CSVParams tags @@ -80,7 +76,6 @@ public interface PetApi { * @param petId ID of pet to return (required) * @return Call<Pet> */ - @GET("pet/{petId}") F.Promise> 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<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PUT("pet") F.Promise> updatePet( @@ -109,7 +103,6 @@ public interface PetApi { * @param status Updated status of the pet (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("pet/{petId}") F.Promise> updatePetWithForm( @@ -124,7 +117,6 @@ public interface PetApi { * @param file file to upload (optional) * @return Call<ModelApiResponse> */ - @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") F.Promise> uploadFile( diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/StoreApi.java index 2ffc90a478b4..94877ed38907 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/StoreApi.java @@ -26,7 +26,6 @@ public interface StoreApi { * @param orderId ID of the order that needs to be deleted (required) * @return Call<Void> */ - @DELETE("store/order/{orderId}") F.Promise> deleteOrder( @retrofit2.http.Path("orderId") String orderId @@ -37,7 +36,6 @@ public interface StoreApi { * Returns a map of status codes to quantities * @return Call<Map<String, Integer>> */ - @GET("store/inventory") F.Promise>> getInventory(); @@ -48,7 +46,6 @@ public interface StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Call<Order> */ - @GET("store/order/{orderId}") F.Promise> 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<Order> */ - @POST("store/order") F.Promise> placeOrder( @retrofit2.http.Body Order body diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/UserApi.java index 19fc25ccd238..9b553463002f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/UserApi.java @@ -26,7 +26,6 @@ public interface UserApi { * @param body Created user object (required) * @return Call<Void> */ - @POST("user") F.Promise> createUser( @retrofit2.http.Body User body @@ -38,7 +37,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithArray") F.Promise> createUsersWithArrayInput( @retrofit2.http.Body List body @@ -50,7 +48,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithList") F.Promise> createUsersWithListInput( @retrofit2.http.Body List body @@ -62,7 +59,6 @@ public interface UserApi { * @param username The name that needs to be deleted (required) * @return Call<Void> */ - @DELETE("user/{username}") F.Promise> 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<User> */ - @GET("user/{username}") F.Promise> 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<String> */ - @GET("user/login") F.Promise> loginUser( @retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password @@ -98,7 +92,6 @@ public interface UserApi { * * @return Call<Void> */ - @GET("user/logout") F.Promise> logoutUser(); @@ -110,7 +103,6 @@ public interface UserApi { * @param body Updated user object (required) * @return Call<Void> */ - @PUT("user/{username}") F.Promise> updateUser( @retrofit2.http.Path("username") String username, @retrofit2.http.Body User body diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index bd9a00b5014a..b31065501713 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -15,8 +15,6 @@ import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; import retrofit2.Converter; import retrofit2.Retrofit; - - import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory; @@ -31,278 +29,273 @@ import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.ResponseBody; - import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; import io.swagger.client.auth.OAuth.AccessTokenListener; import io.swagger.client.auth.OAuthFlow; - public class ApiClient { - private Map apiAuthorizations; - private OkHttpClient.Builder okBuilder; - private Retrofit.Builder adapterBuilder; + private Map apiAuthorizations; + private OkHttpClient.Builder okBuilder; + private Retrofit.Builder adapterBuilder; - public ApiClient() { - apiAuthorizations = new LinkedHashMap(); - createDefaultAdapter(); + public ApiClient() { + apiAuthorizations = new LinkedHashMap(); + 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}); + } + + /** + * 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 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() { + Gson gson = new GsonBuilder() + .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) + .create(); + + okBuilder = new OkHttpClient.Builder(); + + String baseUrl = "http://petstore.swagger.io/v2"; + if(!baseUrl.endsWith("/")) + baseUrl = baseUrl + "/"; + + adapterBuilder = new Retrofit + .Builder() + .baseUrl(baseUrl) + .addConverterFactory(ScalarsConverterFactory.create()) + .addConverterFactory(GsonCustomConverterFactory.create(gson)); + } + + public S createService(Class serviceClass) { + return adapterBuilder + .client(okBuilder.build()) + .build() + .create(serviceClass); + + } + + /** + * Helper method to configure the first api key found + * @param apiKey API key + */ + private void setApiKey(String apiKey) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof ApiKeyAuth) { + ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; + keyAuth.setApiKey(apiKey); + return; + } } + } - /** - * Basic constructor for single auth name - * @param authName Authentication name - */ - public ApiClient(String authName) { - this(new String[]{authName}); + /** + * Helper method to configure the username/password for basic auth or password oauth + * @param username Username + * @param password Password + */ + private void setCredentials(String username, String password) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof HttpBasicAuth) { + HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; + basicAuth.setCredentials(username, password); + return; + } + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); + return; + } } + } - /** - * 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 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 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 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 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 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 + */ + public void setAccessToken(String accessToken) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.setAccessToken(accessToken); + return; + } } + } - public void createDefaultAdapter() { - Gson gson = new GsonBuilder() - .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) - .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) - .create(); - - okBuilder = new OkHttpClient.Builder(); - - String baseUrl = "http://petstore.swagger.io/v2"; - if(!baseUrl.endsWith("/")) - baseUrl = baseUrl + "/"; - - adapterBuilder = new Retrofit - .Builder() - .baseUrl(baseUrl) - - - .addConverterFactory(ScalarsConverterFactory.create()) - .addConverterFactory(GsonCustomConverterFactory.create(gson)); + /** + * Helper method to configure the oauth accessCode/implicit flow parameters + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI + */ + public void 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; + } } + } - public S createService(Class serviceClass) { - return adapterBuilder - .client(okBuilder.build()) - .build() - .create(serviceClass); - + /** + * Configures a listener which is notified when a new access token is received. + * @param accessTokenListener Access token listener + */ + public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.registerAccessTokenListener(accessTokenListener); + return; + } } + } - /** - * Helper method to configure the first api key found - * @param apiKey API key - */ - private void setApiKey(String apiKey) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return; - } - } + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Authorization interceptor + */ + public void 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); + } - /** - * Helper method to configure the username/password for basic auth or password oauth - * @param username Username - * @param password Password - */ - private void setCredentials(String username, String password) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - } + public Map getApiAuthorizations() { + return apiAuthorizations; + } + + public void setApiAuthorizations(Map apiAuthorizations) { + this.apiAuthorizations = apiAuthorizations; + } + + public Retrofit.Builder getAdapterBuilder() { + return adapterBuilder; + } + + public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { + this.adapterBuilder = adapterBuilder; + } + + public OkHttpClient.Builder getOkBuilder() { + return okBuilder; + } + + public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + okBuilder.addInterceptor(apiAuthorization); } + } - /** - * 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 - */ - public void setAccessToken(String accessToken) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken); - return; - } - } - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - */ - public void 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; - } - } - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - */ - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - */ - public void 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); - } - - public Map getApiAuthorizations() { - return apiAuthorizations; - } - - public void setApiAuthorizations(Map apiAuthorizations) { - this.apiAuthorizations = apiAuthorizations; - } - - public Retrofit.Builder getAdapterBuilder() { - return adapterBuilder; - } - - public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { - this.adapterBuilder = adapterBuilder; - } - - 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); + } } /** @@ -311,52 +304,54 @@ public class ApiClient { * expected type is String, then just return the body string. */ class GsonResponseBodyConverterToString implements Converter { - private final Gson gson; - private final Type type; - GsonResponseBodyConverterToString(Gson gson, Type type) { - this.gson = gson; - this.type = type; - } + private final Gson gson; + private final 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; - } - } + 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; + } + } } -class GsonCustomConverterFactory extends Converter.Factory -{ - public static GsonCustomConverterFactory create(Gson gson) { - return new GsonCustomConverterFactory(gson); - } +class GsonCustomConverterFactory extends Converter.Factory { - private final Gson gson; - private final GsonConverterFactory gsonConverterFactory; + private final Gson gson; + private final GsonConverterFactory gsonConverterFactory; - private GsonCustomConverterFactory(Gson gson) { - if (gson == null) throw new NullPointerException("gson == null"); - this.gson = gson; - this.gsonConverterFactory = GsonConverterFactory.create(gson); - } + public static GsonCustomConverterFactory create(Gson gson) { + return new GsonCustomConverterFactory(gson); + } - @Override - public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { - if(type.equals(String.class)) - return new GsonResponseBodyConverterToString(gson, type); - else - return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); - } + private GsonCustomConverterFactory(Gson gson) { + if (gson == null) + throw new NullPointerException("gson == null"); + this.gson = gson; + this.gsonConverterFactory = GsonConverterFactory.create(gson); + } - @Override - public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { - return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); - } + @Override + public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { + if (type.equals(String.class)) + return new GsonResponseBodyConverterToString(gson, type); + else + return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); + } + + @Override + public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { + return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); + } } /** @@ -364,29 +359,29 @@ class GsonCustomConverterFactory extends Converter.Factory */ class DateTimeTypeAdapter extends TypeAdapter { - private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); - private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); + private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); + private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); - @Override - public void write(JsonWriter out, DateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(printFormatter.print(date)); - } + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(printFormatter.print(date)); } + } - @Override - public DateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return parseFormatter.parseDateTime(date); - } + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return parseFormatter.parseDateTime(date); } + } } /** @@ -394,26 +389,26 @@ class DateTimeTypeAdapter extends TypeAdapter { */ class LocalDateTypeAdapter extends TypeAdapter { - private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.print(date)); - } + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); } + } - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return formatter.parseLocalDate(date); - } + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); } + } } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index ef1ffe54aab9..e62a0825b0b3 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -27,9 +27,8 @@ public interface FakeApi { * @param body client model (required) * @return Call<Client> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PATCH("fake") Call testClientModel( @@ -55,7 +54,6 @@ public interface FakeApi { * @param paramCallback None (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("fake") Call testEndpointParameters( @@ -75,7 +73,6 @@ public interface FakeApi { * @param enumQueryDouble Query parameter enum test (double) (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @GET("fake") Call testEnumParameters( diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index df1999db5c0f..d3c4011b8be7 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -26,9 +26,8 @@ public interface PetApi { * @param body Pet object that needs to be added to the store (required) * @return Call<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @POST("pet") Call addPet( @@ -42,7 +41,6 @@ public interface PetApi { * @param apiKey (optional) * @return Call<Void> */ - @DELETE("pet/{petId}") Call 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<List<Pet>> */ - @GET("pet/findByStatus") Call> findPetsByStatus( @retrofit2.http.Query("status") CSVParams status @@ -66,7 +63,6 @@ public interface PetApi { * @param tags Tags to filter by (required) * @return Call<List<Pet>> */ - @GET("pet/findByTags") Call> findPetsByTags( @retrofit2.http.Query("tags") CSVParams tags @@ -78,7 +74,6 @@ public interface PetApi { * @param petId ID of pet to return (required) * @return Call<Pet> */ - @GET("pet/{petId}") Call 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<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PUT("pet") Call updatePet( @@ -107,7 +101,6 @@ public interface PetApi { * @param status Updated status of the pet (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("pet/{petId}") Call updatePetWithForm( @@ -122,7 +115,6 @@ public interface PetApi { * @param file file to upload (optional) * @return Call<ModelApiResponse> */ - @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") Call uploadFile( diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java index 224d4f025007..16b57ea3c908 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java @@ -24,7 +24,6 @@ public interface StoreApi { * @param orderId ID of the order that needs to be deleted (required) * @return Call<Void> */ - @DELETE("store/order/{orderId}") Call deleteOrder( @retrofit2.http.Path("orderId") String orderId @@ -35,7 +34,6 @@ public interface StoreApi { * Returns a map of status codes to quantities * @return Call<Map<String, Integer>> */ - @GET("store/inventory") Call> getInventory(); @@ -46,7 +44,6 @@ public interface StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Call<Order> */ - @GET("store/order/{orderId}") Call 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<Order> */ - @POST("store/order") Call placeOrder( @retrofit2.http.Body Order body diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java index 2a189ac4e60e..f7ca2cfc6a2c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java @@ -24,7 +24,6 @@ public interface UserApi { * @param body Created user object (required) * @return Call<Void> */ - @POST("user") Call createUser( @retrofit2.http.Body User body @@ -36,7 +35,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithArray") Call createUsersWithArrayInput( @retrofit2.http.Body List body @@ -48,7 +46,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithList") Call createUsersWithListInput( @retrofit2.http.Body List body @@ -60,7 +57,6 @@ public interface UserApi { * @param username The name that needs to be deleted (required) * @return Call<Void> */ - @DELETE("user/{username}") Call 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<User> */ - @GET("user/{username}") Call 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<String> */ - @GET("user/login") Call loginUser( @retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password @@ -96,7 +90,6 @@ public interface UserApi { * * @return Call<Void> */ - @GET("user/logout") Call logoutUser(); @@ -108,7 +101,6 @@ public interface UserApi { * @param body Updated user object (required) * @return Call<Void> */ - @PUT("user/{username}") Call updateUser( @retrofit2.http.Path("username") String username, @retrofit2.http.Body User body diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java index 1526ca00e372..4001ccb7035b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java @@ -16,7 +16,6 @@ import org.joda.time.format.ISODateTimeFormat; import retrofit2.Converter; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; - import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory; @@ -31,278 +30,274 @@ import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.ResponseBody; - import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; import io.swagger.client.auth.OAuth.AccessTokenListener; import io.swagger.client.auth.OAuthFlow; - public class ApiClient { - private Map apiAuthorizations; - private OkHttpClient.Builder okBuilder; - private Retrofit.Builder adapterBuilder; + private Map apiAuthorizations; + private OkHttpClient.Builder okBuilder; + private Retrofit.Builder adapterBuilder; - public ApiClient() { - apiAuthorizations = new LinkedHashMap(); - createDefaultAdapter(); + public ApiClient() { + apiAuthorizations = new LinkedHashMap(); + 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}); + } + + /** + * 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 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() { + Gson gson = new GsonBuilder() + .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) + .create(); + + okBuilder = new OkHttpClient.Builder(); + + 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(gson)); + } + + public S createService(Class serviceClass) { + return adapterBuilder + .client(okBuilder.build()) + .build() + .create(serviceClass); + + } + + /** + * Helper method to configure the first api key found + * @param apiKey API key + */ + private void setApiKey(String apiKey) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof ApiKeyAuth) { + ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; + keyAuth.setApiKey(apiKey); + return; + } } + } - /** - * Basic constructor for single auth name - * @param authName Authentication name - */ - public ApiClient(String authName) { - this(new String[]{authName}); + /** + * Helper method to configure the username/password for basic auth or password oauth + * @param username Username + * @param password Password + */ + private void setCredentials(String username, String password) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof HttpBasicAuth) { + HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; + basicAuth.setCredentials(username, password); + return; + } + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); + return; + } } + } - /** - * 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 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 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 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 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 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 + */ + public void setAccessToken(String accessToken) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.setAccessToken(accessToken); + return; + } } + } - public void createDefaultAdapter() { - Gson gson = new GsonBuilder() - .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) - .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) - .create(); - - okBuilder = new OkHttpClient.Builder(); - - 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(gson)); + /** + * Helper method to configure the oauth accessCode/implicit flow parameters + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI + */ + public void 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; + } } + } - public S createService(Class serviceClass) { - return adapterBuilder - .client(okBuilder.build()) - .build() - .create(serviceClass); - + /** + * Configures a listener which is notified when a new access token is received. + * @param accessTokenListener Access token listener + */ + public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.registerAccessTokenListener(accessTokenListener); + return; + } } + } - /** - * Helper method to configure the first api key found - * @param apiKey API key - */ - private void setApiKey(String apiKey) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof ApiKeyAuth) { - ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; - keyAuth.setApiKey(apiKey); - return; - } - } + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Authorization interceptor + */ + public void 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); + } - /** - * Helper method to configure the username/password for basic auth or password oauth - * @param username Username - * @param password Password - */ - private void setCredentials(String username, String password) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof HttpBasicAuth) { - HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; - basicAuth.setCredentials(username, password); - return; - } - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); - return; - } - } + public Map getApiAuthorizations() { + return apiAuthorizations; + } + + public void setApiAuthorizations(Map apiAuthorizations) { + this.apiAuthorizations = apiAuthorizations; + } + + public Retrofit.Builder getAdapterBuilder() { + return adapterBuilder; + } + + public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { + this.adapterBuilder = adapterBuilder; + } + + public OkHttpClient.Builder getOkBuilder() { + return okBuilder; + } + + public void addAuthsToOkBuilder(OkHttpClient.Builder okBuilder) { + for(Interceptor apiAuthorization : apiAuthorizations.values()) { + okBuilder.addInterceptor(apiAuthorization); } + } - /** - * 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 - */ - public void setAccessToken(String accessToken) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.setAccessToken(accessToken); - return; - } - } - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - */ - public void 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; - } - } - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Access token listener - */ - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - for(Interceptor apiAuthorization : apiAuthorizations.values()) { - if (apiAuthorization instanceof OAuth) { - OAuth oauth = (OAuth) apiAuthorization; - oauth.registerAccessTokenListener(accessTokenListener); - return; - } - } - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Authorization interceptor - */ - public void 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); - } - - public Map getApiAuthorizations() { - return apiAuthorizations; - } - - public void setApiAuthorizations(Map apiAuthorizations) { - this.apiAuthorizations = apiAuthorizations; - } - - public Retrofit.Builder getAdapterBuilder() { - return adapterBuilder; - } - - public void setAdapterBuilder(Retrofit.Builder adapterBuilder) { - this.adapterBuilder = adapterBuilder; - } - - 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); + } } /** @@ -311,52 +306,54 @@ public class ApiClient { * expected type is String, then just return the body string. */ class GsonResponseBodyConverterToString implements Converter { - private final Gson gson; - private final Type type; - GsonResponseBodyConverterToString(Gson gson, Type type) { - this.gson = gson; - this.type = type; - } + private final Gson gson; + private final 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; - } - } + 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; + } + } } -class GsonCustomConverterFactory extends Converter.Factory -{ - public static GsonCustomConverterFactory create(Gson gson) { - return new GsonCustomConverterFactory(gson); - } +class GsonCustomConverterFactory extends Converter.Factory { - private final Gson gson; - private final GsonConverterFactory gsonConverterFactory; + private final Gson gson; + private final GsonConverterFactory gsonConverterFactory; - private GsonCustomConverterFactory(Gson gson) { - if (gson == null) throw new NullPointerException("gson == null"); - this.gson = gson; - this.gsonConverterFactory = GsonConverterFactory.create(gson); - } + public static GsonCustomConverterFactory create(Gson gson) { + return new GsonCustomConverterFactory(gson); + } - @Override - public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { - if(type.equals(String.class)) - return new GsonResponseBodyConverterToString(gson, type); - else - return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); - } + private GsonCustomConverterFactory(Gson gson) { + if (gson == null) + throw new NullPointerException("gson == null"); + this.gson = gson; + this.gsonConverterFactory = GsonConverterFactory.create(gson); + } - @Override - public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { - return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); - } + @Override + public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { + if (type.equals(String.class)) + return new GsonResponseBodyConverterToString(gson, type); + else + return gsonConverterFactory.responseBodyConverter(type, annotations, retrofit); + } + + @Override + public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { + return gsonConverterFactory.requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); + } } /** @@ -364,29 +361,29 @@ class GsonCustomConverterFactory extends Converter.Factory */ class DateTimeTypeAdapter extends TypeAdapter { - private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); - private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); + private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); + private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); - @Override - public void write(JsonWriter out, DateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(printFormatter.print(date)); - } + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(printFormatter.print(date)); } + } - @Override - public DateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return parseFormatter.parseDateTime(date); - } + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return parseFormatter.parseDateTime(date); } + } } /** @@ -394,26 +391,26 @@ class DateTimeTypeAdapter extends TypeAdapter { */ class LocalDateTypeAdapter extends TypeAdapter { - private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.print(date)); - } + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); } + } - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return formatter.parseLocalDate(date); - } + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); } + } } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index 539493847633..16f75c85e081 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -27,9 +27,8 @@ public interface FakeApi { * @param body client model (required) * @return Call<Client> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PATCH("fake") Observable testClientModel( @@ -55,7 +54,6 @@ public interface FakeApi { * @param paramCallback None (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("fake") Observable testEndpointParameters( @@ -75,7 +73,6 @@ public interface FakeApi { * @param enumQueryDouble Query parameter enum test (double) (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @GET("fake") Observable testEnumParameters( diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java index 3fa5d01ee65f..ca50dfdeb64c 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java @@ -26,9 +26,8 @@ public interface PetApi { * @param body Pet object that needs to be added to the store (required) * @return Call<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @POST("pet") Observable addPet( @@ -42,7 +41,6 @@ public interface PetApi { * @param apiKey (optional) * @return Call<Void> */ - @DELETE("pet/{petId}") Observable 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<List<Pet>> */ - @GET("pet/findByStatus") Observable> findPetsByStatus( @retrofit2.http.Query("status") CSVParams status @@ -66,7 +63,6 @@ public interface PetApi { * @param tags Tags to filter by (required) * @return Call<List<Pet>> */ - @GET("pet/findByTags") Observable> findPetsByTags( @retrofit2.http.Query("tags") CSVParams tags @@ -78,7 +74,6 @@ public interface PetApi { * @param petId ID of pet to return (required) * @return Call<Pet> */ - @GET("pet/{petId}") Observable 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<Void> */ - @Headers({ - "Content-Type:application/json" + "Content-Type:application/json" }) @PUT("pet") Observable updatePet( @@ -107,7 +101,6 @@ public interface PetApi { * @param status Updated status of the pet (optional) * @return Call<Void> */ - @retrofit2.http.FormUrlEncoded @POST("pet/{petId}") Observable updatePetWithForm( @@ -122,7 +115,6 @@ public interface PetApi { * @param file file to upload (optional) * @return Call<ModelApiResponse> */ - @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") Observable uploadFile( diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java index 5c87a20f4336..a937daca7cc5 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/StoreApi.java @@ -24,7 +24,6 @@ public interface StoreApi { * @param orderId ID of the order that needs to be deleted (required) * @return Call<Void> */ - @DELETE("store/order/{orderId}") Observable deleteOrder( @retrofit2.http.Path("orderId") String orderId @@ -35,7 +34,6 @@ public interface StoreApi { * Returns a map of status codes to quantities * @return Call<Map<String, Integer>> */ - @GET("store/inventory") Observable> getInventory(); @@ -46,7 +44,6 @@ public interface StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Call<Order> */ - @GET("store/order/{orderId}") Observable 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<Order> */ - @POST("store/order") Observable placeOrder( @retrofit2.http.Body Order body diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java index 79428c2ad049..a4e7e138b753 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/UserApi.java @@ -24,7 +24,6 @@ public interface UserApi { * @param body Created user object (required) * @return Call<Void> */ - @POST("user") Observable createUser( @retrofit2.http.Body User body @@ -36,7 +35,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithArray") Observable createUsersWithArrayInput( @retrofit2.http.Body List body @@ -48,7 +46,6 @@ public interface UserApi { * @param body List of user object (required) * @return Call<Void> */ - @POST("user/createWithList") Observable createUsersWithListInput( @retrofit2.http.Body List body @@ -60,7 +57,6 @@ public interface UserApi { * @param username The name that needs to be deleted (required) * @return Call<Void> */ - @DELETE("user/{username}") Observable 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<User> */ - @GET("user/{username}") Observable 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<String> */ - @GET("user/login") Observable loginUser( @retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password @@ -96,7 +90,6 @@ public interface UserApi { * * @return Call<Void> */ - @GET("user/logout") Observable logoutUser(); @@ -108,7 +101,6 @@ public interface UserApi { * @param body Updated user object (required) * @return Call<Void> */ - @PUT("user/{username}") Observable updateUser( @retrofit2.http.Path("username") String username, @retrofit2.http.Body User body From 19b766ef04f95f596ada19d4c9b9b61ffbca10f2 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 27 Mar 2017 17:29:07 +0800 Subject: [PATCH 2/4] add comments to csharp methods (#5222) From d68859cfbcc984b79be35b96a8419492888bcc22 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 27 Mar 2017 18:06:34 +0800 Subject: [PATCH 3/4] fix c# docstring typo (#5223) --- .../src/main/resources/csharp/modelGeneric.mustache | 2 +- .../petstore/csharp/SwaggerClient/IO.Swagger.sln | 10 +++++----- .../SwaggerClient/src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/AdditionalPropertiesClass.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Animal.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfNumberOnly.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs | 2 +- .../src/IO.Swagger/Model/Capitalization.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/Category.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/ClassModel.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/EnumTest.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/FormatTest.cs | 2 +- .../src/IO.Swagger/Model/HasOnlyReadOnly.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/List.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/MapTest.cs | 2 +- .../MixedPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Model200Response.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/ModelClient.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs | 2 +- .../SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs | 2 +- .../src/IO.Swagger/Model/ReadOnlyFirst.cs | 2 +- .../src/IO.Swagger/Model/SpecialModelName.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs | 2 +- .../csharp/SwaggerClient/src/IO.Swagger/Model/User.cs | 2 +- .../SwaggerClientWithPropertyChanged/IO.Swagger.sln | 10 +++++----- .../src/IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/AdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Animal.cs | 2 +- .../src/IO.Swagger/Model/AnimalFarm.cs | 2 +- .../src/IO.Swagger/Model/ApiResponse.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayOfNumberOnly.cs | 2 +- .../src/IO.Swagger/Model/ArrayTest.cs | 2 +- .../src/IO.Swagger/Model/Capitalization.cs | 2 +- .../src/IO.Swagger/Model/Cat.cs | 2 +- .../src/IO.Swagger/Model/Category.cs | 2 +- .../src/IO.Swagger/Model/ClassModel.cs | 2 +- .../src/IO.Swagger/Model/Dog.cs | 2 +- .../src/IO.Swagger/Model/EnumArrays.cs | 2 +- .../src/IO.Swagger/Model/EnumTest.cs | 2 +- .../src/IO.Swagger/Model/FormatTest.cs | 2 +- .../src/IO.Swagger/Model/HasOnlyReadOnly.cs | 2 +- .../src/IO.Swagger/Model/List.cs | 2 +- .../src/IO.Swagger/Model/MapTest.cs | 2 +- .../MixedPropertiesAndAdditionalPropertiesClass.cs | 2 +- .../src/IO.Swagger/Model/Model200Response.cs | 2 +- .../src/IO.Swagger/Model/ModelClient.cs | 2 +- .../src/IO.Swagger/Model/ModelReturn.cs | 2 +- .../src/IO.Swagger/Model/Name.cs | 2 +- .../src/IO.Swagger/Model/NumberOnly.cs | 2 +- .../src/IO.Swagger/Model/Order.cs | 2 +- .../src/IO.Swagger/Model/Pet.cs | 2 +- .../src/IO.Swagger/Model/ReadOnlyFirst.cs | 2 +- .../src/IO.Swagger/Model/SpecialModelName.cs | 2 +- .../src/IO.Swagger/Model/Tag.cs | 2 +- .../src/IO.Swagger/Model/User.cs | 2 +- 66 files changed, 74 insertions(+), 74 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 9bb517c0384f..6465dccdb894 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -199,7 +199,7 @@ this.{{name}} = {{name}}; /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { {{#vars}}{{#hasValidation}}{{#maxLength}} diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index bfbf0998e011..7aa9bf44c398 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -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 diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index dc831ef19d77..3e857367780f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -12,7 +12,7 @@ Contact: apiteam@swagger.io Debug AnyCPU - {D23EBB29-C5C8-4000-BF1B-B91E26DD19DB} + {B4460E5B-0F76-4FD0-A23A-50FAEE57DFE8} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs index 36e8f05dec6e..88a5e642fd0d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AdditionalPropertiesClass.cs @@ -130,7 +130,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs index 5e35b4fe687a..cf28babdb7fa 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs @@ -151,7 +151,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs index 633a8e8809a5..4f1b7bcac796 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs @@ -101,7 +101,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs index 21a8a52131d0..9184ed576ea9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs @@ -145,7 +145,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs index d4e1971762fd..932af1e22c5c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs index 1f7dabaa6860..c05593cb075f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs index 4120c1009802..c73a118a7dee 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ArrayTest.cs @@ -145,7 +145,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs index 3d73b2eec95a..236a213f8e0f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Capitalization.cs @@ -191,7 +191,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs index 2654b2bc5371..25893b0bf981 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs @@ -166,7 +166,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs index 8f263be18a1b..5abe2c2d7902 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs @@ -130,7 +130,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs index c0fca1d85a74..2c190f97a27a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ClassModel.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs index 418bf7d0bdf1..e28d76358059 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs @@ -166,7 +166,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs index 82c598ad09eb..7db74d5ba97b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumArrays.cs @@ -171,7 +171,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs index 645b7058d6d1..a75564c1b0d9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs @@ -226,7 +226,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index a54599529672..21d4c7494fef 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -332,7 +332,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs index eed80fd723ae..acd815249125 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/HasOnlyReadOnly.cs @@ -127,7 +127,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs index 23f15118d858..ff51ee5c4596 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/List.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs index ceb6735e4961..d8dcf33a1805 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MapTest.cs @@ -151,7 +151,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 96cdc1036a18..2af3ddb155f2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -145,7 +145,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs index e96c532a0a39..aaafb1937ffe 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs @@ -130,7 +130,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs index 80ba39f25a6b..5d9456811489 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelClient.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs index 8c134d160475..3a5c85d6cccb 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs index 1cd1141d03c7..3d751d0aca14 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs @@ -169,7 +169,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs index fc40a098b273..98c4d4e700fd 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/NumberOnly.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs index 7d53ffe12612..e783c71f4cdf 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs @@ -226,7 +226,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs index 47aef35aeae6..30381e1b1cea 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs @@ -239,7 +239,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs index 7e609e0d8f67..06dbaf06c391 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ReadOnlyFirst.cs @@ -128,7 +128,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs index c4c25f3d3abf..469ed8e00811 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs index 214abef39a4f..a84c3b03d41a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs @@ -130,7 +130,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs index 7af6ae686005..260e2b768be1 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs @@ -221,7 +221,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln index 433111745191..ca37d1cac986 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln @@ -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 diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 8640220512f0..c77176f53b0a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -74,7 +74,7 @@ Contact: apiteam@swagger.io - {05E9062F-6473-433C-92E3-F7EF63B6A0CB} + {6C01F92F-3611-4F84-AC86-927E3625E0A8} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj index 76436bec2f90..4143279893cf 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj @@ -12,7 +12,7 @@ Contact: apiteam@swagger.io Debug AnyCPU - {05E9062F-6473-433C-92E3-F7EF63B6A0CB} + {6C01F92F-3611-4F84-AC86-927E3625E0A8} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs index 3ae39f1b32f0..092158675618 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AdditionalPropertiesClass.cs @@ -153,7 +153,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs index 77db1d6d2d48..799ae667725d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Animal.cs @@ -174,7 +174,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs index cc517d0adb62..0c3ad671a3fa 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/AnimalFarm.cs @@ -124,7 +124,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs index ce839de2c554..7eb20721639d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ApiResponse.cs @@ -168,7 +168,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs index e9cf803ecfd6..729d5cb74eb8 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs index b9afce40941f..7e04be5927fd 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayOfNumberOnly.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs index 3aa6661639fd..7761e0855ee4 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ArrayTest.cs @@ -168,7 +168,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs index a4ecd11f47a4..57fab83bd95b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs @@ -214,7 +214,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs index d12facb1ab72..89846764f3e7 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Cat.cs @@ -189,7 +189,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs index 6ffc7cb42da4..d289bd14dc2a 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Category.cs @@ -153,7 +153,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs index 09c674c322aa..7ef8228cade0 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ClassModel.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs index 5aa0304891cd..ef9e9d0a3843 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Dog.cs @@ -189,7 +189,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs index 7b1d1219ec89..ec785f28a54f 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumArrays.cs @@ -194,7 +194,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs index 0aa207868a40..c0420f83090d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/EnumTest.cs @@ -249,7 +249,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs index 23b46a64ea0b..916bd3ec1622 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/FormatTest.cs @@ -355,7 +355,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs index 267822e2caef..a8aacc186127 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/HasOnlyReadOnly.cs @@ -150,7 +150,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs index d5bda045c7c0..2a0afa0a13c1 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/List.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs index 50d26eaf5d03..1e3c9b537783 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MapTest.cs @@ -174,7 +174,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index d00ce61baa24..e485c0a08839 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -168,7 +168,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs index 230446b209e9..89b25b94367e 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Model200Response.cs @@ -153,7 +153,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs index 129ab5e7fd1f..d98021ff5533 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelClient.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs index f66bea7cedca..c19880adc384 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ModelReturn.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs index c01161fc305d..4cb27c59f036 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Name.cs @@ -192,7 +192,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs index 54b4b8526867..d352e4a45987 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/NumberOnly.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs index 7a219e9181f0..4e5c4c898ac9 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Order.cs @@ -249,7 +249,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs index 397e5a651fb8..305f6918a372 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Pet.cs @@ -262,7 +262,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs index 2c60d08a17b4..61e534f2f53c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/ReadOnlyFirst.cs @@ -151,7 +151,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs index 4a1b6d00f388..1bac10087c48 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/SpecialModelName.cs @@ -138,7 +138,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs index 6ebcccaa6b41..f1451c72cb0e 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Tag.cs @@ -153,7 +153,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs index 0554468e0f8a..44ec3bfcecf0 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/User.cs @@ -244,7 +244,7 @@ namespace IO.Swagger.Model /// /// To validate all properties of the instance /// - /// Validation context + /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { From 05c671aa5a4623b312634f7148ef8ebf41763979 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 28 Mar 2017 10:07:38 +0800 Subject: [PATCH 4/4] fix msf4j bin script --- bin/java-msf4j-petstore-server.sh | 2 +- samples/server/petstore/java-msf4j/pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/java-msf4j-petstore-server.sh b/bin/java-msf4j-petstore-server.sh index 724cbea00f3b..d73471b14d00 100755 --- a/bin/java-msf4j-petstore-server.sh +++ b/bin/java-msf4j-petstore-server.sh @@ -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 diff --git a/samples/server/petstore/java-msf4j/pom.xml b/samples/server/petstore/java-msf4j/pom.xml index 5fe8c46c238d..b1145335c66a 100644 --- a/samples/server/petstore/java-msf4j/pom.xml +++ b/samples/server/petstore/java-msf4j/pom.xml @@ -6,9 +6,9 @@ 4.0.0 io.swagger - swagger-jaxrs-server + swagger-msf4j-server jar - swagger-jaxrs-server + swagger-msf4j-server 1.0.0 src/main/java