diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index 4ea86f5cd6f..668b34a90ae 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -635,6 +635,8 @@ public class ApiClient { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); } else { throw new ApiException(500, "unknown method type " + method); } diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache index 6e5c1b74115..06c8e3048a0 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/pojo.mustache @@ -27,7 +27,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{/vars}} {{#vars}} - {{^isReadOnly}} public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; return this; @@ -47,7 +46,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali } {{/isMapContainer}} - {{/isReadOnly}} /** {{#description}} * {{{description}}} @@ -70,12 +68,10 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; } - {{^isReadOnly}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { this.{{name}} = {{name}}; } - {{/isReadOnly}} {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/dart/pubspec.mustache b/modules/swagger-codegen/src/main/resources/dart/pubspec.mustache index 1167498909e..ce0a309ea82 100644 --- a/modules/swagger-codegen/src/main/resources/dart/pubspec.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/pubspec.mustache @@ -4,7 +4,7 @@ description: {{pubDescription}} dependencies: http: '>=0.11.1 <0.12.0' dartson: "^0.2.4" - intl: "^0.12.4+2" + intl: ">=0.12.4" dev_dependencies: guinness: '^0.1.17' diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache index 1e66c83c769..b4213ff2056 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/api.mustache @@ -30,7 +30,7 @@ namespace {{packageName}}.{{packageContext}}.Modules {{/hasMore}}{{/isBodyParam}}{{/allParams}}{{#allParams}}{{#required}} Preconditions.IsNotNull({{paramName}}, "Required parameter: '{{paramName}}' is missing at '{{operationId}}'"); {{/required}}{{/allParams}} - {{#returnType}}return {{/returnType}}service.{{operationId}}(Context{{#allParams.0}}, {{/allParams.0}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{^returnType}} + {{#returnType}}return {{/returnType}}service.{{operationId}}(Context{{#allParams.0}}, {{/allParams.0}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}{{#isListContainer}}.ToArray(){{/isListContainer}}{{/returnType}};{{^returnType}} return new Response { ContentType = "{{produces.0.mediaType}}"};{{/returnType}} }; {{/operation}} diff --git a/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache b/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache index e55a82416ec..75486f59f46 100644 --- a/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache +++ b/modules/swagger-codegen/src/main/resources/nancyfx/parameters.mustache @@ -166,19 +166,19 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(LocalTime), SafeParse(ParseLocalTime)); parsers.Put(typeof(LocalTime?), SafeParse(ParseLocalTime)); - parsers.Put(typeof(IEnumerable), value => value); - parsers.Put(typeof(ICollection), value => value); - parsers.Put(typeof(IList), value => value); - parsers.Put(typeof(List), value => value); - parsers.Put(typeof(ISet), value => value); - parsers.Put(typeof(HashSet), value => value); + parsers.Put(typeof(IEnumerable), ImmutableListParse(value => value)); + parsers.Put(typeof(ICollection), ImmutableListParse(value => value)); + parsers.Put(typeof(IList), ImmutableListParse(value => value)); + parsers.Put(typeof(List), ListParse(value => value)); + parsers.Put(typeof(ISet), ImmutableListParse(value => value)); + parsers.Put(typeof(HashSet), SetParse(value => value)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(List), ListParse(bool.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(bool.Parse)); - parsers.Put(typeof(HashSet), SetParse(bool.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(List), NullableListParse(bool.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(bool.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(bool.Parse)); parsers.Put(typeof(IEnumerable), ImmutableListParse(byte.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(byte.Parse)); @@ -186,6 +186,7 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(List), ListParse(byte.Parse)); parsers.Put(typeof(ISet), ImmutableSetParse(byte.Parse)); parsers.Put(typeof(HashSet), SetParse(byte.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(sbyte.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(sbyte.Parse)); parsers.Put(typeof(IList), ImmutableListParse(sbyte.Parse)); @@ -199,6 +200,7 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(List), ListParse(short.Parse)); parsers.Put(typeof(ISet), ImmutableSetParse(short.Parse)); parsers.Put(typeof(HashSet), SetParse(short.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(ushort.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(ushort.Parse)); parsers.Put(typeof(IList), ImmutableListParse(ushort.Parse)); @@ -206,12 +208,13 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(ISet), ImmutableSetParse(ushort.Parse)); parsers.Put(typeof(HashSet), SetParse(ushort.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(int.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(int.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(int.Parse)); - parsers.Put(typeof(List), ListParse(int.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(int.Parse)); - parsers.Put(typeof(HashSet), SetParse(int.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(List), NullableListParse(int.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(int.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(int.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(uint.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(uint.Parse)); parsers.Put(typeof(IList), ImmutableListParse(uint.Parse)); @@ -219,12 +222,13 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(ISet), ImmutableSetParse(uint.Parse)); parsers.Put(typeof(HashSet), SetParse(uint.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(long.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(long.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(long.Parse)); - parsers.Put(typeof(List), ListParse(long.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(long.Parse)); - parsers.Put(typeof(HashSet), SetParse(long.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(List), NullableListParse(long.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(long.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(long.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(ulong.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(ulong.Parse)); parsers.Put(typeof(IList), ImmutableListParse(ulong.Parse)); @@ -232,34 +236,33 @@ namespace {{packageName}}.{{packageContext}}.Utils parsers.Put(typeof(ISet), ImmutableSetParse(ulong.Parse)); parsers.Put(typeof(HashSet), SetParse(ulong.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(float.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(float.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(float.Parse)); - parsers.Put(typeof(List), ListParse(float.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(float.Parse)); - parsers.Put(typeof(HashSet), SetParse(float.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(List), NullableListParse(float.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(float.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(float.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(double.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(double.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(double.Parse)); - parsers.Put(typeof(List), ListParse(double.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(double.Parse)); - parsers.Put(typeof(HashSet), SetParse(double.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(List), NullableListParse(double.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(double.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(double.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(List), ListParse(decimal.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(decimal.Parse)); - parsers.Put(typeof(HashSet), SetParse(decimal.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(List), NullableListParse(decimal.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(decimal.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(decimal.Parse)); - - parsers.Put(typeof(IEnumerable), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(List), ListParse(DateTime.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(DateTime.Parse)); - parsers.Put(typeof(HashSet), SetParse(DateTime.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(List), NullableListParse(DateTime.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(DateTime.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(DateTime.Parse)); parsers.Put(typeof(IEnumerable), ImmutableListParse(TimeSpan.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(TimeSpan.Parse)); @@ -295,6 +298,11 @@ namespace {{packageName}}.{{packageContext}}.Utils }; } + private static Func NullableListParse(Func itemParser) where T: struct + { + return ListParse(it => it.ToNullable(itemParser)); + } + private static Func ListParse(Func itemParser) { return parameter => @@ -303,15 +311,15 @@ namespace {{packageName}}.{{packageContext}}.Utils { return new List(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToList(); - return results; + return ParseCollection(parameter.Value, itemParser).ToList(); }; } + private static Func NullableImmutableListParse(Func itemParser) where T: struct + { + return ImmutableListParse(it => it.ToNullable(itemParser)); + } + private static Func ImmutableListParse(Func itemParser) { return parameter => @@ -320,15 +328,15 @@ namespace {{packageName}}.{{packageContext}}.Utils { return Lists.EmptyList(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToImmutableList(); - return results; + return ParseCollection(parameter.Value, itemParser).ToImmutableList(); }; } + private static Func NullableSetParse(Func itemParser) where T: struct + { + return SetParse(it => it.ToNullable(itemParser)); + } + private static Func SetParse(Func itemParser) { return parameter => @@ -337,15 +345,15 @@ namespace {{packageName}}.{{packageContext}}.Utils { return new HashSet(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToSet(); - return results; + return ParseCollection(parameter.Value, itemParser).ToSet(); }; } + private static Func NullableImmutableSetParse(Func itemParser) where T: struct + { + return ImmutableSetParse(it => it.ToNullable(itemParser)); + } + private static Func ImmutableSetParse(Func itemParser) { return parameter => @@ -354,12 +362,7 @@ namespace {{packageName}}.{{packageContext}}.Utils { return Sets.EmptySet(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToImmutableHashSet(); - return results; + return ParseCollection(parameter.Value, itemParser).ToImmutableHashSet(); }; } @@ -386,6 +389,32 @@ namespace {{packageName}}.{{packageContext}}.Utils parameter.Name, parameter.Value, type)); } + private static IEnumerable ParseCollection(string value, Func itemParser) + { + var results = value.Split(new[] { ',' }, StringSplitOptions.None) + .Where(it => it != null) + .Select(it => it.Trim()) + .Select(itemParser); + return results; + } + + public static T? ToNullable(this string s, Func itemParser) where T : struct + { + T? result = new T?(); + try + { + if (!string.IsNullOrEmpty(s) && s.Trim().Length > 0) + { + result = itemParser(s); + } + } + catch (Exception e) + { + throw new InvalidOperationException(Strings.Format("Unable to parse value: '{0}' to nullable: '{1}'", s, typeof(T).ToString()), e); + } + return result; + } + private class Parameter { internal string Name { get; private set; } diff --git a/samples/client/petstore/dart/swagger/pubspec.yaml b/samples/client/petstore/dart/swagger/pubspec.yaml index e74546ea210..8ad53b9d6e6 100644 --- a/samples/client/petstore/dart/swagger/pubspec.yaml +++ b/samples/client/petstore/dart/swagger/pubspec.yaml @@ -4,7 +4,7 @@ description: Swagger API client dependencies: http: '>=0.11.1 <0.12.0' dartson: "^0.2.4" - intl: "^0.12.4+2" + intl: ">=0.12.4" dev_dependencies: guinness: '^0.1.17' diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index 9012aff618e..29813bd9349 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -54,7 +54,7 @@ No authorization required # **testEndpointParameters** -> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password) +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -90,8 +90,9 @@ byte[] binary = B; // byte[] | None LocalDate date = new LocalDate(); // LocalDate | None DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password); + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testEndpointParameters"); e.printStackTrace(); @@ -115,6 +116,7 @@ Name | Type | Description | Notes **date** | **LocalDate**| None | [optional] **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey2/gradlew.bat b/samples/client/petstore/java/jersey2/gradlew.bat index 72d362dafd8..5f192121eb4 100644 --- a/samples/client/petstore/java/jersey2/gradlew.bat +++ b/samples/client/petstore/java/jersey2/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java index ec4fea20fad..5eb7e89e13e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java @@ -22,6 +22,7 @@ import org.glassfish.jersey.media.multipart.MultiPartFeature; import java.io.IOException; import java.io.InputStream; + import java.nio.file.Files; import java.util.Collection; import java.util.Collections; @@ -623,6 +624,8 @@ public class ApiClient { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); } else { throw new ApiException(500, "unknown method type " + method); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/RFC3339DateFormat.java index 3d287008be5..d662f9457d7 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/RFC3339DateFormat.java @@ -1,4 +1,4 @@ -/** +/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java index 70d8b276c1c..9c08693ef37 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -94,9 +94,10 @@ public class FakeApi { * @param date None (optional) * @param dateTime None (optional) * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -155,6 +156,8 @@ if (dateTime != null) localVarFormParams.put("dateTime", dateTime); if (password != null) localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); final String[] localVarAccepts = { "application/xml; charset=utf-8", "application/json; charset=utf-8" diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 2da13804a0d..21e4efaeaa2 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -34,12 +34,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - /** * AdditionalPropertiesClass */ -public class AdditionalPropertiesClass { +public class AdditionalPropertiesClass { @JsonProperty("map_property") private Map mapProperty = new HashMap(); @@ -111,6 +110,7 @@ public class AdditionalPropertiesClass { return Objects.hash(mapProperty, mapOfMapProperty); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -132,5 +132,6 @@ public class AdditionalPropertiesClass { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java index 346da224ad1..993f9bbe6f4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Animal */ -public class Animal { +public class Animal { @JsonProperty("className") private String className = null; @@ -98,6 +97,7 @@ public class Animal { return Objects.hash(className, color); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java index 563476ccb3d..181812be4f4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -30,12 +30,11 @@ import io.swagger.client.model.Animal; import java.util.ArrayList; import java.util.List; - /** * AnimalFarm */ -public class AnimalFarm extends ArrayList { +public class AnimalFarm extends ArrayList { @Override public boolean equals(java.lang.Object o) { @@ -53,6 +52,7 @@ public class AnimalFarm extends ArrayList { return Objects.hash(super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -72,5 +72,6 @@ public class AnimalFarm extends ArrayList { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index a99f2009385..c02b8e1a37f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; - /** * ArrayOfArrayOfNumberOnly */ -public class ArrayOfArrayOfNumberOnly { +public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") private List> arrayArrayNumber = new ArrayList>(); @@ -84,6 +83,7 @@ public class ArrayOfArrayOfNumberOnly { return Objects.hash(arrayArrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -104,5 +104,6 @@ public class ArrayOfArrayOfNumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index 1aaf27b9921..fe97b65e190 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; - /** * ArrayOfNumberOnly */ -public class ArrayOfNumberOnly { +public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") private List arrayNumber = new ArrayList(); @@ -84,6 +83,7 @@ public class ArrayOfNumberOnly { return Objects.hash(arrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -104,5 +104,6 @@ public class ArrayOfNumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java index 124d8bfa3a1..a035e8fe2f0 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java @@ -34,12 +34,11 @@ import io.swagger.client.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; - /** * ArrayTest */ -public class ArrayTest { +public class ArrayTest { @JsonProperty("array_of_string") private List arrayOfString = new ArrayList(); @@ -138,6 +137,7 @@ public class ArrayTest { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -160,5 +160,6 @@ public class ArrayTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java index 41dc312a10f..b2532f78f85 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - /** * Cat */ -public class Cat extends Animal { +public class Cat extends Animal { @JsonProperty("declawed") private Boolean declawed = null; @@ -78,6 +77,7 @@ public class Cat extends Animal { return Objects.hash(declawed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -98,5 +98,6 @@ public class Cat extends Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index ba4ce89c297..84def6a8dac 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Category */ -public class Category { +public class Category { @JsonProperty("id") private Long id = null; @@ -98,6 +97,7 @@ public class Category { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Category { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Client.java index 43ade4b6fcb..1540bc4d7de 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Client.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Client */ -public class Client { +public class Client { @JsonProperty("client") private String client = null; @@ -76,6 +75,7 @@ public class Client { return Objects.hash(client); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -96,5 +96,6 @@ public class Client { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java index 788aee5c226..d5e9063c988 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; - /** * Dog */ -public class Dog extends Animal { +public class Dog extends Animal { @JsonProperty("breed") private String breed = null; @@ -78,6 +77,7 @@ public class Dog extends Animal { return Objects.hash(breed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -98,5 +98,6 @@ public class Dog extends Animal { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumArrays.java index 45295c524f6..d8be37b302c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumArrays.java @@ -33,12 +33,11 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; - /** * EnumArrays */ -public class EnumArrays { +public class EnumArrays { /** * Gets or Sets justSymbol */ @@ -165,6 +164,7 @@ public class EnumArrays { return Objects.hash(justSymbol, arrayEnum); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -186,5 +186,6 @@ public class EnumArrays { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java index f9887c69340..c2f4ae53735 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumClass.java @@ -27,7 +27,6 @@ package io.swagger.client.model; import java.util.Objects; - import com.fasterxml.jackson.annotation.JsonCreator; /** diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java index a7268316c40..cf3cab66458 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * EnumTest */ -public class EnumTest { +public class EnumTest { /** * Gets or Sets enumString */ @@ -210,6 +209,7 @@ public class EnumTest { return Objects.hash(enumString, enumInteger, enumNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -232,5 +232,6 @@ public class EnumTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java index 2b5b4204281..df839b0898c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java @@ -34,12 +34,11 @@ import java.math.BigDecimal; import org.joda.time.DateTime; import org.joda.time.LocalDate; - /** * FormatTest */ -public class FormatTest { +public class FormatTest { @JsonProperty("integer") private Integer integer = null; @@ -353,6 +352,7 @@ public class FormatTest { return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -385,5 +385,6 @@ public class FormatTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index d874a545244..9f59c6a47bd 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * HasOnlyReadOnly */ -public class HasOnlyReadOnly { +public class HasOnlyReadOnly { @JsonProperty("bar") private String bar = null; @@ -80,6 +79,7 @@ public class HasOnlyReadOnly { return Objects.hash(bar, foo); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -101,5 +101,6 @@ public class HasOnlyReadOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MapTest.java index f8cf1ad5d1a..335dcb31cbf 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MapTest.java @@ -34,12 +34,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - /** * MapTest */ -public class MapTest { +public class MapTest { @JsonProperty("map_map_of_string") private Map> mapMapOfString = new HashMap>(); @@ -141,6 +140,7 @@ public class MapTest { return Objects.hash(mapMapOfString, mapOfEnumString); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -162,5 +162,6 @@ public class MapTest { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 20958fd50d8..af5292584ab 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -36,12 +36,11 @@ import java.util.List; import java.util.Map; import org.joda.time.DateTime; - /** * MixedPropertiesAndAdditionalPropertiesClass */ -public class MixedPropertiesAndAdditionalPropertiesClass { +public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") private String uuid = null; @@ -130,6 +129,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { return Objects.hash(uuid, dateTime, map); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -152,5 +152,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index 8f48dd8020e..e905b7f9183 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -public class Model200Response { +public class Model200Response { @JsonProperty("name") private Integer name = null; @@ -99,6 +98,7 @@ public class Model200Response { return Objects.hash(name, propertyClass); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,5 +120,6 @@ public class Model200Response { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java index 70ee2a834c0..f554939b898 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * ModelApiResponse */ -public class ModelApiResponse { +public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -120,6 +119,7 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -142,5 +142,6 @@ public class ModelApiResponse { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java index 28294a15090..5332ff4fe2b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -public class ModelReturn { +public class ModelReturn { @JsonProperty("return") private Integer _return = null; @@ -77,6 +76,7 @@ public class ModelReturn { return Objects.hash(_return); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -97,5 +97,6 @@ public class ModelReturn { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java index 4b70e8df1a6..d26b62921fa 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java @@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -public class Name { +public class Name { @JsonProperty("name") private Integer name = null; @@ -125,6 +124,7 @@ public class Name { return Objects.hash(name, snakeCase, property, _123Number); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -148,5 +148,6 @@ public class Name { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/NumberOnly.java index ad74058d2e5..3dc6009047f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/NumberOnly.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; - /** * NumberOnly */ -public class NumberOnly { +public class NumberOnly { @JsonProperty("JustNumber") private BigDecimal justNumber = null; @@ -77,6 +76,7 @@ public class NumberOnly { return Objects.hash(justNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -97,5 +97,6 @@ public class NumberOnly { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index 1616b030b9d..4eea9879c86 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime; - /** * Order */ -public class Order { +public class Order { @JsonProperty("id") private Long id = null; @@ -219,6 +218,7 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -244,5 +244,6 @@ public class Order { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index a89e0ea3e05..3ef257006ec 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -35,12 +35,11 @@ import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; - /** * Pet */ -public class Pet { +public class Pet { @JsonProperty("id") private Long id = null; @@ -232,6 +231,7 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -257,5 +257,6 @@ public class Pet { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 63e11bf14fd..0cbe504a297 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * ReadOnlyFirst */ -public class ReadOnlyFirst { +public class ReadOnlyFirst { @JsonProperty("bar") private String bar = null; @@ -89,6 +88,7 @@ public class ReadOnlyFirst { return Objects.hash(bar, baz); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -110,5 +110,6 @@ public class ReadOnlyFirst { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java index f8c5c06ca40..96bbd285945 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * SpecialModelName */ -public class SpecialModelName { +public class SpecialModelName { @JsonProperty("$special[property.name]") private Long specialPropertyName = null; @@ -76,6 +75,7 @@ public class SpecialModelName { return Objects.hash(specialPropertyName); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -96,5 +96,6 @@ public class SpecialModelName { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index 27be94678da..330d2c8faa1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * Tag */ -public class Tag { +public class Tag { @JsonProperty("id") private Long id = null; @@ -98,6 +97,7 @@ public class Tag { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,5 +119,6 @@ public class Tag { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index 84e3b147049..97fc77b476d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - /** * User */ -public class User { +public class User { @JsonProperty("id") private Long id = null; @@ -230,6 +229,7 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -257,5 +257,6 @@ public class User { } return o.toString().replace("\n", "\n "); } + } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java index 812ca04e270..dbdffde69ce 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java index 04c4ed27aa3..abe1992830a 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/nancyfx/IO.Swagger.sln b/samples/server/petstore/nancyfx/IO.Swagger.sln index e6fd22af6f6..09301395de7 100644 --- a/samples/server/petstore/nancyfx/IO.Swagger.sln +++ b/samples/server/petstore/nancyfx/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", "{7D50D142-14E1-4E99-842B-18D3AF159948}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{3B55ED13-A471-44B1-A8D5-C158723C0A0C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,17 +10,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -<<<<<<< HEAD -{7D50D142-14E1-4E99-842B-18D3AF159948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{7D50D142-14E1-4E99-842B-18D3AF159948}.Debug|Any CPU.Build.0 = Debug|Any CPU -{7D50D142-14E1-4E99-842B-18D3AF159948}.Release|Any CPU.ActiveCfg = Release|Any CPU -{7D50D142-14E1-4E99-842B-18D3AF159948}.Release|Any CPU.Build.0 = Release|Any CPU -======= -{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU -{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = Release|Any CPU -{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.Build.0 = Release|Any CPU ->>>>>>> 92c474b2c235f4635e4be43a97c7941fec64dc82 +{3B55ED13-A471-44B1-A8D5-C158723C0A0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{3B55ED13-A471-44B1-A8D5-C158723C0A0C}.Debug|Any CPU.Build.0 = Debug|Any CPU +{3B55ED13-A471-44B1-A8D5-C158723C0A0C}.Release|Any CPU.ActiveCfg = Release|Any CPU +{3B55ED13-A471-44B1-A8D5-C158723C0A0C}.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 @@ -29,4 +22,4 @@ EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj index 60535f7aae6..a103786b912 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {7D50D142-14E1-4E99-842B-18D3AF159948} + {3B55ED13-A471-44B1-A8D5-C158723C0A0C} Library Properties IO.Swagger.v2 @@ -63,3 +63,4 @@ + diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Modules/PetModule.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Modules/PetModule.cs index d6922531e24..edfa0ecac4a 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Modules/PetModule.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Modules/PetModule.cs @@ -55,7 +55,7 @@ namespace IO.Swagger.v2.Modules var status = Parameters.ValueOf(parameters, Context.Request, "status", ParameterType.Query); Preconditions.IsNotNull(status, "Required parameter: 'status' is missing at 'FindPetsByStatus'"); - return service.FindPetsByStatus(Context, status); + return service.FindPetsByStatus(Context, status).ToArray(); }; Get["/pet/findByTags"] = parameters => @@ -63,7 +63,7 @@ namespace IO.Swagger.v2.Modules var tags = Parameters.ValueOf>(parameters, Context.Request, "tags", ParameterType.Query); Preconditions.IsNotNull(tags, "Required parameter: 'tags' is missing at 'FindPetsByTags'"); - return service.FindPetsByTags(Context, tags); + return service.FindPetsByTags(Context, tags).ToArray(); }; Get["/pet/{petId}"] = parameters => diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs b/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs index 7f0e848f98a..6175758fd9a 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/Utils/Parameters.cs @@ -166,19 +166,19 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(LocalTime), SafeParse(ParseLocalTime)); parsers.Put(typeof(LocalTime?), SafeParse(ParseLocalTime)); - parsers.Put(typeof(IEnumerable), value => value); - parsers.Put(typeof(ICollection), value => value); - parsers.Put(typeof(IList), value => value); - parsers.Put(typeof(List), value => value); - parsers.Put(typeof(ISet), value => value); - parsers.Put(typeof(HashSet), value => value); + parsers.Put(typeof(IEnumerable), ImmutableListParse(value => value)); + parsers.Put(typeof(ICollection), ImmutableListParse(value => value)); + parsers.Put(typeof(IList), ImmutableListParse(value => value)); + parsers.Put(typeof(List), ListParse(value => value)); + parsers.Put(typeof(ISet), ImmutableListParse(value => value)); + parsers.Put(typeof(HashSet), SetParse(value => value)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(bool.Parse)); - parsers.Put(typeof(List), ListParse(bool.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(bool.Parse)); - parsers.Put(typeof(HashSet), SetParse(bool.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(bool.Parse)); + parsers.Put(typeof(List), NullableListParse(bool.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(bool.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(bool.Parse)); parsers.Put(typeof(IEnumerable), ImmutableListParse(byte.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(byte.Parse)); @@ -186,6 +186,7 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(List), ListParse(byte.Parse)); parsers.Put(typeof(ISet), ImmutableSetParse(byte.Parse)); parsers.Put(typeof(HashSet), SetParse(byte.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(sbyte.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(sbyte.Parse)); parsers.Put(typeof(IList), ImmutableListParse(sbyte.Parse)); @@ -199,6 +200,7 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(List), ListParse(short.Parse)); parsers.Put(typeof(ISet), ImmutableSetParse(short.Parse)); parsers.Put(typeof(HashSet), SetParse(short.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(ushort.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(ushort.Parse)); parsers.Put(typeof(IList), ImmutableListParse(ushort.Parse)); @@ -206,12 +208,13 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(ISet), ImmutableSetParse(ushort.Parse)); parsers.Put(typeof(HashSet), SetParse(ushort.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(int.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(int.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(int.Parse)); - parsers.Put(typeof(List), ListParse(int.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(int.Parse)); - parsers.Put(typeof(HashSet), SetParse(int.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(int.Parse)); + parsers.Put(typeof(List), NullableListParse(int.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(int.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(int.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(uint.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(uint.Parse)); parsers.Put(typeof(IList), ImmutableListParse(uint.Parse)); @@ -219,12 +222,13 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(ISet), ImmutableSetParse(uint.Parse)); parsers.Put(typeof(HashSet), SetParse(uint.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(long.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(long.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(long.Parse)); - parsers.Put(typeof(List), ListParse(long.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(long.Parse)); - parsers.Put(typeof(HashSet), SetParse(long.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(long.Parse)); + parsers.Put(typeof(List), NullableListParse(long.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(long.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(long.Parse)); + parsers.Put(typeof(IEnumerable), ImmutableListParse(ulong.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(ulong.Parse)); parsers.Put(typeof(IList), ImmutableListParse(ulong.Parse)); @@ -232,34 +236,33 @@ namespace IO.Swagger.v2.Utils parsers.Put(typeof(ISet), ImmutableSetParse(ulong.Parse)); parsers.Put(typeof(HashSet), SetParse(ulong.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(float.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(float.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(float.Parse)); - parsers.Put(typeof(List), ListParse(float.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(float.Parse)); - parsers.Put(typeof(HashSet), SetParse(float.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(float.Parse)); + parsers.Put(typeof(List), NullableListParse(float.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(float.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(float.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(double.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(double.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(double.Parse)); - parsers.Put(typeof(List), ListParse(double.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(double.Parse)); - parsers.Put(typeof(HashSet), SetParse(double.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(double.Parse)); + parsers.Put(typeof(List), NullableListParse(double.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(double.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(double.Parse)); - parsers.Put(typeof(IEnumerable), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(decimal.Parse)); - parsers.Put(typeof(List), ListParse(decimal.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(decimal.Parse)); - parsers.Put(typeof(HashSet), SetParse(decimal.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(decimal.Parse)); + parsers.Put(typeof(List), NullableListParse(decimal.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(decimal.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(decimal.Parse)); - - parsers.Put(typeof(IEnumerable), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(ICollection), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(IList), ImmutableListParse(DateTime.Parse)); - parsers.Put(typeof(List), ListParse(DateTime.Parse)); - parsers.Put(typeof(ISet), ImmutableSetParse(DateTime.Parse)); - parsers.Put(typeof(HashSet), SetParse(DateTime.Parse)); + parsers.Put(typeof(IEnumerable), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(ICollection), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(IList), NullableImmutableListParse(DateTime.Parse)); + parsers.Put(typeof(List), NullableListParse(DateTime.Parse)); + parsers.Put(typeof(ISet), NullableImmutableSetParse(DateTime.Parse)); + parsers.Put(typeof(HashSet), NullableSetParse(DateTime.Parse)); parsers.Put(typeof(IEnumerable), ImmutableListParse(TimeSpan.Parse)); parsers.Put(typeof(ICollection), ImmutableListParse(TimeSpan.Parse)); @@ -295,6 +298,11 @@ namespace IO.Swagger.v2.Utils }; } + private static Func NullableListParse(Func itemParser) where T: struct + { + return ListParse(it => it.ToNullable(itemParser)); + } + private static Func ListParse(Func itemParser) { return parameter => @@ -303,15 +311,15 @@ namespace IO.Swagger.v2.Utils { return new List(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToList(); - return results; + return ParseCollection(parameter.Value, itemParser).ToList(); }; } + private static Func NullableImmutableListParse(Func itemParser) where T: struct + { + return ImmutableListParse(it => it.ToNullable(itemParser)); + } + private static Func ImmutableListParse(Func itemParser) { return parameter => @@ -320,15 +328,15 @@ namespace IO.Swagger.v2.Utils { return Lists.EmptyList(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToImmutableList(); - return results; + return ParseCollection(parameter.Value, itemParser).ToImmutableList(); }; } + private static Func NullableSetParse(Func itemParser) where T: struct + { + return SetParse(it => it.ToNullable(itemParser)); + } + private static Func SetParse(Func itemParser) { return parameter => @@ -337,15 +345,15 @@ namespace IO.Swagger.v2.Utils { return new HashSet(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToSet(); - return results; + return ParseCollection(parameter.Value, itemParser).ToSet(); }; } + private static Func NullableImmutableSetParse(Func itemParser) where T: struct + { + return ImmutableSetParse(it => it.ToNullable(itemParser)); + } + private static Func ImmutableSetParse(Func itemParser) { return parameter => @@ -354,12 +362,7 @@ namespace IO.Swagger.v2.Utils { return Sets.EmptySet(); } - var results = parameter.Value.Split(new[] { ',' }, StringSplitOptions.None) - .Where(it => it != null) - .Select(it => it.Trim()) - .Select(itemParser) - .ToImmutableHashSet(); - return results; + return ParseCollection(parameter.Value, itemParser).ToImmutableHashSet(); }; } @@ -386,6 +389,32 @@ namespace IO.Swagger.v2.Utils parameter.Name, parameter.Value, type)); } + private static IEnumerable ParseCollection(string value, Func itemParser) + { + var results = value.Split(new[] { ',' }, StringSplitOptions.None) + .Where(it => it != null) + .Select(it => it.Trim()) + .Select(itemParser); + return results; + } + + public static T? ToNullable(this string s, Func itemParser) where T : struct + { + T? result = new T?(); + try + { + if (!string.IsNullOrEmpty(s) && s.Trim().Length > 0) + { + result = itemParser(s); + } + } + catch (Exception e) + { + throw new InvalidOperationException(Strings.Format("Unable to parse value: '{0}' to nullable: '{1}'", s, typeof(T).ToString()), e); + } + return result; + } + private class Parameter { internal string Name { get; private set; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java index 50f6497e2f1..835b83c6234 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Client; -import java.time.OffsetDateTime; import java.time.LocalDate; +import java.time.OffsetDateTime; import java.math.BigDecimal; import io.swagger.annotations.*; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index 6a8018d2c21..d87e7a68b65 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 3f5492a2e62..55817f8dd14 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -17,6 +17,11 @@ public class HasOnlyReadOnly { @JsonProperty("foo") private String foo = null; + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,15 @@ public class HasOnlyReadOnly { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + /** * Get foo * @return foo @@ -35,6 +49,10 @@ public class HasOnlyReadOnly { return foo; } + public void setFoo(String foo) { + this.foo = foo; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java index 09085fb52dc..aa31ac8d79a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java @@ -42,6 +42,11 @@ public class Name { this.name = name; } + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + /** * Get snakeCase * @return snakeCase @@ -51,6 +56,10 @@ public class Name { return snakeCase; } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + public Name property(String property) { this.property = property; return this; @@ -69,6 +78,11 @@ public class Name { this.property = property; } + public Name _123Number(Integer _123Number) { + this._123Number = _123Number; + return this; + } + /** * Get _123Number * @return _123Number @@ -78,6 +92,10 @@ public class Name { return _123Number; } + public void set123Number(Integer _123Number) { + this._123Number = _123Number; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java index 50a2a7e4184..76d529c087a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -17,6 +17,11 @@ public class ReadOnlyFirst { @JsonProperty("baz") private String baz = null; + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,10 @@ public class ReadOnlyFirst { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + public ReadOnlyFirst baz(String baz) { this.baz = baz; return this; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java index 8fe8f34bb31..24e32cf2341 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java @@ -2,8 +2,8 @@ package io.swagger.api; import io.swagger.model.Client; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java index f4adae4ec88..dcae4cacdc7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java @@ -2,8 +2,8 @@ package io.swagger.api; import io.swagger.model.Client; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import io.swagger.annotations.*; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 5b69114555e..3af82092a60 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java index 695d4cc2386..75de52391ac 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 3f5492a2e62..55817f8dd14 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -17,6 +17,11 @@ public class HasOnlyReadOnly { @JsonProperty("foo") private String foo = null; + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,15 @@ public class HasOnlyReadOnly { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + /** * Get foo * @return foo @@ -35,6 +49,10 @@ public class HasOnlyReadOnly { return foo; } + public void setFoo(String foo) { + this.foo = foo; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java index 09085fb52dc..aa31ac8d79a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java @@ -42,6 +42,11 @@ public class Name { this.name = name; } + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + /** * Get snakeCase * @return snakeCase @@ -51,6 +56,10 @@ public class Name { return snakeCase; } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + public Name property(String property) { this.property = property; return this; @@ -69,6 +78,11 @@ public class Name { this.property = property; } + public Name _123Number(Integer _123Number) { + this._123Number = _123Number; + return this; + } + /** * Get _123Number * @return _123Number @@ -78,6 +92,10 @@ public class Name { return _123Number; } + public void set123Number(Integer _123Number) { + this._123Number = _123Number; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java index 50a2a7e4184..76d529c087a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -17,6 +17,11 @@ public class ReadOnlyFirst { @JsonProperty("baz") private String baz = null; + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,10 @@ public class ReadOnlyFirst { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + public ReadOnlyFirst baz(String baz) { this.baz = baz; return this; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index 8fe8f34bb31..24e32cf2341 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -2,8 +2,8 @@ package io.swagger.api; import io.swagger.model.Client; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index f4adae4ec88..dcae4cacdc7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -2,8 +2,8 @@ package io.swagger.api; import io.swagger.model.Client; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import io.swagger.annotations.*; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 5b69114555e..3af82092a60 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java index 695d4cc2386..75de52391ac 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -1,8 +1,8 @@ package io.swagger.api; import io.swagger.model.Pet; -import io.swagger.model.ModelApiResponse; import java.io.File; +import io.swagger.model.ModelApiResponse; import io.swagger.annotations.*; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 3f5492a2e62..55817f8dd14 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -17,6 +17,11 @@ public class HasOnlyReadOnly { @JsonProperty("foo") private String foo = null; + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,15 @@ public class HasOnlyReadOnly { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + /** * Get foo * @return foo @@ -35,6 +49,10 @@ public class HasOnlyReadOnly { return foo; } + public void setFoo(String foo) { + this.foo = foo; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java index 09085fb52dc..aa31ac8d79a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java @@ -42,6 +42,11 @@ public class Name { this.name = name; } + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + /** * Get snakeCase * @return snakeCase @@ -51,6 +56,10 @@ public class Name { return snakeCase; } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + public Name property(String property) { this.property = property; return this; @@ -69,6 +78,11 @@ public class Name { this.property = property; } + public Name _123Number(Integer _123Number) { + this._123Number = _123Number; + return this; + } + /** * Get _123Number * @return _123Number @@ -78,6 +92,10 @@ public class Name { return _123Number; } + public void set123Number(Integer _123Number) { + this._123Number = _123Number; + } + @Override public boolean equals(java.lang.Object o) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java index 50a2a7e4184..76d529c087a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -17,6 +17,11 @@ public class ReadOnlyFirst { @JsonProperty("baz") private String baz = null; + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + /** * Get bar * @return bar @@ -26,6 +31,10 @@ public class ReadOnlyFirst { return bar; } + public void setBar(String bar) { + this.bar = bar; + } + public ReadOnlyFirst baz(String baz) { this.baz = baz; return this;