diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index 3eba155581b..23bfb825bea 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -2947,7 +2947,7 @@ public class DefaultCodegen { m = p.matcher(word); } - if (lowercaseFirstLetter) { + if (lowercaseFirstLetter && word.length() > 0) { word = word.substring(0, 1).toLowerCase() + word.substring(1); } 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/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/modules/swagger-codegen/src/main/resources/ruby/api.mustache b/modules/swagger-codegen/src/main/resources/ruby/api.mustache index 7071e72e849..8366246f467 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api.mustache @@ -50,9 +50,16 @@ module {{moduleName}} {{/required}} {{^required}} {{#isEnum}} + {{#collectionFormat}} + if opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all?{|item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item)} + fail ArgumentError, 'invalid value for "{{{paramName}}}", must include one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}' + end + {{/collectionFormat}} + {{^collectionFormat}} if opts[:'{{{paramName}}}'] && ![{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(opts[:'{{{paramName}}}']) fail ArgumentError, 'invalid value for "{{{paramName}}}", must be one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}' end + {{/collectionFormat}} {{/isEnum}} {{/required}} {{#hasValidation}} diff --git a/pom.xml b/pom.xml index 894931d4e80..b5310be9090 100644 --- a/pom.xml +++ b/pom.xml @@ -807,7 +807,7 @@ - 1.0.23 + 1.0.24-SNAPSHOT 2.11.1 2.3.4 1.5.10 diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 0eaba370798..3500dfbb52f 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -275,20 +275,20 @@ module Petstore if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FakeApi.test_enum_parameters ..." end - if opts[:'enum_form_string_array'] && !['>', '$'].include?(opts[:'enum_form_string_array']) - fail ArgumentError, 'invalid value for "enum_form_string_array", must be one of >, $' + if opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all?{|item| ['>', '$'].include?(item)} + fail ArgumentError, 'invalid value for "enum_form_string_array", must include one of >, $' end if opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string']) fail ArgumentError, 'invalid value for "enum_form_string", must be one of _abc, -efg, (xyz)' end - if opts[:'enum_header_string_array'] && !['>', '$'].include?(opts[:'enum_header_string_array']) - fail ArgumentError, 'invalid value for "enum_header_string_array", must be one of >, $' + if opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all?{|item| ['>', '$'].include?(item)} + fail ArgumentError, 'invalid value for "enum_header_string_array", must include one of >, $' end if opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string']) fail ArgumentError, 'invalid value for "enum_header_string", must be one of _abc, -efg, (xyz)' end - if opts[:'enum_query_string_array'] && !['>', '$'].include?(opts[:'enum_query_string_array']) - fail ArgumentError, 'invalid value for "enum_query_string_array", must be one of >, $' + if opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all?{|item| ['>', '$'].include?(item)} + fail ArgumentError, 'invalid value for "enum_query_string_array", must include one of >, $' end if opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string']) fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)' 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/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/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;