mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
636623d0e9
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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}}
|
||||
|
||||
|
@ -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}}
|
||||
|
@ -166,19 +166,19 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(LocalTime), SafeParse(ParseLocalTime));
|
||||
parsers.Put(typeof(LocalTime?), SafeParse(ParseLocalTime));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<string>), value => value);
|
||||
parsers.Put(typeof(ICollection<string>), value => value);
|
||||
parsers.Put(typeof(IList<string>), value => value);
|
||||
parsers.Put(typeof(List<string>), value => value);
|
||||
parsers.Put(typeof(ISet<string>), value => value);
|
||||
parsers.Put(typeof(HashSet<string>), value => value);
|
||||
parsers.Put(typeof(IEnumerable<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(ICollection<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(IList<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(List<string>), ListParse(value => value));
|
||||
parsers.Put(typeof(ISet<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(HashSet<string>), SetParse(value => value));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ICollection<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(IList<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(List<bool>), ListParse(bool.Parse));
|
||||
parsers.Put(typeof(ISet<bool>), ImmutableSetParse(bool.Parse));
|
||||
parsers.Put(typeof(HashSet<bool>), SetParse(bool.Parse));
|
||||
parsers.Put(typeof(IEnumerable<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ICollection<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(IList<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(List<bool?>), NullableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ISet<bool?>), NullableImmutableSetParse(bool.Parse));
|
||||
parsers.Put(typeof(HashSet<bool?>), NullableSetParse(bool.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<byte>), ImmutableListParse(byte.Parse));
|
||||
parsers.Put(typeof(ICollection<byte>), ImmutableListParse(byte.Parse));
|
||||
@ -186,6 +186,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(List<byte>), ListParse(byte.Parse));
|
||||
parsers.Put(typeof(ISet<byte>), ImmutableSetParse(byte.Parse));
|
||||
parsers.Put(typeof(HashSet<byte>), SetParse(byte.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
parsers.Put(typeof(ICollection<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
parsers.Put(typeof(IList<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
@ -199,6 +200,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(List<short>), ListParse(short.Parse));
|
||||
parsers.Put(typeof(ISet<short>), ImmutableSetParse(short.Parse));
|
||||
parsers.Put(typeof(HashSet<short>), SetParse(short.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<ushort>), ImmutableListParse(ushort.Parse));
|
||||
parsers.Put(typeof(ICollection<ushort>), ImmutableListParse(ushort.Parse));
|
||||
parsers.Put(typeof(IList<ushort>), ImmutableListParse(ushort.Parse));
|
||||
@ -206,12 +208,13 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(ISet<ushort>), ImmutableSetParse(ushort.Parse));
|
||||
parsers.Put(typeof(HashSet<ushort>), SetParse(ushort.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(ICollection<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(IList<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(List<int>), ListParse(int.Parse));
|
||||
parsers.Put(typeof(ISet<int>), ImmutableSetParse(int.Parse));
|
||||
parsers.Put(typeof(HashSet<int>), SetParse(int.Parse));
|
||||
parsers.Put(typeof(IEnumerable<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(ICollection<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(IList<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(List<int?>), NullableListParse(int.Parse));
|
||||
parsers.Put(typeof(ISet<int?>), NullableImmutableSetParse(int.Parse));
|
||||
parsers.Put(typeof(HashSet<int?>), NullableSetParse(int.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<uint>), ImmutableListParse(uint.Parse));
|
||||
parsers.Put(typeof(ICollection<uint>), ImmutableListParse(uint.Parse));
|
||||
parsers.Put(typeof(IList<uint>), ImmutableListParse(uint.Parse));
|
||||
@ -219,12 +222,13 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(ISet<uint>), ImmutableSetParse(uint.Parse));
|
||||
parsers.Put(typeof(HashSet<uint>), SetParse(uint.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(ICollection<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(IList<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(List<long>), ListParse(long.Parse));
|
||||
parsers.Put(typeof(ISet<long>), ImmutableSetParse(long.Parse));
|
||||
parsers.Put(typeof(HashSet<long>), SetParse(long.Parse));
|
||||
parsers.Put(typeof(IEnumerable<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(ICollection<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(IList<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(List<long?>), NullableListParse(long.Parse));
|
||||
parsers.Put(typeof(ISet<long?>), NullableImmutableSetParse(long.Parse));
|
||||
parsers.Put(typeof(HashSet<long?>), NullableSetParse(long.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<ulong>), ImmutableListParse(ulong.Parse));
|
||||
parsers.Put(typeof(ICollection<ulong>), ImmutableListParse(ulong.Parse));
|
||||
parsers.Put(typeof(IList<ulong>), ImmutableListParse(ulong.Parse));
|
||||
@ -232,34 +236,33 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
parsers.Put(typeof(ISet<ulong>), ImmutableSetParse(ulong.Parse));
|
||||
parsers.Put(typeof(HashSet<ulong>), SetParse(ulong.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(ICollection<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(IList<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(List<float>), ListParse(float.Parse));
|
||||
parsers.Put(typeof(ISet<float>), ImmutableSetParse(float.Parse));
|
||||
parsers.Put(typeof(HashSet<float>), SetParse(float.Parse));
|
||||
parsers.Put(typeof(IEnumerable<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(ICollection<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(IList<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(List<float?>), NullableListParse(float.Parse));
|
||||
parsers.Put(typeof(ISet<float?>), NullableImmutableSetParse(float.Parse));
|
||||
parsers.Put(typeof(HashSet<float?>), NullableSetParse(float.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(ICollection<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(IList<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(List<double>), ListParse(double.Parse));
|
||||
parsers.Put(typeof(ISet<double>), ImmutableSetParse(double.Parse));
|
||||
parsers.Put(typeof(HashSet<double>), SetParse(double.Parse));
|
||||
parsers.Put(typeof(IEnumerable<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(ICollection<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(IList<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(List<double?>), NullableListParse(double.Parse));
|
||||
parsers.Put(typeof(ISet<double?>), NullableImmutableSetParse(double.Parse));
|
||||
parsers.Put(typeof(HashSet<double?>), NullableSetParse(double.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ICollection<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(IList<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(List<decimal>), ListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ISet<decimal>), ImmutableSetParse(decimal.Parse));
|
||||
parsers.Put(typeof(HashSet<decimal>), SetParse(decimal.Parse));
|
||||
parsers.Put(typeof(IEnumerable<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ICollection<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(IList<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(List<decimal?>), NullableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ISet<decimal?>), NullableImmutableSetParse(decimal.Parse));
|
||||
parsers.Put(typeof(HashSet<decimal?>), NullableSetParse(decimal.Parse));
|
||||
|
||||
|
||||
parsers.Put(typeof(IEnumerable<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ICollection<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IList<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(List<DateTime>), ListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ISet<DateTime>), ImmutableSetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(HashSet<DateTime>), SetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IEnumerable<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ICollection<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IList<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(List<DateTime?>), NullableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ISet<DateTime?>), NullableImmutableSetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(HashSet<DateTime?>), NullableSetParse(DateTime.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<TimeSpan>), ImmutableListParse(TimeSpan.Parse));
|
||||
parsers.Put(typeof(ICollection<TimeSpan>), ImmutableListParse(TimeSpan.Parse));
|
||||
@ -295,6 +298,11 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
};
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> NullableListParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ListParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ListParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -303,15 +311,15 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
{
|
||||
return new List<T>();
|
||||
}
|
||||
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<Parameter, object> NullableImmutableListParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ImmutableListParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ImmutableListParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -320,15 +328,15 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
{
|
||||
return Lists.EmptyList<T>();
|
||||
}
|
||||
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<Parameter, object> NullableSetParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return SetParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> SetParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -337,15 +345,15 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
{
|
||||
return new HashSet<T>();
|
||||
}
|
||||
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<Parameter, object> NullableImmutableSetParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ImmutableSetParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ImmutableSetParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -354,12 +362,7 @@ namespace {{packageName}}.{{packageContext}}.Utils
|
||||
{
|
||||
return Sets.EmptySet<T>();
|
||||
}
|
||||
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<T> ParseCollection<T>(string value, Func<string, T> itemParser)
|
||||
{
|
||||
var results = value.Split(new[] { ',' }, StringSplitOptions.None)
|
||||
.Where(it => it != null)
|
||||
.Select(it => it.Trim())
|
||||
.Select(itemParser);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static T? ToNullable<T>(this string s, Func<string, T> 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; }
|
||||
|
@ -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}}
|
||||
|
2
pom.xml
2
pom.xml
@ -807,7 +807,7 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<swagger-parser-version>1.0.23</swagger-parser-version>
|
||||
<swagger-parser-version>1.0.24-SNAPSHOT</swagger-parser-version>
|
||||
<scala-version>2.11.1</scala-version>
|
||||
<felix-version>2.3.4</felix-version>
|
||||
<swagger-core-version>1.5.10</swagger-core-version>
|
||||
|
@ -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)'
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7D50D142-14E1-4E99-842B-18D3AF159948}</ProjectGuid>
|
||||
<ProjectGuid>{3B55ED13-A471-44B1-A8D5-C158723C0A0C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IO.Swagger.v2</RootNamespace>
|
||||
@ -63,3 +63,4 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace IO.Swagger.v2.Modules
|
||||
var status = Parameters.ValueOf<FindPetsByStatusStatusEnum?>(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<List<string>>(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 =>
|
||||
|
@ -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<string>), value => value);
|
||||
parsers.Put(typeof(ICollection<string>), value => value);
|
||||
parsers.Put(typeof(IList<string>), value => value);
|
||||
parsers.Put(typeof(List<string>), value => value);
|
||||
parsers.Put(typeof(ISet<string>), value => value);
|
||||
parsers.Put(typeof(HashSet<string>), value => value);
|
||||
parsers.Put(typeof(IEnumerable<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(ICollection<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(IList<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(List<string>), ListParse(value => value));
|
||||
parsers.Put(typeof(ISet<string>), ImmutableListParse(value => value));
|
||||
parsers.Put(typeof(HashSet<string>), SetParse(value => value));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ICollection<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(IList<bool>), ImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(List<bool>), ListParse(bool.Parse));
|
||||
parsers.Put(typeof(ISet<bool>), ImmutableSetParse(bool.Parse));
|
||||
parsers.Put(typeof(HashSet<bool>), SetParse(bool.Parse));
|
||||
parsers.Put(typeof(IEnumerable<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ICollection<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(IList<bool?>), NullableImmutableListParse(bool.Parse));
|
||||
parsers.Put(typeof(List<bool?>), NullableListParse(bool.Parse));
|
||||
parsers.Put(typeof(ISet<bool?>), NullableImmutableSetParse(bool.Parse));
|
||||
parsers.Put(typeof(HashSet<bool?>), NullableSetParse(bool.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<byte>), ImmutableListParse(byte.Parse));
|
||||
parsers.Put(typeof(ICollection<byte>), ImmutableListParse(byte.Parse));
|
||||
@ -186,6 +186,7 @@ namespace IO.Swagger.v2.Utils
|
||||
parsers.Put(typeof(List<byte>), ListParse(byte.Parse));
|
||||
parsers.Put(typeof(ISet<byte>), ImmutableSetParse(byte.Parse));
|
||||
parsers.Put(typeof(HashSet<byte>), SetParse(byte.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
parsers.Put(typeof(ICollection<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
parsers.Put(typeof(IList<sbyte>), ImmutableListParse(sbyte.Parse));
|
||||
@ -199,6 +200,7 @@ namespace IO.Swagger.v2.Utils
|
||||
parsers.Put(typeof(List<short>), ListParse(short.Parse));
|
||||
parsers.Put(typeof(ISet<short>), ImmutableSetParse(short.Parse));
|
||||
parsers.Put(typeof(HashSet<short>), SetParse(short.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<ushort>), ImmutableListParse(ushort.Parse));
|
||||
parsers.Put(typeof(ICollection<ushort>), ImmutableListParse(ushort.Parse));
|
||||
parsers.Put(typeof(IList<ushort>), ImmutableListParse(ushort.Parse));
|
||||
@ -206,12 +208,13 @@ namespace IO.Swagger.v2.Utils
|
||||
parsers.Put(typeof(ISet<ushort>), ImmutableSetParse(ushort.Parse));
|
||||
parsers.Put(typeof(HashSet<ushort>), SetParse(ushort.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(ICollection<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(IList<int>), ImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(List<int>), ListParse(int.Parse));
|
||||
parsers.Put(typeof(ISet<int>), ImmutableSetParse(int.Parse));
|
||||
parsers.Put(typeof(HashSet<int>), SetParse(int.Parse));
|
||||
parsers.Put(typeof(IEnumerable<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(ICollection<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(IList<int?>), NullableImmutableListParse(int.Parse));
|
||||
parsers.Put(typeof(List<int?>), NullableListParse(int.Parse));
|
||||
parsers.Put(typeof(ISet<int?>), NullableImmutableSetParse(int.Parse));
|
||||
parsers.Put(typeof(HashSet<int?>), NullableSetParse(int.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<uint>), ImmutableListParse(uint.Parse));
|
||||
parsers.Put(typeof(ICollection<uint>), ImmutableListParse(uint.Parse));
|
||||
parsers.Put(typeof(IList<uint>), ImmutableListParse(uint.Parse));
|
||||
@ -219,12 +222,13 @@ namespace IO.Swagger.v2.Utils
|
||||
parsers.Put(typeof(ISet<uint>), ImmutableSetParse(uint.Parse));
|
||||
parsers.Put(typeof(HashSet<uint>), SetParse(uint.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(ICollection<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(IList<long>), ImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(List<long>), ListParse(long.Parse));
|
||||
parsers.Put(typeof(ISet<long>), ImmutableSetParse(long.Parse));
|
||||
parsers.Put(typeof(HashSet<long>), SetParse(long.Parse));
|
||||
parsers.Put(typeof(IEnumerable<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(ICollection<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(IList<long?>), NullableImmutableListParse(long.Parse));
|
||||
parsers.Put(typeof(List<long?>), NullableListParse(long.Parse));
|
||||
parsers.Put(typeof(ISet<long?>), NullableImmutableSetParse(long.Parse));
|
||||
parsers.Put(typeof(HashSet<long?>), NullableSetParse(long.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<ulong>), ImmutableListParse(ulong.Parse));
|
||||
parsers.Put(typeof(ICollection<ulong>), ImmutableListParse(ulong.Parse));
|
||||
parsers.Put(typeof(IList<ulong>), ImmutableListParse(ulong.Parse));
|
||||
@ -232,34 +236,33 @@ namespace IO.Swagger.v2.Utils
|
||||
parsers.Put(typeof(ISet<ulong>), ImmutableSetParse(ulong.Parse));
|
||||
parsers.Put(typeof(HashSet<ulong>), SetParse(ulong.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(ICollection<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(IList<float>), ImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(List<float>), ListParse(float.Parse));
|
||||
parsers.Put(typeof(ISet<float>), ImmutableSetParse(float.Parse));
|
||||
parsers.Put(typeof(HashSet<float>), SetParse(float.Parse));
|
||||
parsers.Put(typeof(IEnumerable<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(ICollection<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(IList<float?>), NullableImmutableListParse(float.Parse));
|
||||
parsers.Put(typeof(List<float?>), NullableListParse(float.Parse));
|
||||
parsers.Put(typeof(ISet<float?>), NullableImmutableSetParse(float.Parse));
|
||||
parsers.Put(typeof(HashSet<float?>), NullableSetParse(float.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(ICollection<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(IList<double>), ImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(List<double>), ListParse(double.Parse));
|
||||
parsers.Put(typeof(ISet<double>), ImmutableSetParse(double.Parse));
|
||||
parsers.Put(typeof(HashSet<double>), SetParse(double.Parse));
|
||||
parsers.Put(typeof(IEnumerable<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(ICollection<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(IList<double?>), NullableImmutableListParse(double.Parse));
|
||||
parsers.Put(typeof(List<double?>), NullableListParse(double.Parse));
|
||||
parsers.Put(typeof(ISet<double?>), NullableImmutableSetParse(double.Parse));
|
||||
parsers.Put(typeof(HashSet<double?>), NullableSetParse(double.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ICollection<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(IList<decimal>), ImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(List<decimal>), ListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ISet<decimal>), ImmutableSetParse(decimal.Parse));
|
||||
parsers.Put(typeof(HashSet<decimal>), SetParse(decimal.Parse));
|
||||
parsers.Put(typeof(IEnumerable<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ICollection<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(IList<decimal?>), NullableImmutableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(List<decimal?>), NullableListParse(decimal.Parse));
|
||||
parsers.Put(typeof(ISet<decimal?>), NullableImmutableSetParse(decimal.Parse));
|
||||
parsers.Put(typeof(HashSet<decimal?>), NullableSetParse(decimal.Parse));
|
||||
|
||||
|
||||
parsers.Put(typeof(IEnumerable<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ICollection<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IList<DateTime>), ImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(List<DateTime>), ListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ISet<DateTime>), ImmutableSetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(HashSet<DateTime>), SetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IEnumerable<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ICollection<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(IList<DateTime?>), NullableImmutableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(List<DateTime?>), NullableListParse(DateTime.Parse));
|
||||
parsers.Put(typeof(ISet<DateTime?>), NullableImmutableSetParse(DateTime.Parse));
|
||||
parsers.Put(typeof(HashSet<DateTime?>), NullableSetParse(DateTime.Parse));
|
||||
|
||||
parsers.Put(typeof(IEnumerable<TimeSpan>), ImmutableListParse(TimeSpan.Parse));
|
||||
parsers.Put(typeof(ICollection<TimeSpan>), ImmutableListParse(TimeSpan.Parse));
|
||||
@ -295,6 +298,11 @@ namespace IO.Swagger.v2.Utils
|
||||
};
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> NullableListParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ListParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ListParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -303,15 +311,15 @@ namespace IO.Swagger.v2.Utils
|
||||
{
|
||||
return new List<T>();
|
||||
}
|
||||
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<Parameter, object> NullableImmutableListParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ImmutableListParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ImmutableListParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -320,15 +328,15 @@ namespace IO.Swagger.v2.Utils
|
||||
{
|
||||
return Lists.EmptyList<T>();
|
||||
}
|
||||
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<Parameter, object> NullableSetParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return SetParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> SetParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -337,15 +345,15 @@ namespace IO.Swagger.v2.Utils
|
||||
{
|
||||
return new HashSet<T>();
|
||||
}
|
||||
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<Parameter, object> NullableImmutableSetParse<T>(Func<string, T> itemParser) where T: struct
|
||||
{
|
||||
return ImmutableSetParse(it => it.ToNullable(itemParser));
|
||||
}
|
||||
|
||||
private static Func<Parameter, object> ImmutableSetParse<T>(Func<string, T> itemParser)
|
||||
{
|
||||
return parameter =>
|
||||
@ -354,12 +362,7 @@ namespace IO.Swagger.v2.Utils
|
||||
{
|
||||
return Sets.EmptySet<T>();
|
||||
}
|
||||
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<T> ParseCollection<T>(string value, Func<string, T> itemParser)
|
||||
{
|
||||
var results = value.Split(new[] { ',' }, StringSplitOptions.None)
|
||||
.Where(it => it != null)
|
||||
.Select(it => it.Trim())
|
||||
.Select(itemParser);
|
||||
return results;
|
||||
}
|
||||
|
||||
public static T? ToNullable<T>(this string s, Func<string, T> 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; }
|
||||
|
@ -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.*;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.*;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.*;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user