From a56d927b0cff26d1f933a8e6919f5143030e570b Mon Sep 17 00:00:00 2001 From: Malcolm Barclay Date: Fri, 27 May 2016 06:48:39 +0100 Subject: [PATCH 01/67] Added date format string #2935 Support decoding of RFC3339 compliant date-time strings with fractional seconds, but no timezone. --- .../src/main/resources/swift/Models.mustache | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift/Models.mustache b/modules/swagger-codegen/src/main/resources/swift/Models.mustache index 49798250e72..17b9c2cd276 100644 --- a/modules/swagger-codegen/src/main/resources/swift/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/Models.mustache @@ -34,17 +34,17 @@ public class Response { private var once = dispatch_once_t() class Decoders { static private var decoders = Dictionary AnyObject)>() - + static func addDecoder(clazz clazz: T.Type, decoder: ((AnyObject) -> T)) { let key = "\(T.self)" decoders[key] = { decoder($0) as! AnyObject } } - + static func decode(clazz clazz: [T].Type, source: AnyObject) -> [T] { let array = source as! [AnyObject] return array.map { Decoders.decode(clazz: T.self, source: $0) } } - + static func decode(clazz clazz: [Key:T].Type, source: AnyObject) -> [Key:T] { let sourceDictionary = source as! [Key: AnyObject] var dictionary = [Key:T]() @@ -53,7 +53,7 @@ class Decoders { } return dictionary } - + static func decode(clazz clazz: T.Type, source: AnyObject) -> T { initialize() if T.self is Int32.Type && source is NSNumber { @@ -65,7 +65,7 @@ class Decoders { if source is T { return source as! T } - + let key = "\(T.self)" if let decoder = decoders[key] { return decoder(source) as! T @@ -100,14 +100,15 @@ class Decoders { Decoders.decode(clazz: clazz, source: someSource) } } - + static private func initialize() { dispatch_once(&once) { let formatters = [ "yyyy-MM-dd", "yyyy-MM-dd'T'HH:mm:ssZZZZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", - "yyyy-MM-dd'T'HH:mm:ss'Z'" + "yyyy-MM-dd'T'HH:mm:ss'Z'", + "yyyy-MM-dd'T'HH:mm:ss.SSS" ].map { (format: String) -> NSDateFormatter in let formatter = NSDateFormatter() formatter.dateFormat = format @@ -121,7 +122,7 @@ class Decoders { return date } } - + } if let sourceInt = source as? Int { // treat as a java date From fafcd33e276faf28966813a6e81f19d1a2b7c242 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Fri, 27 May 2016 22:10:06 -0400 Subject: [PATCH 02/67] [csharp] Intercept hooks for req/res and ExceptionFactory --- .../languages/CSharpClientCodegen.java | 2 + .../main/resources/csharp/ApiClient.mustache | 22 +++++++++- .../resources/csharp/Configuration.mustache | 11 +++++ .../csharp/ExceptionFactory.mustache | 7 ++++ .../src/main/resources/csharp/api.mustache | 40 +++++++++++++++---- 5 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index e926235ba90..7546d89e968 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -233,6 +233,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { clientPackageDir, "ApiException.cs")); supportingFiles.add(new SupportingFile("ApiResponse.mustache", clientPackageDir, "ApiResponse.cs")); + supportingFiles.add(new SupportingFile("ExceptionFactory.mustache", + clientPackageDir, "ExceptionFactory.cs")); supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 1d34ff21eae..6ab34216b9f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -17,15 +17,28 @@ using RestSharp; namespace {{packageName}}.Client { /// - /// API client is mainly responible for making the HTTP call to the API backend. + /// API client is mainly responsible for making the HTTP call to the API backend. /// - public class ApiClient + public partial class ApiClient { private JsonSerializerSettings serializerSettings = new JsonSerializerSettings { ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor }; + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(IRestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(IRestRequest request, IRestResponse response); + /// /// Initializes a new instance of the class /// with default configuration and base path ({{basePath}}). @@ -165,6 +178,7 @@ namespace {{packageName}}.Client // set user agent RestClient.UserAgent = Configuration.UserAgent; + InterceptRequest(request); {{^supportsUWP}} var response = RestClient.Execute(request); {{/supportsUWP}} @@ -172,6 +186,8 @@ namespace {{packageName}}.Client // Using async method to perform sync call (uwp-only) var response = RestClient.ExecuteTaskAsync(request).Result; {{/supportsUWP}} + InterceptResponse(request, response); + return (Object) response; } {{#supportsAsync}} @@ -197,7 +213,9 @@ namespace {{packageName}}.Client var request = PrepareRequest( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + InterceptRequest(request); var response = await RestClient.ExecuteTaskAsync(request); + InterceptResponse(request, response); return (Object)response; }{{/supportsAsync}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index eddb9d0de1f..48b2886f6c9 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -80,6 +80,17 @@ namespace {{packageName}}.Client /// Configuration. public static Configuration Default = new Configuration(); + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + int status = (int) response.StatusCode; + if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); + if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); + return null; + }; + /// /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. /// diff --git a/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache b/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache new file mode 100644 index 00000000000..ad3cd2ac02f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache @@ -0,0 +1,7 @@ +using System; +using RestSharp; + +namespace {{packageName}}.Client +{ + public delegate Exception ExceptionFactory(string methodName, IRestResponse response); +} diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache index 1145421d22d..807155e4a45 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache @@ -75,6 +75,8 @@ namespace {{packageName}}.Api /// public partial class {{classname}} : I{{classname}} { + private {{packageName}}.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// /// Initializes a new instance of the class. /// @@ -83,6 +85,8 @@ namespace {{packageName}}.Api { this.Configuration = new Configuration(new ApiClient(basePath)); + ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -103,6 +107,8 @@ namespace {{packageName}}.Api else this.Configuration = configuration; + ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -135,6 +141,22 @@ namespace {{packageName}}.Api /// An instance of the Configuration public Configuration Configuration {get; set;} + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public {{packageName}}.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// /// Gets the default header. /// @@ -276,10 +298,11 @@ namespace {{packageName}}.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling {{operationId}}: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling {{operationId}}: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("{{operationId}}", localVarResponse); + if (exception != null) throw exception; + } {{#returnType}}return new ApiResponse<{{{returnType}}}>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -410,10 +433,11 @@ namespace {{packageName}}.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling {{operationId}}: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling {{operationId}}: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("{{operationId}}", localVarResponse); + if (exception != null) throw exception; + } {{#returnType}}return new ApiResponse<{{{returnType}}}>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), From 955d837609abb798350c2f6b78849f3ca1c7de9a Mon Sep 17 00:00:00 2001 From: Malcolm Barclay Date: Sat, 28 May 2016 12:51:02 +0100 Subject: [PATCH 03/67] Updated petstore swift-promisekit swagger client. Ran integration tests (passed) --- .../swift-promisekit/.swagger-codegen-ignore | 23 +++++++++++++++++++ .../Classes/Swaggers/Models.swift | 17 +++++++------- .../SwaggerClientTests/Podfile.lock | 12 +++++----- .../SwaggerClientTests/Pods/Manifest.lock | 12 +++++----- .../Pods/OMGHTTPURLRQ/README.markdown | 6 ++--- .../Pods/OMGHTTPURLRQ/Sources/OMGHTTPURLRQ.m | 4 ++-- .../OMGHTTPURLRQ/Info.plist | 2 +- 7 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 samples/client/petstore/swift-promisekit/.swagger-codegen-ignore diff --git a/samples/client/petstore/swift-promisekit/.swagger-codegen-ignore b/samples/client/petstore/swift-promisekit/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/swift-promisekit/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/swift-promisekit/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift-promisekit/PetstoreClient/Classes/Swaggers/Models.swift index 5a8eade51b3..cad60a236a7 100644 --- a/samples/client/petstore/swift-promisekit/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift-promisekit/PetstoreClient/Classes/Swaggers/Models.swift @@ -34,17 +34,17 @@ public class Response { private var once = dispatch_once_t() class Decoders { static private var decoders = Dictionary AnyObject)>() - + static func addDecoder(clazz clazz: T.Type, decoder: ((AnyObject) -> T)) { let key = "\(T.self)" decoders[key] = { decoder($0) as! AnyObject } } - + static func decode(clazz clazz: [T].Type, source: AnyObject) -> [T] { let array = source as! [AnyObject] return array.map { Decoders.decode(clazz: T.self, source: $0) } } - + static func decode(clazz clazz: [Key:T].Type, source: AnyObject) -> [Key:T] { let sourceDictionary = source as! [Key: AnyObject] var dictionary = [Key:T]() @@ -53,7 +53,7 @@ class Decoders { } return dictionary } - + static func decode(clazz clazz: T.Type, source: AnyObject) -> T { initialize() if T.self is Int32.Type && source is NSNumber { @@ -65,7 +65,7 @@ class Decoders { if source is T { return source as! T } - + let key = "\(T.self)" if let decoder = decoders[key] { return decoder(source) as! T @@ -100,14 +100,15 @@ class Decoders { Decoders.decode(clazz: clazz, source: someSource) } } - + static private func initialize() { dispatch_once(&once) { let formatters = [ "yyyy-MM-dd", "yyyy-MM-dd'T'HH:mm:ssZZZZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", - "yyyy-MM-dd'T'HH:mm:ss'Z'" + "yyyy-MM-dd'T'HH:mm:ss'Z'", + "yyyy-MM-dd'T'HH:mm:ss.SSS" ].map { (format: String) -> NSDateFormatter in let formatter = NSDateFormatter() formatter.dateFormat = format @@ -121,7 +122,7 @@ class Decoders { return date } } - + } if let sourceInt = source as? Int { // treat as a java date diff --git a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Podfile.lock b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Podfile.lock index cfeb9499108..fa9ebeb16ef 100644 --- a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Podfile.lock +++ b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Podfile.lock @@ -1,12 +1,12 @@ PODS: - Alamofire (3.1.5) - - OMGHTTPURLRQ (3.1.1): - - OMGHTTPURLRQ/RQ (= 3.1.1) - - OMGHTTPURLRQ/FormURLEncode (3.1.1) - - OMGHTTPURLRQ/RQ (3.1.1): + - OMGHTTPURLRQ (3.1.2): + - OMGHTTPURLRQ/RQ (= 3.1.2) + - OMGHTTPURLRQ/FormURLEncode (3.1.2) + - OMGHTTPURLRQ/RQ (3.1.2): - OMGHTTPURLRQ/FormURLEncode - OMGHTTPURLRQ/UserAgent - - OMGHTTPURLRQ/UserAgent (3.1.1) + - OMGHTTPURLRQ/UserAgent (3.1.2) - PetstoreClient (0.0.1): - Alamofire (~> 3.1.5) - PromiseKit (~> 3.1.1) @@ -32,7 +32,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0 - OMGHTTPURLRQ: 633f98ee745aeda02345935a52eec1784cddb589 + OMGHTTPURLRQ: 38316b56d88125c600bcdb16df8329147da2b0ee PetstoreClient: efd495da2b7a6f3e798752702d59f96e306dbace PromiseKit: 4e8127c22a9b29d1b44958ab2ec762ea6115cbfb diff --git a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Manifest.lock b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Manifest.lock index cfeb9499108..fa9ebeb16ef 100644 --- a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Manifest.lock +++ b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Manifest.lock @@ -1,12 +1,12 @@ PODS: - Alamofire (3.1.5) - - OMGHTTPURLRQ (3.1.1): - - OMGHTTPURLRQ/RQ (= 3.1.1) - - OMGHTTPURLRQ/FormURLEncode (3.1.1) - - OMGHTTPURLRQ/RQ (3.1.1): + - OMGHTTPURLRQ (3.1.2): + - OMGHTTPURLRQ/RQ (= 3.1.2) + - OMGHTTPURLRQ/FormURLEncode (3.1.2) + - OMGHTTPURLRQ/RQ (3.1.2): - OMGHTTPURLRQ/FormURLEncode - OMGHTTPURLRQ/UserAgent - - OMGHTTPURLRQ/UserAgent (3.1.1) + - OMGHTTPURLRQ/UserAgent (3.1.2) - PetstoreClient (0.0.1): - Alamofire (~> 3.1.5) - PromiseKit (~> 3.1.1) @@ -32,7 +32,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0 - OMGHTTPURLRQ: 633f98ee745aeda02345935a52eec1784cddb589 + OMGHTTPURLRQ: 38316b56d88125c600bcdb16df8329147da2b0ee PetstoreClient: efd495da2b7a6f3e798752702d59f96e306dbace PromiseKit: 4e8127c22a9b29d1b44958ab2ec762ea6115cbfb diff --git a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/README.markdown b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/README.markdown index ff905517872..1cd71258ad3 100644 --- a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/README.markdown +++ b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/README.markdown @@ -39,7 +39,7 @@ NSData *data2 = UIImagePNGRepresentation(image2); [multipartFormData addFile:data2 parameterName:@"file2" filename:@"myimage2.png" contentType:@"image/png"]; // SUPER Ideally you would not want to re-encode the JPEG as the process -// is lossy. If you image comes from the AssetLibrary you *CAN* get the +// is lossy. If your image comes from the AssetLibrary you *CAN* get the // original `NSData`. See stackoverflow.com. UIImage *image3 = [UIImage imageNamed:@"image3"]; NSData *data3 = UIImageJPEGRepresentation(image3); @@ -97,7 +97,7 @@ your API keys that registering at https://dev.twitter.com will provide you. ```objc -NSMutableURLRequest *rq = [TDOAuth URLRequestForPath:@"/oauth/request_token" POSTParameters:@{@"x_auth_mode" : @"reverse_auth"} host:@"api.twitter.com"consumerKey:APIKey consumerSecret:APISecret accessToken:nil tokenSecret:nil]; +NSMutableURLRequest *rq = [TDOAuth URLRequestForPath:@"/oauth/request_token" POSTParameters:@{@"x_auth_mode" : @"reverse_auth"} host:@"api.twitter.com" consumerKey:APIKey consumerSecret:APISecret accessToken:nil tokenSecret:nil]; [rq addValue:OMGUserAgent() forHTTPHeaderField:@"User-Agent"]; [NSURLConnection sendAsynchronousRequest:rq queue:nil completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { @@ -142,4 +142,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -``` \ No newline at end of file +``` diff --git a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/Sources/OMGHTTPURLRQ.m b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/Sources/OMGHTTPURLRQ.m index 0854acd0eb7..3f48ace500e 100644 --- a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/Sources/OMGHTTPURLRQ.m +++ b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/OMGHTTPURLRQ/Sources/OMGHTTPURLRQ.m @@ -71,8 +71,8 @@ static inline NSMutableURLRequest *OMGMutableURLRequest() { @implementation OMGHTTPURLRQ + (NSMutableURLRequest *)GET:(NSString *)urlString :(NSDictionary *)params error:(NSError **)error { - id queryString = OMGFormURLEncode(params); - if (queryString) urlString = [urlString stringByAppendingFormat:@"?%@", queryString]; + NSString *queryString = OMGFormURLEncode(params); + if (queryString.length) urlString = [urlString stringByAppendingFormat:@"?%@", queryString]; id url = [NSURL URLWithString:urlString]; if (!url) { diff --git a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Target Support Files/OMGHTTPURLRQ/Info.plist b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Target Support Files/OMGHTTPURLRQ/Info.plist index 793d31a9fdd..c11c2ee42e9 100644 --- a/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Target Support Files/OMGHTTPURLRQ/Info.plist +++ b/samples/client/petstore/swift-promisekit/SwaggerClientTests/Pods/Target Support Files/OMGHTTPURLRQ/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1.1 + 3.1.2 CFBundleSignature ???? CFBundleVersion From f2bd3d981e404891c5cfe6623e6afd7f9a9ab0b6 Mon Sep 17 00:00:00 2001 From: Malcolm Barclay Date: Sat, 28 May 2016 15:11:25 +0100 Subject: [PATCH 04/67] Updated petstore swift swagger client. Enabled execute (755) permissions on swift-petstore.sh Ran integration test (passed). --- bin/swift-petstore.sh | 0 .../petstore/swift/.swagger-codegen-ignore | 23 +++++++++++++++++++ .../Classes/Swaggers/Models.swift | 17 +++++++------- 3 files changed, 32 insertions(+), 8 deletions(-) mode change 100644 => 100755 bin/swift-petstore.sh create mode 100644 samples/client/petstore/swift/.swagger-codegen-ignore diff --git a/bin/swift-petstore.sh b/bin/swift-petstore.sh old mode 100644 new mode 100755 diff --git a/samples/client/petstore/swift/.swagger-codegen-ignore b/samples/client/petstore/swift/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/swift/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift index 5a8eade51b3..cad60a236a7 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift @@ -34,17 +34,17 @@ public class Response { private var once = dispatch_once_t() class Decoders { static private var decoders = Dictionary AnyObject)>() - + static func addDecoder(clazz clazz: T.Type, decoder: ((AnyObject) -> T)) { let key = "\(T.self)" decoders[key] = { decoder($0) as! AnyObject } } - + static func decode(clazz clazz: [T].Type, source: AnyObject) -> [T] { let array = source as! [AnyObject] return array.map { Decoders.decode(clazz: T.self, source: $0) } } - + static func decode(clazz clazz: [Key:T].Type, source: AnyObject) -> [Key:T] { let sourceDictionary = source as! [Key: AnyObject] var dictionary = [Key:T]() @@ -53,7 +53,7 @@ class Decoders { } return dictionary } - + static func decode(clazz clazz: T.Type, source: AnyObject) -> T { initialize() if T.self is Int32.Type && source is NSNumber { @@ -65,7 +65,7 @@ class Decoders { if source is T { return source as! T } - + let key = "\(T.self)" if let decoder = decoders[key] { return decoder(source) as! T @@ -100,14 +100,15 @@ class Decoders { Decoders.decode(clazz: clazz, source: someSource) } } - + static private func initialize() { dispatch_once(&once) { let formatters = [ "yyyy-MM-dd", "yyyy-MM-dd'T'HH:mm:ssZZZZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", - "yyyy-MM-dd'T'HH:mm:ss'Z'" + "yyyy-MM-dd'T'HH:mm:ss'Z'", + "yyyy-MM-dd'T'HH:mm:ss.SSS" ].map { (format: String) -> NSDateFormatter in let formatter = NSDateFormatter() formatter.dateFormat = format @@ -121,7 +122,7 @@ class Decoders { return date } } - + } if let sourceInt = source as? Int { // treat as a java date From 7a87746af1bc1962730314594a6c4cb8395d6c77 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Wed, 1 Jun 2016 16:01:03 +0200 Subject: [PATCH 05/67] [Objc] Proper binary data handle --- .../io/swagger/codegen/DefaultCodegen.java | 10 ++++-- .../codegen/languages/ObjcClientCodegen.java | 27 +++++++--------- .../resources/objc/ApiClient-body.mustache | 5 ++- .../objc/JSONRequestSerializer-body.mustache | 18 ++++++----- .../swagger/codegen/objc/ObjcModelTest.java | 32 ++++++++++--------- .../objc/SwaggerClient/Core/SWGApiClient.m | 5 ++- .../Core/SWGJSONRequestSerializer.m | 18 ++++++----- 7 files changed, 63 insertions(+), 52 deletions(-) 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 fceb69ac8db..39729dd14e1 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 @@ -1960,7 +1960,7 @@ public class DefaultCodegen { } } r.dataType = cm.datatype; - r.isBinary = cm.datatype.toLowerCase().startsWith("byte"); + r.isBinary = isDataTypeBinary(cm.datatype); if (cm.isContainer != null) { r.simpleType = false; r.containerType = cm.containerType; @@ -2129,7 +2129,7 @@ public class DefaultCodegen { p.baseType = cp.baseType; p.dataType = cp.datatype; p.isPrimitiveType = cp.isPrimitiveType; - p.isBinary = cp.datatype.toLowerCase().startsWith("byte"); + p.isBinary = isDataTypeBinary(cp.datatype); } // set boolean flag (e.g. isString) @@ -2226,7 +2226,7 @@ public class DefaultCodegen { p.isCookieParam = true; } else if (param instanceof BodyParameter) { p.isBodyParam = true; - p.isBinary = p.dataType.toLowerCase().startsWith("byte"); + p.isBinary = isDataTypeBinary(p.dataType); } else if (param instanceof FormParameter) { if ("file".equalsIgnoreCase(((FormParameter) param).getType())) { p.isFile = true; @@ -2242,6 +2242,10 @@ public class DefaultCodegen { return p; } + public boolean isDataTypeBinary(String dataType) { + return dataType.toLowerCase().startsWith("byte"); + } + /** * Convert map of Swagger SecuritySchemeDefinition objects to a list of Codegen Security objects * diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java index 67cf272c0ba..cc1e77649e5 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ObjcClientCodegen.java @@ -23,7 +23,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String GIT_REPO_URL = "gitRepoURL"; public static final String DEFAULT_LICENSE = "Apache License, Version 2.0"; public static final String CORE_DATA = "coreData"; - public static final String BinaryDataType = "ObjcClientCodegenBinaryData"; protected Set foundationClasses = new HashSet(); protected String podName = "SwaggerClient"; @@ -70,8 +69,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { defaultIncludes.add("NSMutableArray"); defaultIncludes.add("NSMutableDictionary"); defaultIncludes.add("NSManagedObject"); - - defaultIncludes.add(BinaryDataType); + defaultIncludes.add("NSData"); advancedMapingTypes.add("NSDictionary"); advancedMapingTypes.add("NSArray"); @@ -88,6 +86,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { languageSpecificPrimitives.add("NSString"); languageSpecificPrimitives.add("NSObject"); languageSpecificPrimitives.add("NSDate"); + languageSpecificPrimitives.add("NSData"); languageSpecificPrimitives.add("NSURL"); languageSpecificPrimitives.add("bool"); languageSpecificPrimitives.add("BOOL"); @@ -109,8 +108,9 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("List", "NSArray"); typeMapping.put("object", "NSObject"); typeMapping.put("file", "NSURL"); - typeMapping.put("binary", BinaryDataType); - typeMapping.put("ByteArray", BinaryDataType); + typeMapping.put("binary", "NSData"); + typeMapping.put("ByteArray", "NSData"); + typeMapping.put("byte", "NSData"); // ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm setReservedWordsLowerCase( @@ -143,6 +143,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { "NSObject", "NSString", "NSDate", + "NSData", "NSURL", "NSDictionary") ); @@ -317,16 +318,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { if (p instanceof ArrayProperty) { ArrayProperty ap = (ArrayProperty) p; Property inner = ap.getItems(); - String innerType = getSwaggerType(inner); - String innerTypeDeclaration = getTypeDeclaration(inner); if (innerTypeDeclaration.endsWith("*")) { innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1); } - - if(innerTypeDeclaration.equalsIgnoreCase(BinaryDataType)) { - return "NSData*"; - } // In this condition, type of property p is array of primitive, // return container type with pointer, e.g. `NSArray**' if (languageSpecificPrimitives.contains(innerTypeDeclaration)) { @@ -363,7 +358,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { } } else { String swaggerType = getSwaggerType(p); - // In this condition, type of p is objective-c primitive type, e.g. `NSSNumber', // return type of p with pointer, e.g. `NSNumber*' if (languageSpecificPrimitives.contains(swaggerType) && @@ -394,10 +388,6 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { if (innerTypeDeclaration.endsWith("*")) { innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1); } - - if(innerTypeDeclaration.equalsIgnoreCase(BinaryDataType)) { - return "NSData*"; - } // In this codition, type of property p is array of primitive, // return container type with pointer, e.g. `NSArray**' if (languageSpecificPrimitives.contains(innerTypeDeclaration)) { @@ -454,6 +444,11 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { } } + @Override + public boolean isDataTypeBinary(String dataType) { + return dataType.toLowerCase().startsWith("nsdata"); + } + @Override public String toModelName(String type) { // model name cannot use reserved keyword diff --git a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache index f0f99bc96e2..157f6999001 100644 --- a/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache @@ -259,6 +259,7 @@ static NSString * {{classPrefix}}__fileNameForResponse(NSURLResponse *response) self.requestSerializer = [AFHTTPRequestSerializer serializer]; } else { + self.requestSerializer = [AFHTTPRequestSerializer serializer]; NSAssert(NO, @"Unsupported request type %@", requestContentType); } @@ -274,7 +275,9 @@ static NSString * {{classPrefix}}__fileNameForResponse(NSURLResponse *response) queryParams = [self.sanitizer sanitizeForSerialization:queryParams]; headerParams = [self.sanitizer sanitizeForSerialization:headerParams]; formParams = [self.sanitizer sanitizeForSerialization:formParams]; - body = [self.sanitizer sanitizeForSerialization:body]; + if(![body isKindOfClass:[NSData class]]) { + body = [self.sanitizer sanitizeForSerialization:body]; + } // auth setting [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; diff --git a/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache index 78b1409b6b9..63513335d9a 100644 --- a/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/JSONRequestSerializer-body.mustache @@ -17,19 +17,21 @@ withParameters:(id)parameters error:(NSError *__autoreleasing *)error { + if (!parameters) { + return request; + } // If the body data which will be serialized isn't NSArray or NSDictionary // then put the data in the http request body directly. if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { return [super requestBySerializingRequest:request withParameters:parameters error:error]; - } else { - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - - if (parameters) { - [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; - } - - return mutableRequest; } + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + if([parameters isKindOfClass:[NSData class]]) { + [mutableRequest setHTTPBody:parameters]; + } else { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + return mutableRequest; } @end diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java index 84fb38d1dd3..f3948b00781 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/objc/ObjcModelTest.java @@ -1,21 +1,9 @@ package io.swagger.codegen.objc; -import io.swagger.codegen.CodegenModel; -import io.swagger.codegen.CodegenOperation; -import io.swagger.codegen.CodegenProperty; -import io.swagger.codegen.DefaultCodegen; +import io.swagger.codegen.*; import io.swagger.codegen.languages.ObjcClientCodegen; -import io.swagger.models.ArrayModel; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.Path; -import io.swagger.models.Swagger; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.LongProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; +import io.swagger.models.*; +import io.swagger.models.properties.*; import io.swagger.parser.SwaggerParser; import com.google.common.collect.Sets; @@ -279,6 +267,20 @@ public class ObjcModelTest { Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("SWGChildren")).size(), 1); } + @Test(description = "test binary data") + public void binaryDataModelTest() { + final Swagger model = new SwaggerParser().read("src/test/resources/2_0/binaryDataTest.json"); + final DefaultCodegen codegen = new ObjcClientCodegen(); + final String path = "/tests/binaryResponse"; + final Operation p = model.getPaths().get(path).getPost(); + final CodegenOperation op = codegen.fromOperation(path, "post", p, model.getDefinitions()); + + Assert.assertEquals(op.returnType, "NSData*"); + Assert.assertEquals(op.bodyParam.dataType, "NSData*"); + Assert.assertTrue(op.bodyParam.isBinary); + Assert.assertTrue(op.responses.get(0).isBinary); + } + @Test(description = "create proper imports per #316") public void issue316Test() { final Swagger model = new SwaggerParser().read("src/test/resources/2_0/postBodyTest.json"); diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m b/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m index 18c3233c331..66305707b17 100644 --- a/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m +++ b/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m @@ -259,6 +259,7 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) { self.requestSerializer = [AFHTTPRequestSerializer serializer]; } else { + self.requestSerializer = [AFHTTPRequestSerializer serializer]; NSAssert(NO, @"Unsupported request type %@", requestContentType); } @@ -274,7 +275,9 @@ static NSString * SWG__fileNameForResponse(NSURLResponse *response) { queryParams = [self.sanitizer sanitizeForSerialization:queryParams]; headerParams = [self.sanitizer sanitizeForSerialization:headerParams]; formParams = [self.sanitizer sanitizeForSerialization:formParams]; - body = [self.sanitizer sanitizeForSerialization:body]; + if(![body isKindOfClass:[NSData class]]) { + body = [self.sanitizer sanitizeForSerialization:body]; + } // auth setting [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m b/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m index 631a20a5a6e..221765e4839 100644 --- a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m +++ b/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m @@ -17,19 +17,21 @@ withParameters:(id)parameters error:(NSError *__autoreleasing *)error { + if (!parameters) { + return request; + } // If the body data which will be serialized isn't NSArray or NSDictionary // then put the data in the http request body directly. if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { return [super requestBySerializingRequest:request withParameters:parameters error:error]; - } else { - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - - if (parameters) { - [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; - } - - return mutableRequest; } + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + if([parameters isKindOfClass:[NSData class]]) { + [mutableRequest setHTTPBody:parameters]; + } else { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + return mutableRequest; } @end From fe8b0cf07b210bed5f907222fc99ecc603b3f01c Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 3 Jun 2016 14:35:51 +0200 Subject: [PATCH 06/67] add option to only generate stubs of the API and no server files Fix #3025 --- bin/spring-stubs.sh | 31 +++ .../languages/SpringBootServerCodegen.java | 51 +++-- .../resources/JavaSpringBoot/api.mustache | 13 +- .../JavaSpringBoot/apiController.mustache | 35 +++ .../JavaSpringBoot/formParams.mustache | 3 +- .../JavaSpringBoot/headerParams.mustache | 2 +- .../resources/JavaSpringBoot/pom.mustache | 4 +- .../JavaSpringBoot/queryParams.mustache | 2 +- .../JavaSpringMVC/apiController.mustache | 61 ++++++ .../spring-stubs/.swagger-codegen-ignore | 23 ++ samples/client/petstore/spring-stubs/LICENSE | 201 ++++++++++++++++++ .../client/petstore/spring-stubs/README.md | 18 ++ samples/client/petstore/spring-stubs/pom.xml | 41 ++++ .../src/main/java/io/swagger/api/PetApi.java | 157 ++++++++++++++ .../main/java/io/swagger/api/StoreApi.java | 74 +++++++ .../src/main/java/io/swagger/api/UserApi.java | 115 ++++++++++ .../main/java/io/swagger/model/Category.java | 71 +++++++ .../io/swagger/model/ModelApiResponse.java | 85 ++++++++ .../src/main/java/io/swagger/model/Order.java | 134 ++++++++++++ .../src/main/java/io/swagger/model/Pet.java | 137 ++++++++++++ .../src/main/java/io/swagger/model/Tag.java | 71 +++++++ .../src/main/java/io/swagger/model/User.java | 156 ++++++++++++++ .../springboot/.swagger-codegen-ignore | 23 ++ samples/server/petstore/springboot/LICENSE | 201 ++++++++++++++++++ .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 109 ++-------- .../java/io/swagger/api/PetApiController.java | 71 +++++++ .../main/java/io/swagger/api/StoreApi.java | 40 +--- .../io/swagger/api/StoreApiController.java | 45 ++++ .../src/main/java/io/swagger/api/UserApi.java | 86 ++------ .../io/swagger/api/UserApiController.java | 67 ++++++ .../SwaggerDocumentationConfig.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 41 files changed, 1900 insertions(+), 249 deletions(-) create mode 100755 bin/spring-stubs.sh create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache create mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache create mode 100644 samples/client/petstore/spring-stubs/.swagger-codegen-ignore create mode 100644 samples/client/petstore/spring-stubs/LICENSE create mode 100644 samples/client/petstore/spring-stubs/README.md create mode 100644 samples/client/petstore/spring-stubs/pom.xml create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java create mode 100644 samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java create mode 100644 samples/server/petstore/springboot/.swagger-codegen-ignore create mode 100644 samples/server/petstore/springboot/LICENSE create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java diff --git a/bin/spring-stubs.sh b/bin/spring-stubs.sh new file mode 100755 index 00000000000..48719f2e696 --- /dev/null +++ b/bin/spring-stubs.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/client/petstore/spring-stubs -DinterfaceOnly=true" + +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 7a487494a5b..1574fd7175e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -10,15 +10,16 @@ import java.util.*; public class SpringBootServerCodegen extends JavaClientCodegen implements CodegenConfig{ public static final String CONFIG_PACKAGE = "configPackage"; public static final String BASE_PACKAGE = "basePackage"; + public static final String INTERFACE_ONLY = "interfaceOnly"; protected String title = "Petstore Server"; protected String configPackage = ""; protected String basePackage = ""; + protected boolean interfaceOnly = false; protected String templateFileName = "api.mustache"; public SpringBootServerCodegen() { super(); outputFolder = "generated-code/javaSpringBoot"; - modelTemplateFiles.put("model.mustache", ".java"); apiTemplateFiles.put(templateFileName, ".java"); apiTestTemplateFiles.clear(); // TODO: add test template embeddedTemplateDir = templateDir = "JavaSpringBoot"; @@ -40,6 +41,7 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); cliOptions.add(new CliOption(BASE_PACKAGE, "base package for generated code")); + cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.")); supportedLibraries.clear(); supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring Boot server stub."); @@ -79,30 +81,33 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege this.setBasePackage((String) additionalProperties.get(BASE_PACKAGE)); } + if (additionalProperties.containsKey(INTERFACE_ONLY)) { + this.setInterfaceOnly(Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString())); + } + supportingFiles.clear(); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("apiException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java")); - supportingFiles.add(new SupportingFile("apiOriginFilter.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java")); - supportingFiles.add(new SupportingFile("apiResponseMessage.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java")); - supportingFiles.add(new SupportingFile("notFoundException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java")); - - supportingFiles.add(new SupportingFile("swaggerDocumentationConfig.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerDocumentationConfig.java")); - supportingFiles.add(new SupportingFile("homeController.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java")); - - supportingFiles.add(new SupportingFile("swagger2SpringBoot.mustache", - (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "Swagger2SpringBoot.java")); - - - supportingFiles.add(new SupportingFile("application.properties", - ("src.main.resources").replace(".", java.io.File.separator), "application.properties")); + if(!this.interfaceOnly) { + apiTemplateFiles.put("apiController.mustache", "Controller.java"); + supportingFiles.add(new SupportingFile("apiException.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java")); + supportingFiles.add(new SupportingFile("apiOriginFilter.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java")); + supportingFiles.add(new SupportingFile("apiResponseMessage.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java")); + supportingFiles.add(new SupportingFile("notFoundException.mustache", + (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java")); + supportingFiles.add(new SupportingFile("swaggerDocumentationConfig.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerDocumentationConfig.java")); + supportingFiles.add(new SupportingFile("homeController.mustache", + (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "HomeController.java")); + supportingFiles.add(new SupportingFile("swagger2SpringBoot.mustache", + (sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "Swagger2SpringBoot.java")); + supportingFiles.add(new SupportingFile("application.properties", + ("src.main.resources").replace(".", java.io.File.separator), "application.properties")); + } } @Override @@ -256,6 +261,10 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege public void setBasePackage(String configPackage) { this.basePackage = configPackage; } + + public void setInterfaceOnly(boolean interfaceOnly) { + this.interfaceOnly = interfaceOnly; + } @Override public Map postProcessModels(Map objs) { diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache index b214f376110..672e1bbe9ba 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache @@ -7,9 +7,7 @@ import {{modelPackage}}.*; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -23,12 +21,11 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@Controller @RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") {{>generatedAnnotation}} {{#operations}} -public class {{classname}} { +public interface {{classname}} { {{#operation}} @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { @@ -44,12 +41,8 @@ public class {{classname}} { {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} method = RequestMethod.{{httpMethod}}) - public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, - {{/hasMore}}{{/allParams}}) - throws NotFoundException { - // do some magic! - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } + ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}); {{/operation}} } diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache new file mode 100644 index 00000000000..0cde913d660 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache @@ -0,0 +1,35 @@ +package {{apiPackage}}; + +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Controller +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}}Controller implements {{classname}} { + {{#operation}} + public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}) { + // do some magic! + return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); + } + + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache index 65e84817a23..d84de0c3376 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache @@ -1,2 +1 @@ -{{#isFormParam}}{{#notFile}} -@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} +{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache index 297d5131d92..7c9e7356a0b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache @@ -1 +1 @@ -{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} +{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache index f6cc38793e7..ab4449ee580 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache @@ -14,7 +14,7 @@ 1.3.3.RELEASE - src/main/java + src/main/java{{^interfaceOnly}} org.springframework.boot @@ -27,7 +27,7 @@ - + {{/interfaceOnly}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache index 3bb2afcb6cd..d935fb11fd3 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}} +{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache new file mode 100644 index 00000000000..7fe7c5acf60 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache @@ -0,0 +1,61 @@ +package {{apiPackage}}; + +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import io.swagger.annotations.AuthorizationScope; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@Controller +@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + {{#operation}} + + @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { + {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { + {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, + {{/hasMore}}{{/scopes}} + }{{/isOAuth}}){{#hasMore}}, + {{/hasMore}}{{/authMethods}} + }{{/hasAuthMethods}}) + @io.swagger.annotations.ApiResponses(value = { {{#responses}} + @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) + @RequestMapping(value = "{{{path}}}", + {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} + {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} + method = RequestMethod.{{httpMethod}}) + public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}) + throws NotFoundException { + // do some magic! + return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); + } + + {{/operation}} +} +{{/operations}} diff --git a/samples/client/petstore/spring-stubs/.swagger-codegen-ignore b/samples/client/petstore/spring-stubs/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/spring-stubs/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/spring-stubs/LICENSE b/samples/client/petstore/spring-stubs/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/spring-stubs/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/spring-stubs/README.md b/samples/client/petstore/spring-stubs/README.md new file mode 100644 index 00000000000..8f9855eedf9 --- /dev/null +++ b/samples/client/petstore/spring-stubs/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/samples/client/petstore/spring-stubs/pom.xml b/samples/client/petstore/spring-stubs/pom.xml new file mode 100644 index 00000000000..975433d48c8 --- /dev/null +++ b/samples/client/petstore/spring-stubs/pom.xml @@ -0,0 +1,41 @@ + + 4.0.0 + io.swagger + swagger-springboot-server + jar + swagger-springboot-server + 1.0.0 + + 2.4.0 + + + org.springframework.boot + spring-boot-starter-parent + 1.3.3.RELEASE + + + src/main/java + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + \ No newline at end of file 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 new file mode 100644 index 00000000000..9bb732d245c --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -0,0 +1,157 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.Pet; +import io.swagger.model.ModelApiResponse; +import java.io.File; + +import io.swagger.annotations.*; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/pet", description = "the pet API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public interface PetApi { + + @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/xml", "application/json" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.POST) + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); + + + @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.DELETE) + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); + + + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/findByStatus", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status); + + + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/findByTags", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); + + + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), + @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); + + + @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Pet not found", response = Void.class), + @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/xml", "application/json" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.PUT) + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); + + + @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.POST) + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name, + @ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status); + + + @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/{petId}/uploadImage", + produces = { "application/json" }, + consumes = { "multipart/form-data" }, + method = RequestMethod.POST) + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); + +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java new file mode 100644 index 00000000000..b8a29cdf3b2 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -0,0 +1,74 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import java.util.Map; +import io.swagger.model.Order; + +import io.swagger.annotations.*; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/store", description = "the store API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public interface StoreApi { + + @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.DELETE) + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); + + + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/inventory", + produces = { "application/json" }, + + method = RequestMethod.GET) + ResponseEntity> getInventory(); + + + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), + @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); + + + @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/order", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); + +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java new file mode 100644 index 00000000000..15d815fcb96 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -0,0 +1,115 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.User; +import java.util.List; + +import io.swagger.annotations.*; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import static org.springframework.http.MediaType.*; + +@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/user", description = "the user API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public interface UserApi { + + @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); + + + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithArray", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); + + + @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithList", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); + + + @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.DELETE) + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); + + + @ApiOperation(value = "Get user by user name", notes = "", response = User.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), + @ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); + + + @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/login", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); + + + @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/logout", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + ResponseEntity logoutUser(); + + + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), + @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.PUT) + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, + @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); + +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java new file mode 100644 index 00000000000..be0a5b6ad47 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -0,0 +1,71 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class Category { + + private Long id = null; + private String name = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java new file mode 100644 index 00000000000..c9256ca70fe --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -0,0 +1,85 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class ModelApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(code).append("\n"); + sb.append(" type: ").append(type).append("\n"); + sb.append(" message: ").append(message).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java new file mode 100644 index 00000000000..632893e4652 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -0,0 +1,134 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class Order { + + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private Date shipDate = null; + public enum StatusEnum { + placed, approved, delivered, + }; + + private StatusEnum status = null; + private Boolean complete = false; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("petId") + public Long getPetId() { + return petId; + } + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("quantity") + public Integer getQuantity() { + return quantity; + } + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("shipDate") + public Date getShipDate() { + return shipDate; + } + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + **/ + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("complete") + public Boolean getComplete() { + return complete; + } + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" petId: ").append(petId).append("\n"); + sb.append(" quantity: ").append(quantity).append("\n"); + sb.append(" shipDate: ").append(shipDate).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append(" complete: ").append(complete).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java new file mode 100644 index 00000000000..08e73d83c21 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -0,0 +1,137 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Category; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class Pet { + + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + public enum StatusEnum { + available, pending, sold, + }; + + private StatusEnum status = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("category") + public Category getCategory() { + return category; + } + public void setCategory(Category category) { + this.category = category; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") + public List getPhotoUrls() { + return photoUrls; + } + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("tags") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** + * pet status in the store + **/ + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") + public StatusEnum getStatus() { + return status; + } + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" category: ").append(category).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append(" photoUrls: ").append(photoUrls).append("\n"); + sb.append(" tags: ").append(tags).append("\n"); + sb.append(" status: ").append(status).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java new file mode 100644 index 00000000000..b339bb8db02 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -0,0 +1,71 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class Tag { + + private Long id = null; + private String name = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("name") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java new file mode 100644 index 00000000000..55c4a39b092 --- /dev/null +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -0,0 +1,156 @@ +package io.swagger.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +public class User { + + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("id") + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("username") + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("email") + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("password") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("phone") + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + **/ + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") + public Integer getUserStatus() { + return userStatus; + } + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(id).append("\n"); + sb.append(" username: ").append(username).append("\n"); + sb.append(" firstName: ").append(firstName).append("\n"); + sb.append(" lastName: ").append(lastName).append("\n"); + sb.append(" email: ").append(email).append("\n"); + sb.append(" password: ").append(password).append("\n"); + sb.append(" phone: ").append(phone).append("\n"); + sb.append(" userStatus: ").append(userStatus).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/server/petstore/springboot/.swagger-codegen-ignore b/samples/server/petstore/springboot/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/server/petstore/springboot/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/springboot/LICENSE b/samples/server/petstore/springboot/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/server/petstore/springboot/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index 1652afba0ad..dd9f929eef5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index d18415d8e7c..0467b6d0b13 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index a58b9c19e97..1acb8e00b62 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index 8770f484be1..fa507439440 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { 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 7f66bdc75f7..30cdb5b7814 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 @@ -3,14 +3,12 @@ package io.swagger.api; import io.swagger.model.*; import io.swagger.model.Pet; -import java.io.File; import io.swagger.model.ModelApiResponse; +import java.io.File; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -24,11 +22,10 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") -public class PetApi { +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -42,14 +39,7 @@ public class PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity addPet( - -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -64,18 +54,8 @@ public class PetApi { produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - public ResponseEntity deletePet( -@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId - -, - -@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -91,14 +71,7 @@ public class PetApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } + ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status); @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -114,14 +87,7 @@ public class PetApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } + ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -135,14 +101,7 @@ public class PetApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity getPetById( -@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -159,14 +118,7 @@ public class PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - public ResponseEntity updatePet( - -@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -181,24 +133,9 @@ public class PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - public ResponseEntity updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId - -, - - - -@ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name -, - - - -@ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name, + @ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -213,22 +150,8 @@ public class PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile( -@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId - -, - - - -@ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata -, - - -@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } 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 new file mode 100644 index 00000000000..cb3b30c0ce0 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -0,0 +1,71 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.Pet; +import io.swagger.model.ModelApiResponse; +import java.io.File; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Controller +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public class PetApiController implements PetApi { + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status) { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name, + @ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, + @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index 8cf2283e4fe..95dbf7170b6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -7,9 +7,7 @@ import io.swagger.model.Order; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -23,11 +21,10 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") -public class StoreApi { +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @ApiResponses(value = { @@ -37,14 +34,7 @@ public class StoreApi { produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - public ResponseEntity deleteOrder( -@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -56,11 +46,7 @@ public class StoreApi { produces = { "application/json" }, method = RequestMethod.GET) - public ResponseEntity> getInventory() - throws NotFoundException { - // do some magic! - return new ResponseEntity>(HttpStatus.OK); - } + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) @@ -72,14 +58,7 @@ public class StoreApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) @@ -90,13 +69,6 @@ public class StoreApi { produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - public ResponseEntity placeOrder( - -@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java new file mode 100644 index 00000000000..82d59878419 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -0,0 +1,45 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import java.util.Map; +import io.swagger.model.Order; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Controller +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public class StoreApiController implements StoreApi { + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity> getInventory() { + // do some magic! + return new ResponseEntity>(HttpStatus.OK); + } + + public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index 36c500faded..1d16485a5cc 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -7,9 +7,7 @@ import java.util.List; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -23,11 +21,10 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") -public class UserApi { +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @@ -36,14 +33,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - public ResponseEntity createUser( - -@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @@ -53,14 +43,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - public ResponseEntity createUsersWithArrayInput( - -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @@ -70,14 +53,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - public ResponseEntity createUsersWithListInput( - -@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) @@ -88,14 +64,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - public ResponseEntity deleteUser( -@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class) @@ -107,14 +76,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity getUserByName( -@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) @@ -125,18 +87,8 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username - - -, - @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password - - -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) @@ -146,11 +98,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - public ResponseEntity logoutUser() - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) @@ -161,17 +109,7 @@ public class UserApi { produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - public ResponseEntity updateUser( -@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username - -, - - -@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body -) - throws NotFoundException { - // do some magic! - return new ResponseEntity(HttpStatus.OK); - } + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, + @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java new file mode 100644 index 00000000000..c89b4344d42 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -0,0 +1,67 @@ +package io.swagger.api; + +import io.swagger.model.*; + +import io.swagger.model.User; +import java.util.List; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Controller +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +public class UserApiController implements UserApi { + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity logoutUser() { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, + @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 185c0e08794..2b2c0e4ef8b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -13,7 +13,7 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class SwaggerDocumentationConfig { ApiInfo apiInfo() { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index 411a206a7f6..4a0a3f96c31 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index 73a0717d5e5..1dc6b16915c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 3f8bbd49e37..951e1cb6878 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index 1507c988f3b..be6ee7d529e 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 665a5c00270..7d2d0bd587c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index dd8cd876e7b..ffeaafe129f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:30:42.322+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") public class User { private Long id = null; From 3b37584c1f4820ca49f74537c0e3ff82b0ce3efd Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 3 Jun 2016 15:37:06 +0200 Subject: [PATCH 07/67] update README --- .../resources/JavaSpringBoot/README.mustache | 31 +++++++++++++++-- .../client/petstore/spring-stubs/README.md | 33 ++++++++++++------- samples/server/petstore/springboot/README.md | 2 +- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache index 8f9855eedf9..02d932b8aca 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache @@ -1,4 +1,4 @@ -# Swagger generated server +{{^interfaceOnly}}# Swagger generated server Spring Boot Server @@ -15,4 +15,31 @@ Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to http://localhost:8080/ -Change default port value in application.properties \ No newline at end of file +Change default port value in application.properties{{/interfaceOnly}}{{#interfaceOnly}} +# Swagger generated API stub + +Spring Framework stub + + +## Overview +This code was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate an API stub. +This is an example of building API stub interfaces in Java using the Spring framework. + +The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints +by adding ```@Controller``` classes that implement the interface. Eg: +```java +@Controller +public class PetController implements PetApi { +// implement all PetApi methods +} +``` + +You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg: +```java +@FeignClient(name="pet", url="http://petstore.swagger.io/v2") +public interface PetClient extends PetApi { + +} +``` +{{/interfaceOnly}} \ No newline at end of file diff --git a/samples/client/petstore/spring-stubs/README.md b/samples/client/petstore/spring-stubs/README.md index 8f9855eedf9..99663f64082 100644 --- a/samples/client/petstore/spring-stubs/README.md +++ b/samples/client/petstore/spring-stubs/README.md @@ -1,18 +1,27 @@ -# Swagger generated server -Spring Boot Server +# Swagger generated API stub + +Spring Framework stub -## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. -By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. -This is an example of building a swagger-enabled server in Java using the SpringBoot framework. +## Overview +This code was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate an API stub. +This is an example of building API stub interfaces in Java using the Spring framework. -The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) +The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints +by adding ```@Controller``` classes that implement the interface. Eg: +```java +@Controller +public class PetController implements PetApi { +// implement all PetApi methods +} +``` -Start your server as an simple java application +You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg: +```java +@FeignClient(name="pet", url="http://petstore.swagger.io/v2") +public interface PetClient extends PetApi { -You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ - -Change default port value in application.properties \ No newline at end of file +} +``` diff --git a/samples/server/petstore/springboot/README.md b/samples/server/petstore/springboot/README.md index 8f9855eedf9..a2e8a9f7b84 100644 --- a/samples/server/petstore/springboot/README.md +++ b/samples/server/petstore/springboot/README.md @@ -15,4 +15,4 @@ Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to http://localhost:8080/ -Change default port value in application.properties \ No newline at end of file +Change default port value in application.properties \ No newline at end of file From a452bbf0397d32dbae3e1069941068fbdf006cf9 Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 3 Jun 2016 16:16:40 +0200 Subject: [PATCH 08/67] add interfaceOnly option test --- .../codegen/options/SpringBootServerOptionsProvider.java | 3 +++ .../codegen/springboot/SpringBootServerOptionsTest.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java index af70fc1834a..6e766a21d07 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java @@ -10,6 +10,7 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider { public static final String CONFIG_PACKAGE_VALUE = "configPackage"; public static final String BASE_PACKAGE_VALUE = "basePackage"; public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class + public static final String INTERFACE_ONLY = "true"; @Override public String getLanguage() { @@ -22,6 +23,8 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider { options.put(SpringBootServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE); options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); + options.put(SpringBootServerCodegen.INTERFACE_ONLY, INTERFACE_ONLY); + return options; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java index 7228f119711..34a53db1dad 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java @@ -54,6 +54,8 @@ public class SpringBootServerOptionsTest extends JavaClientOptionsTest { times = 1; clientCodegen.setBasePackage(SpringBootServerOptionsProvider.BASE_PACKAGE_VALUE); times = 1; + clientCodegen.setInterfaceOnly(Boolean.valueOf(SpringBootServerOptionsProvider.INTERFACE_ONLY)); + times = 1; }}; } From 17a639be75d13985c4b1fcede1b2a7716c2cd238 Mon Sep 17 00:00:00 2001 From: Landschaft Date: Fri, 3 Jun 2016 13:12:07 +0200 Subject: [PATCH 09/67] [Swift] #3036 Make APIHelper.convertBoolToString return nil for nil input. This will prevent the creation of an empty body for GET requests. --- .../main/resources/swift/APIHelper.mustache | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift/APIHelper.mustache b/modules/swagger-codegen/src/main/resources/swift/APIHelper.mustache index 7041709f365..23e727b6b54 100644 --- a/modules/swagger-codegen/src/main/resources/swift/APIHelper.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/APIHelper.mustache @@ -19,18 +19,19 @@ class APIHelper { return destination } - static func convertBoolToString(source: [String: AnyObject]?) -> [String:AnyObject] { + static func convertBoolToString(source: [String: AnyObject]?) -> [String:AnyObject]? { + guard let source = source else { + return nil + } var destination = [String:AnyObject]() let theTrue = NSNumber(bool: true) let theFalse = NSNumber(bool: false) - if (source != nil) { - for (key, value) in source! { - switch value { - case let x where x === theTrue || x === theFalse: - destination[key] = "\(value as! Bool)" - default: - destination[key] = value - } + for (key, value) in source { + switch value { + case let x where x === theTrue || x === theFalse: + destination[key] = "\(value as! Bool)" + default: + destination[key] = value } } return destination From 83e8a2e90ca942e4ad7f9a636c8c9df4e1e7fa78 Mon Sep 17 00:00:00 2001 From: tao Date: Fri, 3 Jun 2016 16:08:07 -0700 Subject: [PATCH 10/67] stop reading custom template file from subdirectories --- .../io/swagger/codegen/AbstractGenerator.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java index 40b59435c44..849651baa9d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/AbstractGenerator.java @@ -72,28 +72,20 @@ public abstract class AbstractGenerator { * @return String Full template file path */ public String getFullTemplateFile(CodegenConfig config, String templateFile) { - String library = config.getLibrary(); - if (library != null && !"".equals(library)) { - String libTemplateFile = config.templateDir() + File.separator + - "libraries" + File.separator + library + File.separator + - templateFile; - - if (new File(libTemplateFile).exists()) { - return libTemplateFile; - } - - libTemplateFile = config.embeddedTemplateDir() + File.separator + - "libraries" + File.separator + library + File.separator + - templateFile; - if (embeddedTemplateExists(libTemplateFile)) { - // Fall back to the template file embedded/packaged in the JAR file... - return libTemplateFile; - } - } String template = config.templateDir() + File.separator + templateFile; if (new File(template).exists()) { return template; } else { + String library = config.getLibrary(); + if (library != null && !"".equals(library)) { + String libTemplateFile = config.embeddedTemplateDir() + File.separator + + "libraries" + File.separator + library + File.separator + + templateFile; + if (embeddedTemplateExists(libTemplateFile)) { + // Fall back to the template file embedded/packaged in the JAR file... + return libTemplateFile; + } + } // Fall back to the template file embedded/packaged in the JAR file... return config.embeddedTemplateDir() + File.separator + templateFile; } From 9ed290efeafcc5dd21f4e2b20b5adcf05f0cd74f Mon Sep 17 00:00:00 2001 From: clasnake Date: Sat, 4 Jun 2016 20:53:21 +0800 Subject: [PATCH 11/67] Add sbt support for retrofit. --- .../codegen/languages/JavaClientCodegen.java | 2 + .../libraries/retrofit/build.sbt.mustache | 19 ++ .../java/retrofit/.swagger-codegen-ignore | 23 ++ samples/client/petstore/java/retrofit/LICENSE | 201 ++++++++++++++++++ .../client/petstore/java/retrofit/build.sbt | 19 ++ .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 6 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../model/AdditionalPropertiesClass.java | 84 ++++++++ .../java/io/swagger/client/model/Animal.java | 19 +- .../io/swagger/client/model/ArrayTest.java | 98 +++++++++ .../java/io/swagger/client/model/Cat.java | 17 +- .../java/io/swagger/client/model/Dog.java | 17 +- ...ropertiesAndAdditionalPropertiesClass.java | 101 +++++++++ .../java/io/swagger/client/model/Name.java | 16 +- .../swagger/client/model/ReadOnlyFirst.java | 78 +++++++ 17 files changed, 694 insertions(+), 12 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache create mode 100644 samples/client/petstore/java/retrofit/.swagger-codegen-ignore create mode 100644 samples/client/petstore/java/retrofit/LICENSE create mode 100644 samples/client/petstore/java/retrofit/build.sbt create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ReadOnlyFirst.java diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 903eb1f8942..3f0d287a123 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -332,6 +332,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); + // "build.sbt" is for development with SBT + supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); //generate markdown docs for retrofit2 if ( usesRetrofit2Library() ){ diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache new file mode 100644 index 00000000000..174cb829ab6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache @@ -0,0 +1,19 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", + "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/java/retrofit/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/retrofit/LICENSE b/samples/client/petstore/java/retrofit/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/java/retrofit/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/java/retrofit/build.sbt b/samples/client/petstore/java/retrofit/build.sbt new file mode 100644 index 00000000000..bb75af8c379 --- /dev/null +++ b/samples/client/petstore/java/retrofit/build.sbt @@ -0,0 +1,19 @@ +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-petstore-retrofit", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", + "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties index 0c81b118d92..b7a36473955 100644 --- a/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Tue May 17 23:04:28 CST 2016 +#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index fb5b299a706..c6db75c3708 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-28T16:10:49.444+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T20:43:54.025+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index 89fb9ddba73..a77872ee5ba 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -16,9 +16,9 @@ import java.util.Map; public interface FakeApi { /** - * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Sync method - * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param string None (required) @@ -41,7 +41,7 @@ public interface FakeApi { ); /** - * Fake endpoint for testing various parameters + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Async method * @param number None (required) * @param _double None (required) diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java index 66ed6aea981..a019a4bf886 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java @@ -7,8 +7,8 @@ import retrofit.http.*; import retrofit.mime.*; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.ModelApiResponse; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..839b04aa6c5 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,84 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AdditionalPropertiesClass { + + @SerializedName("map_property") + private Map mapProperty = new HashMap(); + + @SerializedName("map_of_map_property") + private Map> mapOfMapProperty = new HashMap>(); + + /** + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Animal.java index 8df24899fb0..9a14a1289fe 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Animal.java @@ -15,6 +15,9 @@ public class Animal { @SerializedName("className") private String className = null; + @SerializedName("color") + private String color = "red"; + /** **/ @ApiModelProperty(required = true, value = "") @@ -25,6 +28,16 @@ public class Animal { this.className = className; } + /** + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + @Override public boolean equals(Object o) { @@ -35,12 +48,13 @@ public class Animal { return false; } Animal animal = (Animal) o; - return Objects.equals(className, animal.className); + return Objects.equals(className, animal.className) && + Objects.equals(color, animal.color); } @Override public int hashCode() { - return Objects.hash(className); + return Objects.hash(className, color); } @Override @@ -49,6 +63,7 @@ public class Animal { sb.append("class Animal {\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ArrayTest.java new file mode 100644 index 00000000000..92337cc0246 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ArrayTest.java @@ -0,0 +1,98 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ArrayTest { + + @SerializedName("array_of_string") + private List arrayOfString = new ArrayList(); + + @SerializedName("array_array_of_integer") + private List> arrayArrayOfInteger = new ArrayList>(); + + @SerializedName("array_array_of_model") + private List> arrayArrayOfModel = new ArrayList>(); + + /** + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Cat.java index 60a99ed86da..287d6a4d94c 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Cat.java @@ -16,6 +16,9 @@ public class Cat extends Animal { @SerializedName("className") private String className = null; + @SerializedName("color") + private String color = "red"; + @SerializedName("declawed") private Boolean declawed = null; @@ -29,6 +32,16 @@ public class Cat extends Animal { this.className = className; } + /** + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + /** **/ @ApiModelProperty(value = "") @@ -50,12 +63,13 @@ public class Cat extends Animal { } Cat cat = (Cat) o; return Objects.equals(className, cat.className) && + Objects.equals(color, cat.color) && Objects.equals(declawed, cat.declawed); } @Override public int hashCode() { - return Objects.hash(className, declawed); + return Objects.hash(className, color, declawed); } @Override @@ -64,6 +78,7 @@ public class Cat extends Animal { sb.append("class Cat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Dog.java index 1c31fc93746..5d2ead15f07 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Dog.java @@ -16,6 +16,9 @@ public class Dog extends Animal { @SerializedName("className") private String className = null; + @SerializedName("color") + private String color = "red"; + @SerializedName("breed") private String breed = null; @@ -29,6 +32,16 @@ public class Dog extends Animal { this.className = className; } + /** + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + /** **/ @ApiModelProperty(value = "") @@ -50,12 +63,13 @@ public class Dog extends Animal { } Dog dog = (Dog) o; return Objects.equals(className, dog.className) && + Objects.equals(color, dog.color) && Objects.equals(breed, dog.breed); } @Override public int hashCode() { - return Objects.hash(className, breed); + return Objects.hash(className, color, breed); } @Override @@ -64,6 +78,7 @@ public class Dog extends Animal { sb.append("class Dog {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..d4afc996440 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,101 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class MixedPropertiesAndAdditionalPropertiesClass { + + @SerializedName("uuid") + private String uuid = null; + + @SerializedName("dateTime") + private Date dateTime = null; + + @SerializedName("map") + private Map map = new HashMap(); + + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Name.java index b24b87366a4..5aa60a1f6f1 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Name.java @@ -24,6 +24,9 @@ public class Name { @SerializedName("property") private String property = null; + @SerializedName("123Number") + private Integer _123Number = null; + /** **/ @ApiModelProperty(required = true, value = "") @@ -51,6 +54,13 @@ public class Name { this.property = property; } + /** + **/ + @ApiModelProperty(value = "") + public Integer get123Number() { + return _123Number; + } + @Override public boolean equals(Object o) { @@ -63,12 +73,13 @@ public class Name { Name name = (Name) o; return Objects.equals(name, name.name) && Objects.equals(snakeCase, name.snakeCase) && - Objects.equals(property, name.property); + Objects.equals(property, name.property) && + Objects.equals(_123Number, name._123Number); } @Override public int hashCode() { - return Objects.hash(name, snakeCase, property); + return Objects.hash(name, snakeCase, property, _123Number); } @Override @@ -79,6 +90,7 @@ public class Name { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..32e4f515bce --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -0,0 +1,78 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ReadOnlyFirst { + + @SerializedName("bar") + private String bar = null; + + @SerializedName("baz") + private String baz = null; + + /** + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} From 503fb138f5b4d445e7319712197e27fc4e8a8e03 Mon Sep 17 00:00:00 2001 From: clasnake Date: Sat, 4 Jun 2016 21:13:10 +0800 Subject: [PATCH 12/67] Add sbt support for retrofit2 and retrofit2rx. --- .../libraries/retrofit2/build.sbt.mustache | 24 +++ .../java/retrofit2/.swagger-codegen-ignore | 23 ++ .../client/petstore/java/retrofit2/LICENSE | 201 ++++++++++++++++++ .../client/petstore/java/retrofit2/build.sbt | 20 ++ .../docs/AdditionalPropertiesClass.md | 2 + .../petstore/java/retrofit2/docs/ArrayTest.md | 3 + ...dPropertiesAndAdditionalPropertiesClass.md | 1 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../model/AdditionalPropertiesClass.java | 84 ++++++++ .../io/swagger/client/model/ArrayTest.java | 98 +++++++++ ...ropertiesAndAdditionalPropertiesClass.java | 101 +++++++++ .../swagger/client/model/ReadOnlyFirst.java | 78 +++++++ .../java/retrofit2rx/.swagger-codegen-ignore | 23 ++ .../client/petstore/java/retrofit2rx/LICENSE | 201 ++++++++++++++++++ .../petstore/java/retrofit2rx/build.sbt | 22 ++ .../docs/AdditionalPropertiesClass.md | 2 + .../java/retrofit2rx/docs/ArrayTest.md | 3 + ...dPropertiesAndAdditionalPropertiesClass.md | 1 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../model/AdditionalPropertiesClass.java | 84 ++++++++ .../io/swagger/client/model/ArrayTest.java | 98 +++++++++ ...ropertiesAndAdditionalPropertiesClass.java | 101 +++++++++ .../swagger/client/model/ReadOnlyFirst.java | 78 +++++++ 25 files changed, 1252 insertions(+), 4 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache create mode 100644 samples/client/petstore/java/retrofit2/.swagger-codegen-ignore create mode 100644 samples/client/petstore/java/retrofit2/LICENSE create mode 100644 samples/client/petstore/java/retrofit2/build.sbt create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/retrofit2rx/.swagger-codegen-ignore create mode 100644 samples/client/petstore/java/retrofit2rx/LICENSE create mode 100644 samples/client/petstore/java/retrofit2rx/build.sbt create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ReadOnlyFirst.java diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache new file mode 100644 index 00000000000..8e6986fa2d2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache @@ -0,0 +1,24 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.retrofit2" % "retrofit" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile", + {{#useRxJava}} + "com.squareup.retrofit2" % "adapter-rxjava" % "2.0.2" % "compile", + "io.reactivex" % "rxjava" % "1.1.3" % "compile", + {{/useRxJava}} + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/retrofit2/LICENSE b/samples/client/petstore/java/retrofit2/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/java/retrofit2/build.sbt b/samples/client/petstore/java/retrofit2/build.sbt new file mode 100644 index 00000000000..8ebea3cad9d --- /dev/null +++ b/samples/client/petstore/java/retrofit2/build.sbt @@ -0,0 +1,20 @@ +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-petstore-retrofit2", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.retrofit2" % "retrofit" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit2/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2/docs/AdditionalPropertiesClass.md index c72785d450f..0437c4dd8cc 100644 --- a/samples/client/petstore/java/retrofit2/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2/docs/AdditionalPropertiesClass.md @@ -4,6 +4,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2/docs/ArrayTest.md b/samples/client/petstore/java/retrofit2/docs/ArrayTest.md index 73c3e5305ad..9feee16427f 100644 --- a/samples/client/petstore/java/retrofit2/docs/ArrayTest.md +++ b/samples/client/petstore/java/retrofit2/docs/ArrayTest.md @@ -4,6 +4,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md index fcdbd390517..00cc10ca9b3 100644 --- a/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] **dateTime** | [**Date**](Date.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties index 77483e70e76..b7a36473955 100644 --- a/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Tue May 17 23:04:50 CST 2016 +#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index 244ee20eb5b..16b65ffb7ef 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-17T10:34:26.353+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:04:39.523+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..839b04aa6c5 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,84 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AdditionalPropertiesClass { + + @SerializedName("map_property") + private Map mapProperty = new HashMap(); + + @SerializedName("map_of_map_property") + private Map> mapOfMapProperty = new HashMap>(); + + /** + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java new file mode 100644 index 00000000000..92337cc0246 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java @@ -0,0 +1,98 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ArrayTest { + + @SerializedName("array_of_string") + private List arrayOfString = new ArrayList(); + + @SerializedName("array_array_of_integer") + private List> arrayArrayOfInteger = new ArrayList>(); + + @SerializedName("array_array_of_model") + private List> arrayArrayOfModel = new ArrayList>(); + + /** + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..d4afc996440 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,101 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class MixedPropertiesAndAdditionalPropertiesClass { + + @SerializedName("uuid") + private String uuid = null; + + @SerializedName("dateTime") + private Date dateTime = null; + + @SerializedName("map") + private Map map = new HashMap(); + + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..32e4f515bce --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -0,0 +1,78 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ReadOnlyFirst { + + @SerializedName("bar") + private String bar = null; + + @SerializedName("baz") + private String baz = null; + + /** + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit2rx/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/retrofit2rx/LICENSE b/samples/client/petstore/java/retrofit2rx/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/java/retrofit2rx/build.sbt b/samples/client/petstore/java/retrofit2rx/build.sbt new file mode 100644 index 00000000000..cfe2d8d341c --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/build.sbt @@ -0,0 +1,22 @@ +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-petstore-retrofit2-rx", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.retrofit2" % "retrofit" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile", + "com.squareup.retrofit2" % "adapter-rxjava" % "2.0.2" % "compile", + "io.reactivex" % "rxjava" % "1.1.3" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit2rx/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2rx/docs/AdditionalPropertiesClass.md index c72785d450f..0437c4dd8cc 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2rx/docs/AdditionalPropertiesClass.md @@ -4,6 +4,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/docs/ArrayTest.md b/samples/client/petstore/java/retrofit2rx/docs/ArrayTest.md index 73c3e5305ad..9feee16427f 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/ArrayTest.md +++ b/samples/client/petstore/java/retrofit2rx/docs/ArrayTest.md @@ -4,6 +4,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md index fcdbd390517..00cc10ca9b3 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] **dateTime** | [**Date**](Date.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties index d28218b9a14..b7a36473955 100644 --- a/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/retrofit2rx/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Tue May 17 23:05:31 CST 2016 +#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java index 4f33efd8991..4d786f28438 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-17T10:34:31.551+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:05:33.279+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..839b04aa6c5 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,84 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class AdditionalPropertiesClass { + + @SerializedName("map_property") + private Map mapProperty = new HashMap(); + + @SerializedName("map_of_map_property") + private Map> mapOfMapProperty = new HashMap>(); + + /** + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ArrayTest.java new file mode 100644 index 00000000000..92337cc0246 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ArrayTest.java @@ -0,0 +1,98 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ArrayTest { + + @SerializedName("array_of_string") + private List arrayOfString = new ArrayList(); + + @SerializedName("array_array_of_integer") + private List> arrayArrayOfInteger = new ArrayList>(); + + @SerializedName("array_array_of_model") + private List> arrayArrayOfModel = new ArrayList>(); + + /** + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + /** + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..d4afc996440 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,101 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; + + + + + +public class MixedPropertiesAndAdditionalPropertiesClass { + + @SerializedName("uuid") + private String uuid = null; + + @SerializedName("dateTime") + private Date dateTime = null; + + @SerializedName("map") + private Map map = new HashMap(); + + /** + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..32e4f515bce --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -0,0 +1,78 @@ +package io.swagger.client.model; + +import java.util.Objects; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import com.google.gson.annotations.SerializedName; + + + + + +public class ReadOnlyFirst { + + @SerializedName("bar") + private String bar = null; + + @SerializedName("baz") + private String baz = null; + + /** + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} From 4da829315fda53c4fb24b98abb09a8bb367cc0f7 Mon Sep 17 00:00:00 2001 From: clasnake Date: Sat, 4 Jun 2016 21:51:49 +0800 Subject: [PATCH 13/67] Add sbt support for feign. --- .../codegen/languages/JavaClientCodegen.java | 2 ++ .../Java/libraries/feign/build.sbt.mustache | 26 +++++++++++++++++++ samples/client/petstore/java/feign/build.sbt | 26 +++++++++++++++++++ .../io/swagger/client/FormAwareEncoder.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../java/io/swagger/client/api/StoreApi.java | 2 +- .../java/io/swagger/client/api/UserApi.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../java/io/swagger/client/model/Animal.java | 2 +- .../io/swagger/client/model/AnimalFarm.java | 2 +- .../io/swagger/client/model/ArrayTest.java | 2 +- .../java/io/swagger/client/model/Cat.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../java/io/swagger/client/model/Dog.java | 2 +- .../io/swagger/client/model/EnumTest.java | 2 +- .../io/swagger/client/model/FormatTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../io/swagger/client/model/ModelReturn.java | 2 +- .../java/io/swagger/client/model/Name.java | 2 +- .../java/io/swagger/client/model/Order.java | 2 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../swagger/client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- 29 files changed, 80 insertions(+), 26 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache create mode 100644 samples/client/petstore/java/feign/build.sbt diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 3f0d287a123..73930a83878 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -275,6 +275,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); + // "build.sbt" is for development with SBT + supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); } supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache new file mode 100644 index 00000000000..edb69307345 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -0,0 +1,26 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "com.netflix.feign" % "feign-core" % "8.16.0" % "compile", + "com.netflix.feign" % "feign-jackson" % "8.16.0" % "compile", + "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.7.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.0" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.1.5" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", + "junit" % "junit" % "4.12" % "testCompile", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt new file mode 100644 index 00000000000..344d5538317 --- /dev/null +++ b/samples/client/petstore/java/feign/build.sbt @@ -0,0 +1,26 @@ +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-petstore-feign", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "com.netflix.feign" % "feign-core" % "8.16.0" % "compile", + "com.netflix.feign" % "feign-jackson" % "8.16.0" % "compile", + "com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.7.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.0" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.1.5" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index 0ed60ea489a..53d318f4e93 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index 6c316df3516..1b26a71cc05 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index 4874476628b..fd6d5f57174 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public interface FakeApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 330838eb0a0..9ffe12bca38 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public interface PetApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 2ff088ba096..0a5f7595022 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public interface StoreApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index c2e63a1a48c..9cd3dbed334 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public interface UserApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 4a7155f2b6a..9b95277bab5 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class AdditionalPropertiesClass { private Map mapProperty = new HashMap(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 1b350d588c9..6cb7abb5b16 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java index e1ded299373..401163f410a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -10,7 +10,7 @@ import java.util.List; /** * AnimalFarm */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class AnimalFarm extends ArrayList { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java index 79b7694b6d3..aa9dea92bcc 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java @@ -12,7 +12,7 @@ import java.util.List; /** * ArrayTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class ArrayTest { private List arrayOfString = new ArrayList(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index 4302c3b25ea..da253692d82 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index f87abb520f4..0d6104965d9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 84f5e702797..ea9cd4d2f98 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index 8d11a05968f..b4c74124d8d 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class EnumTest { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index c4d9d9d3279..58555b88e6a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -12,7 +12,7 @@ import java.util.Date; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class FormatTest { private Integer integer = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 598ed2ccce3..8d1d0fd3c3d 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -15,7 +15,7 @@ import java.util.Map; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index 59aa3011fb9..7346078f425 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index 1927555c00b..5f814027b3c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ModelApiResponse */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index 843c2262bd2..85864f83ebf 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index 2d5b16efdb5..da85a0e9d27 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 9715dc583ca..df44eca9f65 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -12,7 +12,7 @@ import java.util.Date; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index b6062e49c37..a381af628c9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 8afaf45f4a2..dee19f0d01a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class ReadOnlyFirst { private String bar = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index b29b9777a82..832a8a778aa 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index d661146dd86..1041d5df583 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 695c4053ff6..54fd17b7cbb 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") public class User { private Long id = null; From a84ed9cb57be09bd08e3eb2d523031e328d5f439 Mon Sep 17 00:00:00 2001 From: clasnake Date: Sat, 4 Jun 2016 22:18:23 +0800 Subject: [PATCH 14/67] Fix build.sbt.mustache for feign. --- .../src/main/resources/Java/libraries/feign/build.sbt.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache index edb69307345..37eabbd27b2 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -20,7 +20,7 @@ lazy val root = (project in file(".")). "joda-time" % "joda-time" % "2.9.3" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "com.brsanthu" % "migbase64" % "2.2" % "compile", - "junit" % "junit" % "4.12" % "testCompile", + "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) From f3cff97acc4a6fed6bcd5a9e9a967758277ddf9b Mon Sep 17 00:00:00 2001 From: clasnake Date: Sat, 4 Jun 2016 22:21:27 +0800 Subject: [PATCH 15/67] Regenerate the sample client for feign. --- .../feign/src/main/java/io/swagger/client/FormAwareEncoder.java | 2 +- .../java/feign/src/main/java/io/swagger/client/StringUtil.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/FakeApi.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/PetApi.java | 2 +- .../feign/src/main/java/io/swagger/client/api/StoreApi.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/UserApi.java | 2 +- .../java/io/swagger/client/model/AdditionalPropertiesClass.java | 2 +- .../feign/src/main/java/io/swagger/client/model/Animal.java | 2 +- .../feign/src/main/java/io/swagger/client/model/AnimalFarm.java | 2 +- .../feign/src/main/java/io/swagger/client/model/ArrayTest.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Cat.java | 2 +- .../feign/src/main/java/io/swagger/client/model/Category.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Dog.java | 2 +- .../feign/src/main/java/io/swagger/client/model/EnumTest.java | 2 +- .../feign/src/main/java/io/swagger/client/model/FormatTest.java | 2 +- .../model/MixedPropertiesAndAdditionalPropertiesClass.java | 2 +- .../src/main/java/io/swagger/client/model/Model200Response.java | 2 +- .../src/main/java/io/swagger/client/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/client/model/ModelReturn.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Name.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Order.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Pet.java | 2 +- .../src/main/java/io/swagger/client/model/ReadOnlyFirst.java | 2 +- .../src/main/java/io/swagger/client/model/SpecialModelName.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Tag.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/User.java | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index 53d318f4e93..fccefc933ce 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index 1b26a71cc05..4a4c14468b5 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index fd6d5f57174..82ec4afc25f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public interface FakeApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 9ffe12bca38..b568770101b 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public interface PetApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 0a5f7595022..4ac08793f6c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public interface StoreApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index 9cd3dbed334..4ebcce8981c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public interface UserApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 9b95277bab5..af4699c1cf5 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class AdditionalPropertiesClass { private Map mapProperty = new HashMap(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 6cb7abb5b16..36a1e843312 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java index 401163f410a..e5ba3d20af2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -10,7 +10,7 @@ import java.util.List; /** * AnimalFarm */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class AnimalFarm extends ArrayList { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java index aa9dea92bcc..f5e4c25b5cf 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java @@ -12,7 +12,7 @@ import java.util.List; /** * ArrayTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class ArrayTest { private List arrayOfString = new ArrayList(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index da253692d82..aea43d75c5e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 0d6104965d9..27adc7a820c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index ea9cd4d2f98..dcf82945e15 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index b4c74124d8d..5291f51c174 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class EnumTest { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 58555b88e6a..3be249333df 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -12,7 +12,7 @@ import java.util.Date; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class FormatTest { private Integer integer = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8d1d0fd3c3d..22d0e33388f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -15,7 +15,7 @@ import java.util.Map; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index 7346078f425..226aa300ca8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index 5f814027b3c..1dcd3c9b99b 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ModelApiResponse */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index 85864f83ebf..d5bf9048c8a 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index da85a0e9d27..4984f5e60b2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index df44eca9f65..4a08d38f3b0 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -12,7 +12,7 @@ import java.util.Date; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index a381af628c9..8e6e02a37d3 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index dee19f0d01a..02ded2afd7d 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class ReadOnlyFirst { private String bar = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index 832a8a778aa..1bc8d287a76 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 1041d5df583..359f3c1d8fa 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 54fd17b7cbb..3cb71c1a7fb 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") public class User { private Long id = null; From 992a22f40945f18c31c0ad54dd4314b707c36ee6 Mon Sep 17 00:00:00 2001 From: clasnake Date: Sun, 5 Jun 2016 09:22:13 +0800 Subject: [PATCH 16/67] Add build folder under java sample clients into gitignore in sample. --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 4e650733033..7ac37b15529 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,11 @@ samples/client/petstore/java/jersey2/.gradle/ samples/client/petstore/java/jersey2/build/ samples/client/petstore/java/okhttp-gson/.gradle/ samples/client/petstore/java/okhttp-gson/build/ +samples/client/petstore/java/feign/build/ +samples/client/petstore/java/retrofit/build/ +samples/client/petstore/java/retrofit2/build/ +samples/client/petstore/java/retrofit2rx/build/ +samples/client/petstore/java/default/build/ #PHP samples/client/petstore/php/SwaggerClient-php/composer.lock From 955d39f709dce3d415d12178f7389bbfe58dadd4 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Sun, 5 Jun 2016 23:15:36 +0900 Subject: [PATCH 17/67] [Python] Follow PEP8 rules ( Issue #3041 ) --- .../src/main/resources/python/api.mustache | 12 +- .../main/resources/python/api_client.mustache | 2 +- .../main/resources/python/api_test.mustache | 2 +- .../resources/python/configuration.mustache | 2 +- .../src/main/resources/python/model.mustache | 20 +- .../main/resources/python/model_test.mustache | 2 +- .../resources/python/partial_header.mustache | 6 +- .../src/main/resources/python/setup.mustache | 5 +- samples/client/petstore/python/README.md | 2 +- samples/client/petstore/python/setup.py | 10 +- .../python/swagger_client/__init__.py | 6 +- .../python/swagger_client/api_client.py | 2 +- .../python/swagger_client/apis/fake_api.py | 32 ++- .../python/swagger_client/apis/pet_api.py | 22 +- .../python/swagger_client/apis/store_api.py | 20 +- .../python/swagger_client/apis/user_api.py | 22 +- .../python/swagger_client/configuration.py | 8 +- .../python/swagger_client/models/__init__.py | 6 +- .../models/additional_properties_class.py | 11 +- .../python/swagger_client/models/animal.py | 11 +- .../swagger_client/models/animal_farm.py | 8 +- .../swagger_client/models/api_response.py | 13 +- .../swagger_client/models/array_test.py | 13 +- .../python/swagger_client/models/cat.py | 13 +- .../python/swagger_client/models/category.py | 11 +- .../python/swagger_client/models/dog.py | 13 +- .../swagger_client/models/enum_class.py | 8 +- .../python/swagger_client/models/enum_test.py | 7 +- .../swagger_client/models/format_test.py | 59 ++-- .../models/inline_response_200.py | 251 ------------------ ...perties_and_additional_properties_class.py | 13 +- .../models/model_200_response.py | 9 +- .../swagger_client/models/model_return.py | 9 +- .../python/swagger_client/models/name.py | 15 +- .../python/swagger_client/models/order.py | 17 +- .../python/swagger_client/models/pet.py | 17 +- .../swagger_client/models/read_only_first.py | 11 +- .../models/special_model_name.py | 9 +- .../python/swagger_client/models/tag.py | 11 +- .../python/swagger_client/models/user.py | 23 +- .../petstore/python/swagger_client/rest.py | 6 +- .../test/test_additional_properties_class.py | 28 +- .../petstore/python/test/test_animal.py | 28 +- .../petstore/python/test/test_animal_farm.py | 28 +- .../petstore/python/test/test_api_response.py | 28 +- .../petstore/python/test/test_array_test.py | 28 +- .../client/petstore/python/test/test_cat.py | 28 +- .../petstore/python/test/test_category.py | 28 +- .../client/petstore/python/test/test_dog.py | 28 +- .../petstore/python/test/test_enum_class.py | 28 +- .../petstore/python/test/test_enum_test.py | 28 +- .../petstore/python/test/test_fake_api.py | 30 ++- .../petstore/python/test/test_format_test.py | 28 +- ...perties_and_additional_properties_class.py | 28 +- .../python/test/test_model_200_response.py | 28 +- .../petstore/python/test/test_model_return.py | 28 +- .../client/petstore/python/test/test_name.py | 28 +- .../client/petstore/python/test/test_order.py | 28 +- .../client/petstore/python/test/test_pet.py | 28 +- .../petstore/python/test/test_pet_api.py | 28 +- .../python/test/test_read_only_first.py | 28 +- .../python/test/test_special_model_name.py | 28 +- .../petstore/python/test/test_store_api.py | 28 +- .../client/petstore/python/test/test_tag.py | 28 +- .../client/petstore/python/test/test_user.py | 28 +- .../petstore/python/test/test_user_api.py | 28 +- .../python/tests/test_api_exception.py | 3 +- .../python/tests/test_deserialization.py | 89 ++++--- 68 files changed, 654 insertions(+), 879 deletions(-) delete mode 100644 samples/client/petstore/python/swagger_client/models/inline_response_200.py diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 43962c7f525..050278b2b5d 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -73,7 +73,6 @@ class {{classname}}(object): ) params[key] = val del params['kwargs'] - {{#allParams}} {{#required}} # verify the required parameter '{{paramName}}' is set @@ -85,28 +84,27 @@ class {{classname}}(object): {{#allParams}} {{#hasValidation}} {{#maxLength}} - if '{{paramName}}' in params and len(params['{{paramName}}']) > {{maxLength}}: + if '{{paramName}}' in params and len(params['{{paramName}}']) > {{maxLength}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") {{/maxLength}} {{#minLength}} - if '{{paramName}}' in params and len(params['{{paramName}}']) < {{minLength}}: + if '{{paramName}}' in params and len(params['{{paramName}}']) < {{minLength}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") {{/minLength}} {{#maximum}} - if '{{paramName}}' in params and params['{{paramName}}'] > {{maximum}}: + if '{{paramName}}' in params and params['{{paramName}}'] > {{maximum}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than or equal to `{{maximum}}`") {{/maximum}} {{#minimum}} - if '{{paramName}}' in params and params['{{paramName}}'] < {{minimum}}: + if '{{paramName}}' in params and params['{{paramName}}'] < {{minimum}}: raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - if '{{paramName}}' in params and not re.search('{{vendorExtensions.x-regex}}', params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): + if '{{paramName}}' in params and not re.search('{{vendorExtensions.x-regex}}', params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{pattern}}`") {{/pattern}} {{/hasValidation}} {{/allParams}} - resource_path = '{{path}}'.replace('{format}', 'json') path_params = {} {{#pathParams}} diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 07b9419e08f..2a4732f5afd 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -191,7 +191,7 @@ class ApiClient(object): :return: The serialized form of data. """ types = (str, int, float, bool, tuple) - if sys.version_info < (3,0): + if sys.version_info < (3, 0): types = types + (unicode,) if isinstance(obj, type(None)): return None diff --git a/modules/swagger-codegen/src/main/resources/python/api_test.mustache b/modules/swagger-codegen/src/main/resources/python/api_test.mustache index 4906d0e0371..a301d64722a 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_test.mustache @@ -35,4 +35,4 @@ class {{#operations}}Test{{classname}}(unittest.TestCase): {{/operations}} if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index 9ea2ab4a7b5..2a26c651d7d 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -17,6 +17,7 @@ import logging from six import iteritems + def singleton(cls, *args, **kw): instances = {} @@ -59,7 +60,6 @@ class Configuration(object): # access token for OAuth self.access_token = "" {{/isOAuth}}{{/authMethods}} - # Logging Settings self.logger = {} self.logger["package_logger"] = logging.getLogger("{{packageName}}") diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 781bb37e4e5..a592278bf12 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -36,8 +36,8 @@ class {{classname}}(object): {{#vars}} self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}} {{/vars}} - -{{#vars}} +{{#vars}}{{#-first}} +{{/-first}} @property def {{name}}(self): """ @@ -58,7 +58,8 @@ class {{classname}}(object): :param {{name}}: The {{name}} of this {{classname}}. :type: {{datatype}} """ - {{#isEnum}}allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] +{{#isEnum}} + allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] if {{name}} not in allowed_values: raise ValueError( "Invalid value for `{{name}}`, must be one of {0}" @@ -71,23 +72,23 @@ class {{classname}}(object): if not {{name}}: raise ValueError("Invalid value for `{{name}}`, must not be `None`") {{#maxLength}} - if len({{name}}) > {{maxLength}}: + if len({{name}}) > {{maxLength}}: raise ValueError("Invalid value for `{{name}}`, length must be less than `{{maxLength}}`") {{/maxLength}} {{#minLength}} - if len({{name}}) < {{minLength}}: + if len({{name}}) < {{minLength}}: raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") {{/minLength}} {{#maximum}} - if {{name}} > {{maximum}}: + if {{name}} > {{maximum}}: raise ValueError("Invalid value for `{{name}}`, must be a value less than or equal to `{{maximum}}`") {{/maximum}} {{#minimum}} - if {{name}} < {{minimum}}: + if {{name}} < {{minimum}}: raise ValueError("Invalid value for `{{name}}`, must be a value greater than or equal to `{{minimum}}`") {{/minimum}} {{#pattern}} - if not re.search('{{vendorExtensions.x-regex}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): + if not re.search('{{vendorExtensions.x-regex}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`") {{/pattern}} {{/hasValidation}} @@ -145,6 +146,5 @@ class {{classname}}(object): Returns true if both objects are not equal """ return not self == other - {{/model}} -{{/models}} +{{/models}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/python/model_test.mustache b/modules/swagger-codegen/src/main/resources/python/model_test.mustache index ffd38a52b49..3533fa11063 100644 --- a/modules/swagger-codegen/src/main/resources/python/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model_test.mustache @@ -34,4 +34,4 @@ class Test{{classname}}(unittest.TestCase): {{/models}} if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/modules/swagger-codegen/src/main/resources/python/partial_header.mustache b/modules/swagger-codegen/src/main/resources/python/partial_header.mustache index ea97064963c..004460091dd 100644 --- a/modules/swagger-codegen/src/main/resources/python/partial_header.mustache +++ b/modules/swagger-codegen/src/main/resources/python/partial_header.mustache @@ -10,13 +10,13 @@ {{#version}}OpenAPI spec version: {{{version}}}{{/version}} {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/modules/swagger-codegen/src/main/resources/python/setup.mustache b/modules/swagger-codegen/src/main/resources/python/setup.mustache index c825911f91a..f46265995fa 100644 --- a/modules/swagger-codegen/src/main/resources/python/setup.mustache +++ b/modules/swagger-codegen/src/main/resources/python/setup.mustache @@ -7,9 +7,7 @@ from setuptools import setup, find_packages NAME = "{{packageName}}" VERSION = "{{packageVersion}}" - {{#apiInfo}}{{#apis}}{{^hasMore}} - # To install the library, run the following # # python setup.py install @@ -33,5 +31,4 @@ setup( {{appDescription}} """ ) - -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{/hasMore}}{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 274de71c435..453d140f1f7 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-02T12:44:41.178+09:00 +- Build date: 2016-06-05T23:15:10.095+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/setup.py b/samples/client/petstore/python/setup.py index a4d22d206ac..2029c83372c 100644 --- a/samples/client/petstore/python/setup.py +++ b/samples/client/petstore/python/setup.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ from setuptools import setup, find_packages NAME = "swagger_client" VERSION = "1.0.0" - - # To install the library, run the following # # python setup.py install @@ -53,5 +51,3 @@ setup( This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ """ ) - - diff --git a/samples/client/petstore/python/swagger_client/__init__.py b/samples/client/petstore/python/swagger_client/__init__.py index 13fbf2257b0..ae225644f73 100644 --- a/samples/client/petstore/python/swagger_client/__init__.py +++ b/samples/client/petstore/python/swagger_client/__init__.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index 5d5a5fccc4c..5bc448a950c 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -191,7 +191,7 @@ class ApiClient(object): :return: The serialized form of data. """ types = (str, int, float, bool, tuple) - if sys.version_info < (3,0): + if sys.version_info < (3, 0): types = types + (unicode,) if isinstance(obj, type(None)): return None diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/swagger_client/apis/fake_api.py index f8c522d2bf8..317232217b8 100644 --- a/samples/client/petstore/python/swagger_client/apis/fake_api.py +++ b/samples/client/petstore/python/swagger_client/apis/fake_api.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -95,7 +95,6 @@ class FakeApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'number' is set if ('number' not in params) or (params['number'] is None): raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") @@ -109,31 +108,30 @@ class FakeApi(object): if ('byte' not in params) or (params['byte'] is None): raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") - if 'number' in params and params['number'] > 543.2: + if 'number' in params and params['number'] > 543.2: raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") - if 'number' in params and params['number'] < 32.1: + if 'number' in params and params['number'] < 32.1: raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") - if 'double' in params and params['double'] > 123.4: + if 'double' in params and params['double'] > 123.4: raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") - if 'double' in params and params['double'] < 67.8: + if 'double' in params and params['double'] < 67.8: raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") - if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE): + if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE): raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") - if 'integer' in params and params['integer'] > 100.0: + if 'integer' in params and params['integer'] > 100.0: raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100.0`") - if 'integer' in params and params['integer'] < 10.0: + if 'integer' in params and params['integer'] < 10.0: raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10.0`") - if 'int32' in params and params['int32'] > 200.0: + if 'int32' in params and params['int32'] > 200.0: raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200.0`") - if 'int32' in params and params['int32'] < 20.0: + if 'int32' in params and params['int32'] < 20.0: raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20.0`") - if 'float' in params and params['float'] > 987.6: + if 'float' in params and params['float'] > 987.6: raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") - if 'password' in params and len(params['password']) > 64: + if 'password' in params and len(params['password']) > 64: raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") - if 'password' in params and len(params['password']) < 10: + if 'password' in params and len(params['password']) < 10: raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") - resource_path = '/fake'.replace('{format}', 'json') path_params = {} diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index dd730f31dfe..2f2ee4429c2 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -84,12 +84,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `add_pet`") - resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -163,12 +161,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'pet_id' is set if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") - resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -243,12 +239,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'status' is set if ('status' not in params) or (params['status'] is None): raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") - resource_path = '/pet/findByStatus'.replace('{format}', 'json') path_params = {} @@ -321,12 +315,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'tags' is set if ('tags' not in params) or (params['tags'] is None): raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") - resource_path = '/pet/findByTags'.replace('{format}', 'json') path_params = {} @@ -399,12 +391,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'pet_id' is set if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") - resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -477,12 +467,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `update_pet`") - resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -557,12 +545,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'pet_id' is set if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") - resource_path = '/pet/{petId}'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: @@ -641,12 +627,10 @@ class PetApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'pet_id' is set if ('pet_id' not in params) or (params['pet_id'] is None): raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") - resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') path_params = {} if 'pet_id' in params: diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index 61a2d50a5ff..e945b61509c 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -84,14 +84,12 @@ class StoreApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'order_id' is set if ('order_id' not in params) or (params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") - if 'order_id' in params and params['order_id'] < 1.0: + if 'order_id' in params and params['order_id'] < 1.0: raise ValueError("Invalid value for parameter `order_id` when calling `delete_order`, must be a value greater than or equal to `1.0`") - resource_path = '/store/order/{orderId}'.replace('{format}', 'json') path_params = {} if 'order_id' in params: @@ -164,8 +162,6 @@ class StoreApi(object): params[key] = val del params['kwargs'] - - resource_path = '/store/inventory'.replace('{format}', 'json') path_params = {} @@ -236,16 +232,14 @@ class StoreApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'order_id' is set if ('order_id' not in params) or (params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") - if 'order_id' in params and params['order_id'] > 5.0: + if 'order_id' in params and params['order_id'] > 5.0: raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5.0`") - if 'order_id' in params and params['order_id'] < 1.0: + if 'order_id' in params and params['order_id'] < 1.0: raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1.0`") - resource_path = '/store/order/{orderId}'.replace('{format}', 'json') path_params = {} if 'order_id' in params: @@ -318,12 +312,10 @@ class StoreApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `place_order`") - resource_path = '/store/order'.replace('{format}', 'json') path_params = {} diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 17865142a70..5a8f1815495 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -84,12 +84,10 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_user`") - resource_path = '/user'.replace('{format}', 'json') path_params = {} @@ -162,12 +160,10 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") - resource_path = '/user/createWithArray'.replace('{format}', 'json') path_params = {} @@ -240,12 +236,10 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") - resource_path = '/user/createWithList'.replace('{format}', 'json') path_params = {} @@ -318,12 +312,10 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'username' is set if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `delete_user`") - resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: @@ -396,12 +388,10 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'username' is set if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") - resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: @@ -475,7 +465,6 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'username' is set if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `login_user`") @@ -483,7 +472,6 @@ class UserApi(object): if ('password' not in params) or (params['password'] is None): raise ValueError("Missing the required parameter `password` when calling `login_user`") - resource_path = '/user/login'.replace('{format}', 'json') path_params = {} @@ -558,8 +546,6 @@ class UserApi(object): params[key] = val del params['kwargs'] - - resource_path = '/user/logout'.replace('{format}', 'json') path_params = {} @@ -631,7 +617,6 @@ class UserApi(object): ) params[key] = val del params['kwargs'] - # verify the required parameter 'username' is set if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `update_user`") @@ -639,7 +624,6 @@ class UserApi(object): if ('body' not in params) or (params['body'] is None): raise ValueError("Missing the required parameter `body` when calling `update_user`") - resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} if 'username' in params: diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index a1efadf13b7..50b38c61d56 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,6 +37,7 @@ import logging from six import iteritems + def singleton(cls, *args, **kw): instances = {} @@ -79,7 +80,6 @@ class Configuration(object): # access token for OAuth self.access_token = "" - # Logging Settings self.logger = {} self.logger["package_logger"] = logging.getLogger("swagger_client") diff --git a/samples/client/petstore/python/swagger_client/models/__init__.py b/samples/client/petstore/python/swagger_client/models/__init__.py index a3c738c19a8..4ccf94c0415 100644 --- a/samples/client/petstore/python/swagger_client/models/__init__.py +++ b/samples/client/petstore/python/swagger_client/models/__init__.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/samples/client/petstore/python/swagger_client/models/additional_properties_class.py b/samples/client/petstore/python/swagger_client/models/additional_properties_class.py index c62cc80cd8a..510287a1633 100644 --- a/samples/client/petstore/python/swagger_client/models/additional_properties_class.py +++ b/samples/client/petstore/python/swagger_client/models/additional_properties_class.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,7 @@ class AdditionalPropertiesClass(object): :param map_property: The map_property of this AdditionalPropertiesClass. :type: dict(str, str) """ - + self._map_property = map_property @property @@ -97,7 +97,7 @@ class AdditionalPropertiesClass(object): :param map_of_map_property: The map_of_map_property of this AdditionalPropertiesClass. :type: dict(str, dict(str, str)) """ - + self._map_of_map_property = map_of_map_property def to_dict(self): @@ -149,4 +149,3 @@ class AdditionalPropertiesClass(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/animal.py b/samples/client/petstore/python/swagger_client/models/animal.py index 1fe5bc6d4ba..6ed4786c88b 100644 --- a/samples/client/petstore/python/swagger_client/models/animal.py +++ b/samples/client/petstore/python/swagger_client/models/animal.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,7 @@ class Animal(object): :param class_name: The class_name of this Animal. :type: str """ - + self._class_name = class_name @property @@ -97,7 +97,7 @@ class Animal(object): :param color: The color of this Animal. :type: str """ - + self._color = color def to_dict(self): @@ -149,4 +149,3 @@ class Animal(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/animal_farm.py b/samples/client/petstore/python/swagger_client/models/animal_farm.py index d240be4b7ff..72fce33f252 100644 --- a/samples/client/petstore/python/swagger_client/models/animal_farm.py +++ b/samples/client/petstore/python/swagger_client/models/animal_farm.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,7 +49,6 @@ class AnimalFarm(object): } - def to_dict(self): """ Returns the model properties as a dict @@ -99,4 +98,3 @@ class AnimalFarm(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/api_response.py b/samples/client/petstore/python/swagger_client/models/api_response.py index dfbe253b8d9..8719ec107be 100644 --- a/samples/client/petstore/python/swagger_client/models/api_response.py +++ b/samples/client/petstore/python/swagger_client/models/api_response.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,7 +77,7 @@ class ApiResponse(object): :param code: The code of this ApiResponse. :type: int """ - + self._code = code @property @@ -100,7 +100,7 @@ class ApiResponse(object): :param type: The type of this ApiResponse. :type: str """ - + self._type = type @property @@ -123,7 +123,7 @@ class ApiResponse(object): :param message: The message of this ApiResponse. :type: str """ - + self._message = message def to_dict(self): @@ -175,4 +175,3 @@ class ApiResponse(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/array_test.py b/samples/client/petstore/python/swagger_client/models/array_test.py index def23e7cd5e..c0006207649 100644 --- a/samples/client/petstore/python/swagger_client/models/array_test.py +++ b/samples/client/petstore/python/swagger_client/models/array_test.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,7 +77,7 @@ class ArrayTest(object): :param array_of_string: The array_of_string of this ArrayTest. :type: list[str] """ - + self._array_of_string = array_of_string @property @@ -100,7 +100,7 @@ class ArrayTest(object): :param array_array_of_integer: The array_array_of_integer of this ArrayTest. :type: list[list[int]] """ - + self._array_array_of_integer = array_array_of_integer @property @@ -123,7 +123,7 @@ class ArrayTest(object): :param array_array_of_model: The array_array_of_model of this ArrayTest. :type: list[list[ReadOnlyFirst]] """ - + self._array_array_of_model = array_array_of_model def to_dict(self): @@ -175,4 +175,3 @@ class ArrayTest(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/cat.py b/samples/client/petstore/python/swagger_client/models/cat.py index 92fe431523c..3b44fde4ee0 100644 --- a/samples/client/petstore/python/swagger_client/models/cat.py +++ b/samples/client/petstore/python/swagger_client/models/cat.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,7 +77,7 @@ class Cat(object): :param class_name: The class_name of this Cat. :type: str """ - + self._class_name = class_name @property @@ -100,7 +100,7 @@ class Cat(object): :param color: The color of this Cat. :type: str """ - + self._color = color @property @@ -123,7 +123,7 @@ class Cat(object): :param declawed: The declawed of this Cat. :type: bool """ - + self._declawed = declawed def to_dict(self): @@ -175,4 +175,3 @@ class Cat(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/category.py b/samples/client/petstore/python/swagger_client/models/category.py index 6962ce3a7a5..4a88b5776f2 100644 --- a/samples/client/petstore/python/swagger_client/models/category.py +++ b/samples/client/petstore/python/swagger_client/models/category.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,7 @@ class Category(object): :param id: The id of this Category. :type: int """ - + self._id = id @property @@ -97,7 +97,7 @@ class Category(object): :param name: The name of this Category. :type: str """ - + self._name = name def to_dict(self): @@ -149,4 +149,3 @@ class Category(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/dog.py b/samples/client/petstore/python/swagger_client/models/dog.py index 62b03f7a405..bf31dd37312 100644 --- a/samples/client/petstore/python/swagger_client/models/dog.py +++ b/samples/client/petstore/python/swagger_client/models/dog.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,7 +77,7 @@ class Dog(object): :param class_name: The class_name of this Dog. :type: str """ - + self._class_name = class_name @property @@ -100,7 +100,7 @@ class Dog(object): :param color: The color of this Dog. :type: str """ - + self._color = color @property @@ -123,7 +123,7 @@ class Dog(object): :param breed: The breed of this Dog. :type: str """ - + self._breed = breed def to_dict(self): @@ -175,4 +175,3 @@ class Dog(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/enum_class.py b/samples/client/petstore/python/swagger_client/models/enum_class.py index 1a7e9fec738..ec78827141b 100644 --- a/samples/client/petstore/python/swagger_client/models/enum_class.py +++ b/samples/client/petstore/python/swagger_client/models/enum_class.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,7 +49,6 @@ class EnumClass(object): } - def to_dict(self): """ Returns the model properties as a dict @@ -99,4 +98,3 @@ class EnumClass(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/enum_test.py b/samples/client/petstore/python/swagger_client/models/enum_test.py index 0f6c734a5b4..9bcaafc0501 100644 --- a/samples/client/petstore/python/swagger_client/models/enum_test.py +++ b/samples/client/petstore/python/swagger_client/models/enum_test.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -193,4 +193,3 @@ class EnumTest(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py index b7aa17b3ee6..d29155be143 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -107,12 +107,12 @@ class FormatTest(object): :param integer: The integer of this FormatTest. :type: int """ - + if not integer: raise ValueError("Invalid value for `integer`, must not be `None`") - if integer > 100.0: + if integer > 100.0: raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100.0`") - if integer < 10.0: + if integer < 10.0: raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10.0`") self._integer = integer @@ -137,12 +137,12 @@ class FormatTest(object): :param int32: The int32 of this FormatTest. :type: int """ - + if not int32: raise ValueError("Invalid value for `int32`, must not be `None`") - if int32 > 200.0: + if int32 > 200.0: raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200.0`") - if int32 < 20.0: + if int32 < 20.0: raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20.0`") self._int32 = int32 @@ -167,7 +167,7 @@ class FormatTest(object): :param int64: The int64 of this FormatTest. :type: int """ - + self._int64 = int64 @property @@ -190,12 +190,12 @@ class FormatTest(object): :param number: The number of this FormatTest. :type: float """ - + if not number: raise ValueError("Invalid value for `number`, must not be `None`") - if number > 543.2: + if number > 543.2: raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") - if number < 32.1: + if number < 32.1: raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") self._number = number @@ -220,12 +220,12 @@ class FormatTest(object): :param float: The float of this FormatTest. :type: float """ - + if not float: raise ValueError("Invalid value for `float`, must not be `None`") - if float > 987.6: + if float > 987.6: raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") - if float < 54.3: + if float < 54.3: raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") self._float = float @@ -250,12 +250,12 @@ class FormatTest(object): :param double: The double of this FormatTest. :type: float """ - + if not double: raise ValueError("Invalid value for `double`, must not be `None`") - if double > 123.4: + if double > 123.4: raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") - if double < 67.8: + if double < 67.8: raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") self._double = double @@ -280,10 +280,10 @@ class FormatTest(object): :param string: The string of this FormatTest. :type: str """ - + if not string: raise ValueError("Invalid value for `string`, must not be `None`") - if not re.search('[a-z]', string, flags=re.IGNORECASE): + if not re.search('[a-z]', string, flags=re.IGNORECASE): raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") self._string = string @@ -308,7 +308,7 @@ class FormatTest(object): :param byte: The byte of this FormatTest. :type: str """ - + self._byte = byte @property @@ -331,7 +331,7 @@ class FormatTest(object): :param binary: The binary of this FormatTest. :type: str """ - + self._binary = binary @property @@ -354,7 +354,7 @@ class FormatTest(object): :param date: The date of this FormatTest. :type: date """ - + self._date = date @property @@ -377,7 +377,7 @@ class FormatTest(object): :param date_time: The date_time of this FormatTest. :type: datetime """ - + self._date_time = date_time @property @@ -400,7 +400,7 @@ class FormatTest(object): :param uuid: The uuid of this FormatTest. :type: str """ - + self._uuid = uuid @property @@ -423,12 +423,12 @@ class FormatTest(object): :param password: The password of this FormatTest. :type: str """ - + if not password: raise ValueError("Invalid value for `password`, must not be `None`") - if len(password) > 64: + if len(password) > 64: raise ValueError("Invalid value for `password`, length must be less than `64`") - if len(password) < 10: + if len(password) < 10: raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") self._password = password @@ -482,4 +482,3 @@ class FormatTest(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/inline_response_200.py b/samples/client/petstore/python/swagger_client/models/inline_response_200.py deleted file mode 100644 index f55ff5ee4d5..00000000000 --- a/samples/client/petstore/python/swagger_client/models/inline_response_200.py +++ /dev/null @@ -1,251 +0,0 @@ -# coding: utf-8 - -""" -Copyright 2016 SmartBear Software - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Ref: https://github.com/swagger-api/swagger-codegen -""" - -from pprint import pformat -from six import iteritems - - -class InlineResponse200(object): - """ - NOTE: This class is auto generated by the swagger code generator program. - Do not edit the class manually. - """ - def __init__(self): - """ - InlineResponse200 - a model defined in Swagger - - :param dict swaggerTypes: The key is attribute name - and the value is attribute type. - :param dict attributeMap: The key is attribute name - and the value is json key in definition. - """ - self.swagger_types = { - 'tags': 'list[Tag]', - 'id': 'int', - 'category': 'object', - 'status': 'str', - 'name': 'str', - 'photo_urls': 'list[str]' - } - - self.attribute_map = { - 'tags': 'tags', - 'id': 'id', - 'category': 'category', - 'status': 'status', - 'name': 'name', - 'photo_urls': 'photoUrls' - } - - self._tags = None - self._id = None - self._category = None - self._status = None - self._name = None - self._photo_urls = None - - @property - def tags(self): - """ - Gets the tags of this InlineResponse200. - - - :return: The tags of this InlineResponse200. - :rtype: list[Tag] - """ - return self._tags - - @tags.setter - def tags(self, tags): - """ - Sets the tags of this InlineResponse200. - - - :param tags: The tags of this InlineResponse200. - :type: list[Tag] - """ - self._tags = tags - - @property - def id(self): - """ - Gets the id of this InlineResponse200. - - - :return: The id of this InlineResponse200. - :rtype: int - """ - return self._id - - @id.setter - def id(self, id): - """ - Sets the id of this InlineResponse200. - - - :param id: The id of this InlineResponse200. - :type: int - """ - self._id = id - - @property - def category(self): - """ - Gets the category of this InlineResponse200. - - - :return: The category of this InlineResponse200. - :rtype: object - """ - return self._category - - @category.setter - def category(self, category): - """ - Sets the category of this InlineResponse200. - - - :param category: The category of this InlineResponse200. - :type: object - """ - self._category = category - - @property - def status(self): - """ - Gets the status of this InlineResponse200. - pet status in the store - - :return: The status of this InlineResponse200. - :rtype: str - """ - return self._status - - @status.setter - def status(self, status): - """ - Sets the status of this InlineResponse200. - pet status in the store - - :param status: The status of this InlineResponse200. - :type: str - """ - allowed_values = ["available", "pending", "sold"] - if status not in allowed_values: - raise ValueError( - "Invalid value for `status`, must be one of {0}" - .format(allowed_values) - ) - self._status = status - - @property - def name(self): - """ - Gets the name of this InlineResponse200. - - - :return: The name of this InlineResponse200. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """ - Sets the name of this InlineResponse200. - - - :param name: The name of this InlineResponse200. - :type: str - """ - self._name = name - - @property - def photo_urls(self): - """ - Gets the photo_urls of this InlineResponse200. - - - :return: The photo_urls of this InlineResponse200. - :rtype: list[str] - """ - return self._photo_urls - - @photo_urls.setter - def photo_urls(self, photo_urls): - """ - Sets the photo_urls of this InlineResponse200. - - - :param photo_urls: The photo_urls of this InlineResponse200. - :type: list[str] - """ - self._photo_urls = photo_urls - - def to_dict(self): - """ - Returns the model properties as a dict - """ - result = {} - - for attr, _ in iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - - return result - - def to_str(self): - """ - Returns the string representation of the model - """ - return pformat(self.to_dict()) - - def __repr__(self): - """ - For `print` and `pprint` - """ - return self.to_str() - - def __eq__(self, other): - """ - Returns true if both objects are equal - """ - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """ - Returns true if both objects are not equal - """ - return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py index 2122cabdb53..99c7c9d943c 100644 --- a/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,7 +77,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :param uuid: The uuid of this MixedPropertiesAndAdditionalPropertiesClass. :type: str """ - + self._uuid = uuid @property @@ -100,7 +100,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :param date_time: The date_time of this MixedPropertiesAndAdditionalPropertiesClass. :type: datetime """ - + self._date_time = date_time @property @@ -123,7 +123,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :param map: The map of this MixedPropertiesAndAdditionalPropertiesClass. :type: dict(str, Animal) """ - + self._map = map def to_dict(self): @@ -175,4 +175,3 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/model_200_response.py b/samples/client/petstore/python/swagger_client/models/model_200_response.py index e566d5e16cd..cd86b10e963 100644 --- a/samples/client/petstore/python/swagger_client/models/model_200_response.py +++ b/samples/client/petstore/python/swagger_client/models/model_200_response.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -71,7 +71,7 @@ class Model200Response(object): :param name: The name of this Model200Response. :type: int """ - + self._name = name def to_dict(self): @@ -123,4 +123,3 @@ class Model200Response(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/model_return.py b/samples/client/petstore/python/swagger_client/models/model_return.py index 840e64004d6..711418c3d91 100644 --- a/samples/client/petstore/python/swagger_client/models/model_return.py +++ b/samples/client/petstore/python/swagger_client/models/model_return.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -71,7 +71,7 @@ class ModelReturn(object): :param _return: The _return of this ModelReturn. :type: int """ - + self.__return = _return def to_dict(self): @@ -123,4 +123,3 @@ class ModelReturn(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/name.py b/samples/client/petstore/python/swagger_client/models/name.py index 8c66493dafa..45d7b4bd8d0 100644 --- a/samples/client/petstore/python/swagger_client/models/name.py +++ b/samples/client/petstore/python/swagger_client/models/name.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -80,7 +80,7 @@ class Name(object): :param name: The name of this Name. :type: int """ - + self._name = name @property @@ -103,7 +103,7 @@ class Name(object): :param snake_case: The snake_case of this Name. :type: int """ - + self._snake_case = snake_case @property @@ -126,7 +126,7 @@ class Name(object): :param _property: The _property of this Name. :type: str """ - + self.__property = _property @property @@ -149,7 +149,7 @@ class Name(object): :param _123_number: The _123_number of this Name. :type: int """ - + self.__123_number = _123_number def to_dict(self): @@ -201,4 +201,3 @@ class Name(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/swagger_client/models/order.py index 54c30dea04c..a15e20f924e 100644 --- a/samples/client/petstore/python/swagger_client/models/order.py +++ b/samples/client/petstore/python/swagger_client/models/order.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -86,7 +86,7 @@ class Order(object): :param id: The id of this Order. :type: int """ - + self._id = id @property @@ -109,7 +109,7 @@ class Order(object): :param pet_id: The pet_id of this Order. :type: int """ - + self._pet_id = pet_id @property @@ -132,7 +132,7 @@ class Order(object): :param quantity: The quantity of this Order. :type: int """ - + self._quantity = quantity @property @@ -155,7 +155,7 @@ class Order(object): :param ship_date: The ship_date of this Order. :type: datetime """ - + self._ship_date = ship_date @property @@ -207,7 +207,7 @@ class Order(object): :param complete: The complete of this Order. :type: bool """ - + self._complete = complete def to_dict(self): @@ -259,4 +259,3 @@ class Order(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/pet.py b/samples/client/petstore/python/swagger_client/models/pet.py index f5dc79384b5..deccb9630b7 100644 --- a/samples/client/petstore/python/swagger_client/models/pet.py +++ b/samples/client/petstore/python/swagger_client/models/pet.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -86,7 +86,7 @@ class Pet(object): :param id: The id of this Pet. :type: int """ - + self._id = id @property @@ -109,7 +109,7 @@ class Pet(object): :param category: The category of this Pet. :type: Category """ - + self._category = category @property @@ -132,7 +132,7 @@ class Pet(object): :param name: The name of this Pet. :type: str """ - + self._name = name @property @@ -155,7 +155,7 @@ class Pet(object): :param photo_urls: The photo_urls of this Pet. :type: list[str] """ - + self._photo_urls = photo_urls @property @@ -178,7 +178,7 @@ class Pet(object): :param tags: The tags of this Pet. :type: list[Tag] """ - + self._tags = tags @property @@ -259,4 +259,3 @@ class Pet(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/read_only_first.py b/samples/client/petstore/python/swagger_client/models/read_only_first.py index b4014f3a78b..4f479ae1d7f 100644 --- a/samples/client/petstore/python/swagger_client/models/read_only_first.py +++ b/samples/client/petstore/python/swagger_client/models/read_only_first.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,7 @@ class ReadOnlyFirst(object): :param bar: The bar of this ReadOnlyFirst. :type: str """ - + self._bar = bar @property @@ -97,7 +97,7 @@ class ReadOnlyFirst(object): :param baz: The baz of this ReadOnlyFirst. :type: str """ - + self._baz = baz def to_dict(self): @@ -149,4 +149,3 @@ class ReadOnlyFirst(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/special_model_name.py b/samples/client/petstore/python/swagger_client/models/special_model_name.py index 9aac6ae248c..af3fb00dda7 100644 --- a/samples/client/petstore/python/swagger_client/models/special_model_name.py +++ b/samples/client/petstore/python/swagger_client/models/special_model_name.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -71,7 +71,7 @@ class SpecialModelName(object): :param special_property_name: The special_property_name of this SpecialModelName. :type: int """ - + self._special_property_name = special_property_name def to_dict(self): @@ -123,4 +123,3 @@ class SpecialModelName(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/tag.py b/samples/client/petstore/python/swagger_client/models/tag.py index 9ba29be5cd1..a91b8127d51 100644 --- a/samples/client/petstore/python/swagger_client/models/tag.py +++ b/samples/client/petstore/python/swagger_client/models/tag.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,7 @@ class Tag(object): :param id: The id of this Tag. :type: int """ - + self._id = id @property @@ -97,7 +97,7 @@ class Tag(object): :param name: The name of this Tag. :type: str """ - + self._name = name def to_dict(self): @@ -149,4 +149,3 @@ class Tag(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/models/user.py b/samples/client/petstore/python/swagger_client/models/user.py index 4559387a9fe..f98a895b716 100644 --- a/samples/client/petstore/python/swagger_client/models/user.py +++ b/samples/client/petstore/python/swagger_client/models/user.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -92,7 +92,7 @@ class User(object): :param id: The id of this User. :type: int """ - + self._id = id @property @@ -115,7 +115,7 @@ class User(object): :param username: The username of this User. :type: str """ - + self._username = username @property @@ -138,7 +138,7 @@ class User(object): :param first_name: The first_name of this User. :type: str """ - + self._first_name = first_name @property @@ -161,7 +161,7 @@ class User(object): :param last_name: The last_name of this User. :type: str """ - + self._last_name = last_name @property @@ -184,7 +184,7 @@ class User(object): :param email: The email of this User. :type: str """ - + self._email = email @property @@ -207,7 +207,7 @@ class User(object): :param password: The password of this User. :type: str """ - + self._password = password @property @@ -230,7 +230,7 @@ class User(object): :param phone: The phone of this User. :type: str """ - + self._phone = phone @property @@ -253,7 +253,7 @@ class User(object): :param user_status: The user_status of this User. :type: int """ - + self._user_status = user_status def to_dict(self): @@ -305,4 +305,3 @@ class User(object): Returns true if both objects are not equal """ return not self == other - diff --git a/samples/client/petstore/python/swagger_client/rest.py b/samples/client/petstore/python/swagger_client/rest.py index de53bcacdb1..d27f1652706 100644 --- a/samples/client/petstore/python/swagger_client/rest.py +++ b/samples/client/petstore/python/swagger_client/rest.py @@ -8,13 +8,13 @@ OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git - + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/samples/client/petstore/python/test/test_additional_properties_class.py b/samples/client/petstore/python/test/test_additional_properties_class.py index 52163f2afec..f2370e4ea21 100644 --- a/samples/client/petstore/python/test/test_additional_properties_class.py +++ b/samples/client/petstore/python/test/test_additional_properties_class.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestAdditionalPropertiesClass(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_animal.py b/samples/client/petstore/python/test/test_animal.py index 279ed1850dd..83c8f872250 100644 --- a/samples/client/petstore/python/test/test_animal.py +++ b/samples/client/petstore/python/test/test_animal.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestAnimal(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_animal_farm.py b/samples/client/petstore/python/test/test_animal_farm.py index 74dd22fd3b9..637d259b1e8 100644 --- a/samples/client/petstore/python/test/test_animal_farm.py +++ b/samples/client/petstore/python/test/test_animal_farm.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestAnimalFarm(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_api_response.py b/samples/client/petstore/python/test/test_api_response.py index be73dbf373d..6ee0ef03ae9 100644 --- a/samples/client/petstore/python/test/test_api_response.py +++ b/samples/client/petstore/python/test/test_api_response.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestApiResponse(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_array_test.py b/samples/client/petstore/python/test/test_array_test.py index 494596c842f..7d2e9ff9fe9 100644 --- a/samples/client/petstore/python/test/test_array_test.py +++ b/samples/client/petstore/python/test/test_array_test.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestArrayTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_cat.py b/samples/client/petstore/python/test/test_cat.py index 728a824fa5b..8baccfa294d 100644 --- a/samples/client/petstore/python/test/test_cat.py +++ b/samples/client/petstore/python/test/test_cat.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestCat(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_category.py b/samples/client/petstore/python/test/test_category.py index 793fbdf41b0..ff57ffb1f7d 100644 --- a/samples/client/petstore/python/test/test_category.py +++ b/samples/client/petstore/python/test/test_category.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestCategory(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_dog.py b/samples/client/petstore/python/test/test_dog.py index 044dc5be51f..cb44931140e 100644 --- a/samples/client/petstore/python/test/test_dog.py +++ b/samples/client/petstore/python/test/test_dog.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestDog(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_enum_class.py b/samples/client/petstore/python/test/test_enum_class.py index 22e2b5ebb5c..488e8306c8f 100644 --- a/samples/client/petstore/python/test/test_enum_class.py +++ b/samples/client/petstore/python/test/test_enum_class.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestEnumClass(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_enum_test.py b/samples/client/petstore/python/test/test_enum_test.py index 49cb79e6bc3..bbe985aeeaf 100644 --- a/samples/client/petstore/python/test/test_enum_test.py +++ b/samples/client/petstore/python/test/test_enum_test.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestEnumTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py index 29b71bdf81a..fb480485829 100644 --- a/samples/client/petstore/python/test/test_fake_api.py +++ b/samples/client/petstore/python/test/test_fake_api.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -42,10 +46,10 @@ class TestFakeApi(unittest.TestCase): """ Test case for test_endpoint_parameters - Fake endpoint for testing various parameters + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 """ pass if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py index 11101ad52da..966a0887f0a 100644 --- a/samples/client/petstore/python/test/test_format_test.py +++ b/samples/client/petstore/python/test/test_format_test.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestFormatTest(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py index 6cea606481c..f19e0211af7 100644 --- a/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_model_200_response.py b/samples/client/petstore/python/test/test_model_200_response.py index 8328d2b9757..74519b4bac5 100644 --- a/samples/client/petstore/python/test/test_model_200_response.py +++ b/samples/client/petstore/python/test/test_model_200_response.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestModel200Response(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_model_return.py b/samples/client/petstore/python/test/test_model_return.py index 4ff3f38b2eb..54c9422545d 100644 --- a/samples/client/petstore/python/test/test_model_return.py +++ b/samples/client/petstore/python/test/test_model_return.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestModelReturn(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_name.py b/samples/client/petstore/python/test/test_name.py index c3b27897eb1..be10b1ddd78 100644 --- a/samples/client/petstore/python/test/test_name.py +++ b/samples/client/petstore/python/test/test_name.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestName(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_order.py b/samples/client/petstore/python/test/test_order.py index 23beefe346c..21c2b4830d9 100644 --- a/samples/client/petstore/python/test/test_order.py +++ b/samples/client/petstore/python/test/test_order.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestOrder(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_pet.py b/samples/client/petstore/python/test/test_pet.py index 471b7b4f67c..fc0ce0a727c 100644 --- a/samples/client/petstore/python/test/test_pet.py +++ b/samples/client/petstore/python/test/test_pet.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestPet(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_pet_api.py b/samples/client/petstore/python/test/test_pet_api.py index 81ee6c76e9c..8ea0c9c0acd 100644 --- a/samples/client/petstore/python/test/test_pet_api.py +++ b/samples/client/petstore/python/test/test_pet_api.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -104,4 +108,4 @@ class TestPetApi(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_read_only_first.py b/samples/client/petstore/python/test/test_read_only_first.py index d7073915dfe..ea7a0ad76e8 100644 --- a/samples/client/petstore/python/test/test_read_only_first.py +++ b/samples/client/petstore/python/test/test_read_only_first.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestReadOnlyFirst(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_special_model_name.py b/samples/client/petstore/python/test/test_special_model_name.py index 17c12655031..e76bc9bbf9b 100644 --- a/samples/client/petstore/python/test/test_special_model_name.py +++ b/samples/client/petstore/python/test/test_special_model_name.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestSpecialModelName(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_store_api.py b/samples/client/petstore/python/test/test_store_api.py index e8dc0a64b1c..ecce38463b5 100644 --- a/samples/client/petstore/python/test/test_store_api.py +++ b/samples/client/petstore/python/test/test_store_api.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -72,4 +76,4 @@ class TestStoreApi(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_tag.py b/samples/client/petstore/python/test/test_tag.py index 35b51e4d7d2..db35da374ae 100644 --- a/samples/client/petstore/python/test/test_tag.py +++ b/samples/client/petstore/python/test/test_tag.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestTag(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_user.py b/samples/client/petstore/python/test/test_user.py index 1aad154cbf8..e57b3600f0e 100644 --- a/samples/client/petstore/python/test/test_user.py +++ b/samples/client/petstore/python/test/test_user.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -46,4 +50,4 @@ class TestUser(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/test/test_user_api.py b/samples/client/petstore/python/test/test_user_api.py index 0205fe7383a..88c2f862983 100644 --- a/samples/client/petstore/python/test/test_user_api.py +++ b/samples/client/petstore/python/test/test_user_api.py @@ -1,21 +1,25 @@ # coding: utf-8 """ -Copyright 2016 SmartBear Software + Swagger Petstore - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - http://www.apache.org/licenses/LICENSE-2.0 + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ref: https://github.com/swagger-api/swagger-codegen + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. """ from __future__ import absolute_import @@ -104,4 +108,4 @@ class TestUserApi(unittest.TestCase): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python/tests/test_api_exception.py b/samples/client/petstore/python/tests/test_api_exception.py index 790a18dffd0..96ca4e7bfbc 100644 --- a/samples/client/petstore/python/tests/test_api_exception.py +++ b/samples/client/petstore/python/tests/test_api_exception.py @@ -44,7 +44,7 @@ class ApiExceptionTests(unittest.TestCase): def test_404_error(self): self.pet_api.add_pet(body=self.pet) self.pet_api.delete_pet(pet_id=self.pet.id) - + with self.checkRaiseRegex(ApiException, "Pet not found"): self.pet_api.get_pet_by_id(pet_id=self.pet.id) @@ -87,4 +87,3 @@ class ApiExceptionTests(unittest.TestCase): return self.assertRegexpMatches(text, expected_regex) return self.assertRegex(text, expected_regex) - diff --git a/samples/client/petstore/python/tests/test_deserialization.py b/samples/client/petstore/python/tests/test_deserialization.py index 1eae045ff76..e1d7e250b4b 100644 --- a/samples/client/petstore/python/tests/test_deserialization.py +++ b/samples/client/petstore/python/tests/test_deserialization.py @@ -78,23 +78,23 @@ class DeserializationTests(unittest.TestCase): def test_deserialize_pet(self): """ deserialize pet """ data = { + "id": 0, + "category": { "id": 0, - "category": { + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { "id": 0, "name": "string" - }, - "name": "doggie", - "photoUrls": [ - "string" - ], - "tags": [ - { - "id": 0, - "name": "string" - } - ], - "status": "available" - } + } + ], + "status": "available" + } deserialized = self.deserialize(data, "Pet") self.assertTrue(isinstance(deserialized, swagger_client.Pet)) self.assertEqual(deserialized.id, 0) @@ -106,42 +106,43 @@ class DeserializationTests(unittest.TestCase): def test_deserialize_list_of_pet(self): """ deserialize list[Pet] """ - data = [{ - "id": 0, - "category": { + data = [ + { "id": 0, - "name": "string" - }, - "name": "doggie0", - "photoUrls": [ - "string" - ], - "tags": [ - { + "category": { "id": 0, "name": "string" - } - ], - "status": "available" - }, - { - "id": 1, - "category": { - "id": 0, - "name": "string" + }, + "name": "doggie0", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" }, - "name": "doggie1", - "photoUrls": [ - "string" - ], - "tags": [ - { + { + "id": 1, + "category": { "id": 0, "name": "string" - } - ], - "status": "available" - }] + }, + "name": "doggie1", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + }] deserialized = self.deserialize(data, "list[Pet]") self.assertTrue(isinstance(deserialized, list)) self.assertTrue(isinstance(deserialized[0], swagger_client.Pet)) From 556f529933c51fbb27be6a1de7e57fb154f0e764 Mon Sep 17 00:00:00 2001 From: cbornet Date: Mon, 6 Jun 2016 11:45:07 +0200 Subject: [PATCH 18/67] add option to use single content-type produces/consumes --- bin/spring-stubs.sh | 2 +- .../languages/SpringBootServerCodegen.java | 19 ++++++++--- .../resources/JavaSpringBoot/api.mustache | 8 +++-- .../SpringBootServerOptionsProvider.java | 2 ++ .../SpringBootServerOptionsTest.java | 2 ++ .../src/main/java/io/swagger/api/PetApi.java | 34 +++++++++---------- .../main/java/io/swagger/api/StoreApi.java | 18 +++++----- .../src/main/java/io/swagger/api/UserApi.java | 34 +++++++++---------- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 14 files changed, 74 insertions(+), 57 deletions(-) diff --git a/bin/spring-stubs.sh b/bin/spring-stubs.sh index 48719f2e696..3d13f2fe8b9 100755 --- a/bin/spring-stubs.sh +++ b/bin/spring-stubs.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/client/petstore/spring-stubs -DinterfaceOnly=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/client/petstore/spring-stubs -DinterfaceOnly=true,singleContentTypes=true" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 1574fd7175e..2e58343f30a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -11,10 +11,12 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege public static final String CONFIG_PACKAGE = "configPackage"; public static final String BASE_PACKAGE = "basePackage"; public static final String INTERFACE_ONLY = "interfaceOnly"; + public static final String SINGLE_CONTENT_TYPES = "singleContentTypes"; protected String title = "Petstore Server"; protected String configPackage = ""; protected String basePackage = ""; protected boolean interfaceOnly = false; + protected boolean singleContentTypes = false; protected String templateFileName = "api.mustache"; public SpringBootServerCodegen() { @@ -42,7 +44,8 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); cliOptions.add(new CliOption(BASE_PACKAGE, "base package for generated code")); cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.")); - + cliOptions.add(CliOption.newBoolean(SINGLE_CONTENT_TYPES, "Whether to select only one produces/consumes content-type by operation.")); + supportedLibraries.clear(); supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring Boot server stub."); supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " + @@ -85,6 +88,10 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege this.setInterfaceOnly(Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString())); } + if (additionalProperties.containsKey(SINGLE_CONTENT_TYPES)) { + this.setSingleContentTypes(Boolean.valueOf(additionalProperties.get(SINGLE_CONTENT_TYPES).toString())); + } + supportingFiles.clear(); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); @@ -137,10 +144,10 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege opList.add(co); co.baseName = basePath; } - + @Override public void preprocessSwagger(Swagger swagger) { - System.out.println("preprocessSwagger"); + super.preprocessSwagger(swagger); if ("/".equals(swagger.getBasePath())) { swagger.setBasePath(""); } @@ -153,7 +160,7 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege port = parts[1]; } } - + this.additionalProperties.put("serverPort", port); if (swagger != null && swagger.getPaths() != null) { for (String pathname : swagger.getPaths().keySet()) { @@ -265,6 +272,10 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege public void setInterfaceOnly(boolean interfaceOnly) { this.interfaceOnly = interfaceOnly; } + + public void setSingleContentTypes(boolean singleContentTypes) { + this.singleContentTypes = singleContentTypes; + } @Override public Map postProcessModels(Map objs) { diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache index 672e1bbe9ba..3ccc7686db9 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache @@ -37,9 +37,11 @@ public interface {{classname}} { }{{/hasAuthMethods}}) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) - @RequestMapping(value = "{{{path}}}", - {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} - {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} + @RequestMapping(value = "{{{path}}}",{{#singleContentTypes}} + produces = "{{{vendorExtensions.x-accepts}}}", + consumes = "{{{vendorExtensions.x-contentType}}}",{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} + produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} + consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} method = RequestMethod.{{httpMethod}}) ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java index 6e766a21d07..c4b1281c1dc 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java @@ -11,6 +11,7 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider { public static final String BASE_PACKAGE_VALUE = "basePackage"; public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class public static final String INTERFACE_ONLY = "true"; + public static final String SINGLE_CONTENT_TYPES = "true"; @Override public String getLanguage() { @@ -24,6 +25,7 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider { options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE); options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); options.put(SpringBootServerCodegen.INTERFACE_ONLY, INTERFACE_ONLY); + options.put(SpringBootServerCodegen.SINGLE_CONTENT_TYPES, SINGLE_CONTENT_TYPES); return options; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java index 34a53db1dad..c60ac3a582d 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java @@ -56,6 +56,8 @@ public class SpringBootServerOptionsTest extends JavaClientOptionsTest { times = 1; clientCodegen.setInterfaceOnly(Boolean.valueOf(SpringBootServerOptionsProvider.INTERFACE_ONLY)); times = 1; + clientCodegen.setSingleContentTypes(Boolean.valueOf(SpringBootServerOptionsProvider.SINGLE_CONTENT_TYPES)); + times = 1; }}; } 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 9bb732d245c..f19cf83d436 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 @@ -24,7 +24,7 @@ import static org.springframework.http.MediaType.*; @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -36,8 +36,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, - consumes = { "application/json", "application/xml" }, + produces = "application/json", + consumes = "application/json", method = RequestMethod.POST) ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); @@ -51,8 +51,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.DELETE) ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @@ -68,8 +68,8 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) @RequestMapping(value = "/findByStatus", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status); @@ -84,8 +84,8 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) @RequestMapping(value = "/findByTags", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @@ -98,8 +98,8 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @@ -115,8 +115,8 @@ public interface PetApi { @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, - consumes = { "application/json", "application/xml" }, + produces = "application/json", + consumes = "application/json", method = RequestMethod.PUT) ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); @@ -130,8 +130,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @RequestMapping(value = "/{petId}", - produces = { "application/xml", "application/json" }, - consumes = { "application/x-www-form-urlencoded" }, + produces = "application/json", + consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name, @@ -147,8 +147,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json" }, - consumes = { "multipart/form-data" }, + produces = "application/json", + consumes = "multipart/form-data", method = RequestMethod.POST) ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java index b8a29cdf3b2..1e715e15d52 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -23,7 +23,7 @@ import static org.springframework.http.MediaType.*; @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @@ -31,8 +31,8 @@ public interface StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.DELETE) ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); @@ -43,8 +43,8 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @RequestMapping(value = "/inventory", - produces = { "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity> getInventory(); @@ -55,8 +55,8 @@ public interface StoreApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); @@ -66,8 +66,8 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) @RequestMapping(value = "/order", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.POST) ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index 15d815fcb96..5155b294bd1 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -23,15 +23,15 @@ import static org.springframework.http.MediaType.*; @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.POST) ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); @@ -40,8 +40,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithArray", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.POST) ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @@ -50,8 +50,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/createWithList", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.POST) ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @@ -61,8 +61,8 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.DELETE) ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @@ -73,8 +73,8 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @@ -84,8 +84,8 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) @RequestMapping(value = "/login", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @@ -95,8 +95,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @RequestMapping(value = "/logout", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.GET) ResponseEntity logoutUser(); @@ -106,8 +106,8 @@ public interface UserApi { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) @RequestMapping(value = "/{username}", - produces = { "application/xml", "application/json" }, - + produces = "application/json", + consumes = "application/json", method = RequestMethod.PUT) ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index be0a5b6ad47..3164c584235 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index c9256ca70fe..dc24196a4ea 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index 632893e4652..84d84a68f02 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index 08e73d83c21..479228e5a1b 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index b339bb8db02..780333072cd 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index 55c4a39b092..dcce4f24516 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:22:53.698+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") public class User { private Long id = null; From 1836062e6f2ae7ceb80e8d70f5d10d12d9f3b0a4 Mon Sep 17 00:00:00 2001 From: cbornet Date: Mon, 6 Jun 2016 14:40:11 +0200 Subject: [PATCH 19/67] don't put RequestMapping on the interface as Spring-MVC will automatically consider it as a controller which is not necessarily the case (eg. for a spring-cloud FeignClient) --- .../languages/SpringBootServerCodegen.java | 3 -- .../resources/JavaSpringBoot/api.mustache | 3 +- .../src/main/java/io/swagger/api/PetApi.java | 21 +++++++------- .../main/java/io/swagger/api/StoreApi.java | 13 ++++----- .../src/main/java/io/swagger/api/UserApi.java | 21 +++++++------- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- .../java/io/swagger/api/ApiException.java | 2 +- .../java/io/swagger/api/ApiOriginFilter.java | 2 +- .../io/swagger/api/ApiResponseMessage.java | 2 +- .../io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 25 +++++++--------- .../java/io/swagger/api/PetApiController.java | 2 +- .../main/java/io/swagger/api/StoreApi.java | 17 ++++------- .../io/swagger/api/StoreApiController.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 29 +++++++------------ .../io/swagger/api/UserApiController.java | 2 +- .../SwaggerDocumentationConfig.java | 2 +- .../main/java/io/swagger/model/Category.java | 2 +- .../io/swagger/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 28 files changed, 73 insertions(+), 99 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 2e58343f30a..dbed6bc98c4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -131,9 +131,6 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege if (basePath == "") { basePath = "default"; } else { - if (co.path.startsWith("/" + basePath)) { - co.path = co.path.substring(("/" + basePath).length()); - } co.subresourceOperation = !co.path.isEmpty(); } List opList = operations.get(basePath); diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache index 3ccc7686db9..bd0d7180529 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache @@ -21,8 +21,7 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") +@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API") {{>generatedAnnotation}} {{#operations}} public interface {{classname}} { 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 f19cf83d436..d055f19cc23 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 @@ -22,9 +22,8 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@Api(value = "pet", description = "the pet API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -35,7 +34,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) @@ -50,7 +49,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) @@ -67,7 +66,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/findByStatus", + @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -83,7 +82,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/findByTags", + @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -97,7 +96,7 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -114,7 +113,7 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) @@ -129,7 +128,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) @@ -146,7 +145,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/{petId}/uploadImage", + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java index 1e715e15d52..03c07525bb3 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -21,16 +21,15 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@Api(value = "store", description = "the store API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/order/{orderId}", + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) @@ -42,7 +41,7 @@ public interface StoreApi { }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/inventory", + @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -54,7 +53,7 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/order/{orderId}", + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -65,7 +64,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/order", + @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index 5155b294bd1..3da36b4c67c 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -21,15 +21,14 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@Api(value = "user", description = "the user API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) @@ -39,7 +38,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/createWithArray", + @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) @@ -49,7 +48,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/createWithList", + @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) @@ -60,7 +59,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) @@ -72,7 +71,7 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -83,7 +82,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/login", + @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -94,7 +93,7 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/logout", + @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) @@ -105,7 +104,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index 3164c584235..1c0dbbf75a7 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index dc24196a4ea..818052af3a5 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index 84d84a68f02..d3754b6e828 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class Order { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index 479228e5a1b..dbfcc186ba7 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index 780333072cd..349ef702332 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index dcce4f24516..2ba7d2274aa 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T10:53:41.429+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:44.961+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index dd9f929eef5..9da33ef61cf 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index 0467b6d0b13..a62f9cf5a04 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index 1acb8e00b62..96257d752b8 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index fa507439440..dbc07fc4545 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { 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 30cdb5b7814..08c6882eb46 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 @@ -22,9 +22,8 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@Api(value = "pet", description = "the pet API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -35,7 +34,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) @@ -50,9 +49,8 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @@ -67,9 +65,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) - @RequestMapping(value = "/findByStatus", + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status); @@ -83,9 +80,8 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) - @RequestMapping(value = "/findByTags", + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @@ -97,9 +93,8 @@ public interface PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @@ -114,7 +109,7 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) @@ -129,7 +124,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - @RequestMapping(value = "/{petId}", + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) @@ -146,7 +141,7 @@ public interface PetApi { }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/{petId}/uploadImage", + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) 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 cb3b30c0ce0..64e90944464 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 @@ -21,7 +21,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class PetApiController implements PetApi { public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index 95dbf7170b6..901d46bee81 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -21,18 +21,16 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@Api(value = "store", description = "the store API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - @RequestMapping(value = "/order/{orderId}", + @RequestMapping(value = "/store/order/{orderId}", produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); @@ -42,9 +40,8 @@ public interface StoreApi { }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) - @RequestMapping(value = "/inventory", + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, - method = RequestMethod.GET) ResponseEntity> getInventory(); @@ -54,9 +51,8 @@ public interface StoreApi { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - @RequestMapping(value = "/order/{orderId}", + @RequestMapping(value = "/store/order/{orderId}", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); @@ -65,9 +61,8 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - @RequestMapping(value = "/order", + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java index 82d59878419..04178b670f4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class StoreApiController implements StoreApi { public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index 1d16485a5cc..da170f5eb3e 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -21,17 +21,15 @@ import java.util.List; import static org.springframework.http.MediaType.*; -@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@Api(value = "user", description = "the user API") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "", + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); @@ -39,9 +37,8 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/createWithArray", + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @@ -49,9 +46,8 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/createWithList", + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body); @@ -60,9 +56,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @@ -72,9 +67,8 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 404, message = "User not found", response = User.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @@ -83,9 +77,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) - @RequestMapping(value = "/login", + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @@ -94,9 +87,8 @@ public interface UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - @RequestMapping(value = "/logout", + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) ResponseEntity logoutUser(); @@ -105,9 +97,8 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) - @RequestMapping(value = "/{username}", + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, - method = RequestMethod.PUT) ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index c89b4344d42..8af34d5d47a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class UserApiController implements UserApi { public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 2b2c0e4ef8b..9dcf5890183 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -13,7 +13,7 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class SwaggerDocumentationConfig { ApiInfo apiInfo() { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index 4a0a3f96c31..da5fcf8299c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index 1dc6b16915c..0f5c4078ae9 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 951e1cb6878..ae7fbc45add 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index be6ee7d529e..de7615f484d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 7d2d0bd587c..174ff984fc3 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index ffeaafe129f..e22fd5071d5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-03T12:27:25.655+02:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") public class User { private Long id = null; From 4c9e7ae5720ad3b4f0b4b53cfc0424d46beff774 Mon Sep 17 00:00:00 2001 From: clasnake Date: Mon, 6 Jun 2016 22:04:17 +0800 Subject: [PATCH 20/67] Add gradle support for the scala client. --- .../codegen/languages/ScalaClientCodegen.java | 12 ++ .../resources/scala/build.gradle.mustache | 120 +++++++++++ .../main/resources/scala/gradle-wrapper.jar | Bin 0 -> 53639 bytes .../scala/gradle-wrapper.properties.mustache | 6 + .../scala/gradle.properties.mustache | 2 + .../main/resources/scala/gradlew.bat.mustache | 90 ++++++++ .../src/main/resources/scala/gradlew.mustache | 160 ++++++++++++++ .../resources/scala/settings.gradle.mustache | 1 + .../petstore/scala/.swagger-codegen-ignore | 23 ++ samples/client/petstore/scala/LICENSE | 201 ++++++++++++++++++ samples/client/petstore/scala/build.gradle | 120 +++++++++++ .../reports/tests/classes/PetApiTest.html | 121 +++++++++++ .../reports/tests/classes/StoreApiTest.html | 101 +++++++++ .../reports/tests/classes/UserApiTest.html | 121 +++++++++++ .../build/reports/tests/css/base-style.css | 179 ++++++++++++++++ .../scala/build/reports/tests/css/style.css | 84 ++++++++ .../scala/build/reports/tests/index.html | 150 +++++++++++++ .../scala/build/reports/tests/js/report.js | 194 +++++++++++++++++ .../build/test-results/TEST-PetApiTest.xml | 11 + .../build/test-results/TEST-StoreApiTest.xml | 8 + .../build/test-results/TEST-UserApiTest.xml | 12 ++ .../build/test-results/binary/test/output.bin | 1 + .../test-results/binary/test/output.bin.idx | Bin 0 -> 36 bytes .../test-results/binary/test/results.bin | Bin 0 -> 605 bytes .../test/jar_extract_2499683789472893630_tmp | 0 .../test/jar_extract_2588204703609432255_tmp | Bin 0 -> 10545 bytes .../test/jar_extract_5992752952754193465_tmp | Bin 0 -> 596 bytes .../test/jar_extract_6315988328729383060_tmp | Bin 0 -> 2287 bytes .../test/jar_extract_899015300961717389_tmp | Bin 0 -> 572 bytes samples/client/petstore/scala/git_push.sh | 4 +- .../client/petstore/scala/gradle.properties | 2 + .../scala/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53639 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + samples/client/petstore/scala/gradlew | 160 ++++++++++++++ samples/client/petstore/scala/gradlew.bat | 90 ++++++++ samples/client/petstore/scala/settings.gradle | 1 + .../scala/io/swagger/client/api/PetApi.scala | 2 +- 37 files changed, 1979 insertions(+), 3 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/scala/build.gradle.mustache create mode 100644 modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.jar create mode 100644 modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.properties.mustache create mode 100644 modules/swagger-codegen/src/main/resources/scala/gradle.properties.mustache create mode 100644 modules/swagger-codegen/src/main/resources/scala/gradlew.bat.mustache create mode 100755 modules/swagger-codegen/src/main/resources/scala/gradlew.mustache create mode 100644 modules/swagger-codegen/src/main/resources/scala/settings.gradle.mustache create mode 100644 samples/client/petstore/scala/.swagger-codegen-ignore create mode 100644 samples/client/petstore/scala/LICENSE create mode 100644 samples/client/petstore/scala/build.gradle create mode 100644 samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html create mode 100644 samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html create mode 100644 samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html create mode 100644 samples/client/petstore/scala/build/reports/tests/css/base-style.css create mode 100644 samples/client/petstore/scala/build/reports/tests/css/style.css create mode 100644 samples/client/petstore/scala/build/reports/tests/index.html create mode 100644 samples/client/petstore/scala/build/reports/tests/js/report.js create mode 100644 samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml create mode 100644 samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml create mode 100644 samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml create mode 100644 samples/client/petstore/scala/build/test-results/binary/test/output.bin create mode 100644 samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx create mode 100644 samples/client/petstore/scala/build/test-results/binary/test/results.bin create mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp create mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp create mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_5992752952754193465_tmp create mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp create mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp create mode 100644 samples/client/petstore/scala/gradle.properties create mode 100644 samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.properties create mode 100755 samples/client/petstore/scala/gradlew create mode 100644 samples/client/petstore/scala/gradlew.bat create mode 100644 samples/client/petstore/scala/settings.gradle diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java index 992693810da..12467f12efe 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java @@ -35,6 +35,7 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig protected String artifactVersion = "1.0.0"; protected String sourceFolder = "src/main/scala"; protected String authScheme = ""; + protected String gradleWrapperPackage = "gradle.wrapper"; protected boolean authPreemptive; protected boolean asyncHttpClient = !authScheme.isEmpty(); @@ -74,6 +75,17 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig (sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiInvoker.scala")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + // gradle settings + supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle")); + supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); + supportingFiles.add(new SupportingFile("gradle.properties.mustache", "", "gradle.properties")); + // gradleWrapper files + supportingFiles.add(new SupportingFile( "gradlew.mustache", "", "gradlew") ); + supportingFiles.add(new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); + supportingFiles.add(new SupportingFile( "gradle-wrapper.properties.mustache", + gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); + supportingFiles.add(new SupportingFile( "gradle-wrapper.jar", + gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); importMapping.remove("List"); importMapping.remove("Set"); diff --git a/modules/swagger-codegen/src/main/resources/scala/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/scala/build.gradle.mustache new file mode 100644 index 00000000000..88faa3610b2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/build.gradle.mustache @@ -0,0 +1,120 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 23 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'scala' + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = '{{artifactId}}' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + scala_version = "2.10.4" + joda_version = "1.2" + jodatime_version = "2.2" + jersey_version = "1.19" + swagger_core_version = "1.5.8" + jersey_async_version = "1.0.5" + jackson_version = "2.4.2" + junit_version = "4.8.1" + scala_test_version = "2.2.4" +} + +dependencies { + compile "com.fasterxml.jackson.module:jackson-module-scala_2.10:$jackson_version" + compile "com.sun.jersey:jersey-client:$jersey_version" + compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" + compile "org.jfarcand:jersey-ahc-client:$jersey_async_version" + compile "org.scala-lang:scala-library:$scala_version" + compile "io.swagger:swagger-core:$swagger_core_version" + testCompile "org.scalatest:scalatest_2.10:$scala_test_version" + testCompile "junit:junit:$junit_version" + compile "joda-time:joda-time:$jodatime_version" + compile "org.joda:joda-convert:$joda_version" +} diff --git a/modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.jar b/modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2c6137b87896c8f70315ae454e00a969ef5f6019 GIT binary patch literal 53639 zcmafaW0a=B^559DjdyI@wr$%scWm3Xy<^+Pj_sKpY&N+!|K#4>Bz;ajPk*RBjZ;RV75EK*;qpZCo(BB5~-#>pF^k0$_Qx&3rs}{XFZ)$uJU-ZpbB>L3?|knJ{J+ge{%=bI`#Yn9v&Fxx>fd=_|H)(FY-DO{ z_Wxu>{a02GXCp^PGw1(fh-I*;dGTM?mA^##pNEJ#c-Y%I7@3kW(VN&Bxw!bn$iWOU zB8BZ)vT4(}GX%q~h3EYwbR?$d6|xnvg_e@4>dl5l+%FtPbGqa`;Uk##t$#g&CK4GO zz%my0ZR1Fv@~b2_>T0cBP)ECz-Uc^nW9e+`W4!=mSJPopgoe3A(NMzBd0mR?$&3XA zRL1}bJ2Q%R#bWHrC`j_)tPKMEyHuGSpdJMhT(Ob(e9H+#=Skp%#jzj=BVvc(-RSWB z{_T`UcEeWD{z`!3-y;_N|Ljr4%f;2qPSM%n?_s%GnYsM!d3p)CxmudpyIPqTxjH!i z;}A+!>>N;pko++K5n~I7m4>yco2%Zc$59RohB(l%KcJc9s^nw^?2JGy>O4#x5+CZH zqU~7kA>WE)ngvsdfKhLUX0Lc3r+In0Uyn}LZhm?n){&LHNJws546du%pia=j zyH8CD{^Qx%kFe@kX*$B!DxLa(Y?BO32sm8%#_ynjU-m>PJbabL`~0Ai zeJm<6okftSJUd2!X(>}i#KAh-NR2!Kg%c2JD=G|T%@Q0JQzqKB)Qc4E-{ZF=#PGZg zior4-caRB-Jj;l}Xb_!)TjB`jC}})6z~3AsRE&t~CO&)g{dqM0iK;lvav8?kE1< zmCrHxDZe?&rEK7M4tG-i!`Zk-*IzSk0M0&Ul8+J>*UD(A^;bAFDcz>d&lzAlw}b## zjfu@)rAou-86EN%8_Nv;%bNUmy*<6sbgB9)ZCihdSh_VT2iGFv+T8p&Z&wO02nKtdx?eZh^=*<>SZHSn(Pv)bgn{ zb15>YnVnJ^PO025c~^uK&W1C1XTs1az44L~-9Z-fU3{VvA?T& zdpi&S`mZ|$tMuN{{i|O}fAx#*KkroHe;6z^7c*x`2Rk!a2L~HB$A4@(Rz*hvM+og( zJW+4;S-A$#+Gec-rn8}at+q5gRrNy^iU?Z4Gz_|qzS~sG_EV#m%-VW!jQ>f3jc-Vq zW;~>OqI1Th&*fx#`c^=|A4GGoDp+ZH!n0_fDo-ks3d&GlT=(qzr(?Qw`PHvo3PoU6YJE zu{35)=P`LRm@+=ziAI)7jktM6KHx*v&WHVBYp<~UtR3c?Wv_{a0(k&NF!o#+@|Y6Y z>{||-i0v8N2ntXRrVx~#Z1JMA3C2ki}OkJ4W`WjZIuLByNUEL2HqqKrbi{9a8` zk-w0I$a<6;W6&X<&EbIqul`;nvc+D~{g5al{0oOSp~ zhg;6nG1Bh-XyOBM63jb_z`7apSsta``K{!Q{}mZ!m4rTmWi^<*BN2dh#PLZ)oXIJY zl#I3@$+8Fvi)m<}lK_}7q~VN%BvT^{q~ayRA7mwHO;*r0ePSK*OFv_{`3m+96HKgt z=nD-=Pv90Ae1p)+SPLT&g(Fdqbcc(Vnk5SFyc|Tq08qS;FJ1K4rBmtns%Su=GZchE zR(^9W-y!{QfeVPBeHpaBA{TZpQ*(d$H-*GI)Y}>X2Lk&27aFkqXE7D?G_iGav2r&P zx3V=8GBGi8agj5!H?lDMr`1nYmvKZj!~0{GMPb!tM=VIJXbTk9q8JRoSPD*CH@4I+ zfG-6{Z=Yb->)MIUmXq-#;=lNCyF1G*W+tW6gdD||kQfW$J_@=Y9KmMD!(t#9-fPcJ z>%&KQC-`%E`{y^i!1u=rJP_hhGErM$GYE3Y@ZzzA2a-PC>yaoDziZT#l+y)tfyR}U z5Epq`ACY|VUVISHESM5$BpWC0FpDRK&qi?G-q%Rd8UwIq&`d(Mqa<@(fH!OfNIgFICEG?j_Gj7FS()kY^P(I!zbl`%HB z7Rx=q2vZFjy^XypORT$^NJv_`Vm7-gkJWYsN5xg>snt5%oG?w1K#l_UH<>4@d0G@3 z)r?|yba6;ksyc+5+8YZ?)NZ+ER!4fIzK>>cs^(;ib7M}asT&)+J=J@U^~ffJ>65V# zt_lyUp52t`vT&gcQ%a6Ca)p8u6v}3iJzf?zsx#e9t)-1OtqD$Mky&Lpz6_v?p0|y4 zI{Nq9z89OxQbsqX)UYj z(BGu`28f8C^e9R2jf0Turq;v+fPCWD*z8!8-Q-_s`ILgwo@mtnjpC_D$J zCz7-()9@8rQ{4qy<5;*%bvX3k$grUQ{Bt;B#w))A+7ih631uN?!_~?i^g+zO^lGK$>O1T1$6VdF~%FKR6~Px%M`ibJG*~uQ>o^r9qLo*`@^ry@KX^$LH0>NGPL%MG8|;8 z@_)h2uvB1M!qjGtZgy~7-O=GUa`&;xEFvC zwIt?+O;Fjwgn3aE%`_XfZEw5ayP+JS8x?I|V3ARbQ5@{JAl1E*5a{Ytc(UkoDKtD# zu)K4XIYno7h3)0~5&93}pMJMDr*mcYM|#(FXS@Pj)(2!cl$)R-GwwrpOW!zZ2|wN) zE|B38xr4_NBv|%_Lpnm$We<_~S{F1x42tph3PAS`0saF^PisF6EDtce+9y6jdITmu zqI-CLeTn2%I3t3z_=e=YGzUX6i5SEujY`j|=aqv#(Q=iWPkKhau@g|%#xVC2$6<{2 zAoimy5vLq6rvBo3rv&^VqtaKt_@Vx^gWN{f4^@i6H??!ra^_KC-ShWC(GBNt3o~T^ zudX<0v!;s$rIflR?~Tu4-D=%~E=glv+1|pg*ea30re-2K@8EqQ{8#WY4X-br_!qpq zL;PRCi^e~EClLpGb1MrsXCqfD2m615mt;EyR3W6XKU=4(A^gFCMMWgn#5o1~EYOH* zOlolGlD;B!j%lRFaoc)q_bOH-O!r}g1Bhlhy*dRoTf-bI%`A`kU)Q=HA9HgCKqq&A z2$_rtL-uIA7`PiJfw380j@M4Fff-?(Xe(aR`4>BZyDN2$2E7QQ1}95@X819fnA(}= za=5VF-%;l}aHSRHCfs(#Qf%dPue~fGpy7qPs*eLX2Aa0+@mPxnS4Wm8@kP7KEL)8s z@tNmawLHST-FS4h%20%lVvd zkXpxWa43E`zX{6-{2c+L9C`l(ZRG8`kO9g7t&hx?>j~5_C;y5u*Bvl79)Bq?@T7bN z=G2?QDa0J3VwCfZG0BjOFP>xz4jtv3LS>jz#1x~b9u1*n9>Y6?u8W?I^~;N{GC<1y} zc&Wz{L`kJUSt=oA=5ZHtNj3PSB%w5^=0(U7GC^zUgcdkujo>ruzyBurtTjKuNf1-+ zzn~oZFXCbR&xq&W{ar~T`@fNef5M$u^-C92HMBo=*``D8Q^ktX z(qT{_R=*EI?-R9nNUFNR#{(Qb;27bM14bjI`c#4RiinHbnS445Jy^%krK%kpE zFw%RVQd6kqsNbiBtH*#jiPu3(%}P7Vhs0G9&Dwb4E-hXO!|whZ!O$J-PU@j#;GrzN zwP9o=l~Nv}4OPvv5rVNoFN>Oj0TC%P>ykicmFOx*dyCs@7XBH|w1k2hb`|3|i^GEL zyg7PRl9eV ztQ1z)v~NwH$ebcMSKc-4D=?G^3sKVG47ZWldhR@SHCr}SwWuj5t!W$&HAA*Wo_9tM zw5vs`2clw`z@~R-#W8d4B8!rFtO}+-$-{6f_`O-^-EhGraqg%$D618&<9KG``D|Rb zQJ&TSE3cfgf8i}I^DLu+-z{{;QM>K3I9~3R9!0~=Y`A1=6`CF#XVH@MWO?3@xa6ev zdw08_9L=>3%)iXA(_CE@ipRQ{Tb+@mxoN^3ktgmt^mJ(u#=_Plt?5qMZOA3&I1&NU zOG+0XTsIkbhGsp(ApF2MphRG^)>vqagn!-%pRnppa%`-l@DLS0KUm8*e9jGT0F%0J z*-6E@Z*YyeZ{eP7DGmxQedo}^+w zM~>&E$5&SW6MxP##J56Eo@0P34XG})MLCuhMyDFf**?tziO?_Ad&Jhd z`jok^B{3ff*7cydrxYjdxX`14`S+34kW^$fxDmNn2%fsQ6+Zou0%U{3Y>L}UIbQbw z*E#{Von}~UEAL?vvihW)4?Kr-R?_?JSN?B?QzhUWj==1VNEieTMuTJ#-nl*c@qP+` zGk@aE0oAD5!9_fO=tDQAt9g0rKTr{Z0t~S#oy5?F3&aWm+igqKi| zK9W3KRS|1so|~dx%90o9+FVuN7)O@by^mL=IX_m^M87i&kT1^#9TCpI@diZ_p$uW3 zbA+-ER9vJ{ii?QIZF=cfZT3#vJEKC|BQhNd zGmxBDLEMnuc*AET~k8g-P-K+S~_(+GE9q6jyIMka(dr}(H% z$*z;JDnyI@6BQ7KGcrv03Hn(abJ_-vqS>5~m*;ZJmH$W`@csQ8ejiC8S#sYTB;AoF zXsd!kDTG#3FOo-iJJpd$C~@8}GQJ$b1A85MXp?1#dHWQu@j~i4L*LG40J}+V=&-(g zh~Hzk(l1$_y}PX}Ypluyiib0%vwSqPaJdy9EZ;?+;lFF8%Kb7cwPD17C}@N z2OF;}QCM4;CDx~d;XnunQAx5mQbL#);}H57I+uB9^v|cmZwuXGkoH-cAJ%nIjSO$E z{BpYdC9poyO5pvdL+ZPWFuK}c8WGEq-#I3myONq^BL%uG`RIoSBTEK9sAeU4UBh7f zzM$s|&NtAGN&>`lp5Ruc%qO^oL;VGnzo9A8{fQn@YoORA>qw;^n2pydq>;Ji9(sPH zLGsEeTIH?_6C3uyWoW(gkmM(RhFkiDuQPXmL7Oes(+4)YIHt+B@i`*%0KcgL&A#ua zAjb8l_tO^Ag!ai3f54t?@{aoW%&Hdst}dglRzQlS=M{O!=?l z*xY2vJ?+#!70RO8<&N^R4p+f=z z*&_e}QT%6-R5Wt66moGfvorp$yE|3=-2_(y`FnL0-7A?h%4NMZ#F#Rcb^}971t5ib zw<20w|C?HVv%|)Q)Pef8tGjwQ+!+<{>IVjr@&SRVO*PyC?Efnsq;Eq{r;U2)1+tgp z)@pZ}gJmzf{m=K@7YA_8X#XK+)F465h%z38{V-K8k%&_GF+g^s&9o6^B-&|MDFI)H zj1ofQL>W(MJLOu3xkkJZV@$}GEG~XBz~WvRjxhT0$jKKZKjuKi$rmR-al}Hb3xDL) z^xGG2?5+vUAo4I;$(JgeVQe9+e)vvJ={pO~05f|J={%dsSLVcF>@F9p4|nYK&hMua zWjNvRod}l~WmGo|LX2j#w$r$y?v^H?Gu(_?(WR_%D@1I@$yMTKqD=Ca2) zWBQmx#A$gMrHe^A8kxAgB}c2R5)14G6%HfpDf$(Di|p8ntcN;Hnk)DR1;toC9zo77 zcWb?&&3h65(bLAte%hstI9o%hZ*{y=8t$^!y2E~tz^XUY2N2NChy;EIBmf(Kl zfU~&jf*}p(r;#MP4x5dI>i`vjo`w?`9^5(vfFjmWp`Ch!2Ig}rkpS|T%g@2h-%V~R zg!*o7OZSU-%)M8D>F^|z+2F|!u1mOt?5^zG%;{^CrV^J?diz9AmF!UsO?Pl79DKvD zo-2==yjbcF5oJY!oF?g)BKmC8-v|iL6VT|Gj!Gk5yaXfhs&GeR)OkZ}=q{exBPv)& zV!QTQBMNs>QQ))>(rZOn0PK+-`|7vKvrjky3-Kmuf8uJ`x6&wsA5S(tMf=m;79Hzv za%lZ(OhM&ZUCHtM~FRd#Uk3Iy%oXe^)!Jci39D(a$51WER+%gIZYP)!}nDtDw_FgPL3e>1ilFN=M(j~V` zjOtRhOB8bX8}*FD0oy}+s@r4XQT;OFH__cEn-G#aYHpJDI4&Zo4y2>uJdbPYe zOMGMvbA6#(p00i1{t~^;RaHmgZtE@we39mFaO0r|CJ0zUk$|1Pp60Q&$A;dm>MfP# zkfdw?=^9;jsLEXsccMOi<+0-z|NZb(#wwkcO)nVxJxkF3g(OvW4`m36ytfPx5e-ujFXf($)cVOn|qt9LL zNr!InmcuVkxEg8=_;E)+`>n2Y0eAIDrklnE=T9Pyct>^4h$VDDy>}JiA=W9JE79<6 zv%hpzeJC)TGX|(gP!MGWRhJV}!fa1mcvY%jC^(tbG3QIcQnTy&8UpPPvIekWM!R?R zKQanRv+YZn%s4bqv1LBgQ1PWcEa;-MVeCk`$^FLYR~v%9b-@&M%giqnFHV;5P5_et z@R`%W>@G<6GYa=JZ)JsNMN?47)5Y3@RY`EVOPzxj;z6bn#jZv|D?Fn#$b}F!a}D9{ ztB_roYj%34c-@~ehWM_z;B{G5;udhY`rBH0|+u#!&KLdnw z;!A%tG{%Ua;}OW$BG`B#^8#K$1wX2K$m`OwL-6;hmh{aiuyTz;U|EKES= z9UsxUpT^ZZyWk0;GO;Fe=hC`kPSL&1GWS7kGX0>+votm@V-lg&OR>0*!Iay>_|5OT zF0w~t01mupvy4&HYKnrG?sOsip%=<>nK}Bxth~}g)?=Ax94l_=mC{M@`bqiKtV5vf zIP!>8I;zHdxsaVt9K?{lXCc$%kKfIwh&WM__JhsA?o$!dzxP znoRU4ZdzeN3-W{6h~QQSos{-!W@sIMaM z4o?97?W5*cL~5%q+T@>q%L{Yvw(a2l&68hI0Ra*H=ZjU!-o@3(*7hIKo?I7$gfB(Vlr!62-_R-+T;I0eiE^><*1_t|scfB{r9+a%UxP~CBr zl1!X^l01w8o(|2da~Mca)>Mn}&rF!PhsP_RIU~7)B~VwKIruwlUIlOI5-yd4ci^m{ zBT(H*GvKNt=l7a~GUco)C*2t~7>2t?;V{gJm=WNtIhm4x%KY>Rm(EC^w3uA{0^_>p zM;Na<+I<&KwZOUKM-b0y6;HRov=GeEi&CqEG9^F_GR*0RSM3ukm2c2s{)0<%{+g78 zOyKO%^P(-(U09FO!75Pg@xA{p+1$*cD!3=CgW4NO*p}&H8&K`(HL&$TH2N-bf%?JL zVEWs;@_UDD7IoM&P^(k-U?Gs*sk=bLm+f1p$ggYKeR_7W>Zz|Dl{{o*iYiB1LHq`? ztT)b^6Pgk!Kn~ozynV`O(hsUI52|g{0{cwdQ+=&@$|!y8{pvUC_a5zCemee6?E{;P zVE9;@3w92Nu9m_|x24gtm23{ST8Bp;;iJlhaiH2DVcnYqot`tv>!xiUJXFEIMMP(ZV!_onqyQtB_&x}j9 z?LXw;&z%kyYjyP8CQ6X);-QW^?P1w}&HgM}irG~pOJ()IwwaDp!i2$|_{Ggvw$-%K zp=8N>0Fv-n%W6{A8g-tu7{73N#KzURZl;sb^L*d%leKXp2Ai(ZvO96T#6*!73GqCU z&U-NB*0p@?f;m~1MUN}mfdpBS5Q-dbhZ$$OWW=?t8bT+R5^vMUy$q$xY}ABi60bb_ z9;fj~2T2Ogtg8EDNr4j96{@+9bRP#Li7YDK1Jh8|Mo%NON|bYXi~D(W8oiC2SSE#p z=yQ0EP*}Z)$K$v?MJp8s=xroI@gSp&y!De;aik!U7?>3!sup&HY{6!eElc+?ZW*|3 zjJ;Nx>Kn@)3WP`{R821FpY6p1)yeJPi6yfq=EffesCZjO$#c;p!sc8{$>M-i#@fCt zw?GQV4MTSvDH(NlD2S*g-YnxCDp*%|z9^+|HQ(#XI0Pa8-Io=pz8C&Lp?23Y5JopL z!z_O3s+AY&`HT%KO}EB73{oTar{hg)6J7*KI;_Gy%V%-oO3t+vcyZ?;&%L z3t4A%Ltf=2+f8qITmoRfolL;I__Q8Z&K9*+_f#Sue$2C;xTS@%Z*z-lOAF-+gj1C$ zKEpt`_qg;q^41dggeNsJv#n=5i+6Wyf?4P_a=>s9n(ET_K|*zvh633Mv3Xm3OE!n` zFk^y65tStyk4aamG*+=5V^UePR2e0Fbt7g$({L1SjOel~1^9SmP2zGJ)RZX(>6u4^ zQ78wF_qtS~6b+t&mKM=w&Dt=k(oWMA^e&V#&Y5dFDc>oUn+OU0guB~h3};G1;X=v+ zs_8IR_~Y}&zD^=|P;U_xMA{Ekj+lHN@_n-4)_cHNj0gY4(Lx1*NJ^z9vO>+2_lm4N zo5^}vL2G%7EiPINrH-qX77{y2c*#;|bSa~fRN2)v=)>U@;YF}9H0XR@(+=C+kT5_1 zy?ZhA&_&mTY7O~ad|LX+%+F{GTgE0K8OKaC2@NlC1{j4Co8;2vcUbGpA}+hBiDGCS zl~yxngtG}PI$M*JZYOi{Ta<*0f{3dzV0R}yIV7V>M$aX=TNPo|kS;!!LP3-kbKWj` zR;R%bSf%+AA#LMkG$-o88&k4bF-uIO1_OrXb%uFp((Pkvl@nVyI&^-r5p}XQh`9wL zKWA0SMJ9X|rBICxLwhS6gCTVUGjH&)@nofEcSJ-t4LTj&#NETb#Z;1xu(_?NV@3WH z;c(@t$2zlY@$o5Gy1&pvja&AM`YXr3aFK|wc+u?%JGHLRM$J2vKN~}5@!jdKBlA>;10A(*-o2>n_hIQ7&>E>TKcQoWhx7um zx+JKx)mAsP3Kg{Prb(Z7b};vw&>Tl_WN)E^Ew#Ro{-Otsclp%Ud%bb`8?%r>kLpjh z@2<($JO9+%V+To>{K?m76vT>8qAxhypYw;Yl^JH@v9^QeU01$3lyvRt^C#(Kr#1&2 ziOa@LG9p6O=jO6YCVm-d1OB+_c858dtHm>!h6DUQ zj?dKJvwa2OUJ@qv4!>l1I?bS$Rj zdUU&mofGqgLqZ2jGREYM>;ubg@~XE>T~B)9tM*t-GmFJLO%^tMWh-iWD9tiYqN>eZ zuCTF%GahsUr#3r3I5D*SaA75=3lfE!SpchB~1Xk>a7Ik!R%vTAqhO z#H?Q}PPN8~@>ZQ^rAm^I=*z>a(M4Hxj+BKrRjJcRr42J@DkVoLhUeVWjEI~+)UCRs zja$08$Ff@s9!r47##j1A5^B6br{<%L5uW&8t%_te(t@c|4Fane;UzM{jKhXfC zQa|k^)d*t}!<)K)(nnDxQh+Q?e@YftzoGIIG?V?~$cDY_;kPF>N}C9u7YcZzjzc7t zx3Xi|M5m@PioC>dCO$ia&r=5ZLdGE8PXlgab`D}>z`dy(+;Q%tz^^s*@5D)gll+QL z6@O3@K6&zrhitg~{t*EQ>-YN zy&k{89XF*^mdeRJp{#;EAFi_U<7}|>dl^*QFg**9wzlA#N9!`Qnc68+XRbO-Za=t zy@wz`mi0MmgE?4b>L$q&!%B!6MC7JjyG#Qvwj{d8)bdF`hA`LWSv+lBIs(3~hKSQ^0Se!@QOt;z5`!;Wjy1l8w=(|6%GPeK)b)2&Ula zoJ#7UYiJf>EDwi%YFd4u5wo;2_gb`)QdsyTm-zIX954I&vLMw&_@qLHd?I~=2X}%1 zcd?XuDYM)(2^~9!3z)1@hrW`%-TcpKB1^;IEbz=d0hv4+jtH;wX~%=2q7YW^C67Fk zyxhyP=Au*oC7n_O>l)aQgISa=B$Be8x3eCv5vzC%fSCn|h2H#0`+P1D*PPuPJ!7Hs z{6WlvyS?!zF-KfiP31)E&xYs<)C03BT)N6YQYR*Be?;bPp>h?%RAeQ7@N?;|sEoQ% z4FbO`m}Ae_S79!jErpzDJ)d`-!A8BZ+ASx>I%lITl;$st<;keU6oXJgVi?CJUCotEY>)blbj&;Qh zN*IKSe7UpxWPOCl1!d0I*VjT?k6n3opl8el=lonT&1Xt8T{(7rpV(?%jE~nEAx_mK z2x=-+Sl-h<%IAsBz1ciQ_jr9+nX57O=bO_%VtCzheWyA}*Sw!kN-S9_+tM}G?KEqqx1H036ELVw3Ja0!*Kr-Qo>)t*?aj2$x;CajQ@t`vbVbNp1Oczu@ zIKB+{5l$S;n(ny4#$RSd#g$@+V+qpAU&pBORg2o@QMHYLxS;zGOPnTA`lURgS{%VA zujqnT8gx7vw18%wg2)A>Kn|F{yCToqC2%)srDX&HV#^`^CyAG4XBxu7QNb(Ngc)kN zPoAhkoqR;4KUlU%%|t2D8CYQ2tS2|N#4ya9zsd~cIR=9X1m~a zq1vs3Y@UjgzTk#$YOubL*)YvaAO`Tw+x8GwYPEqbiAH~JNB?Q@9k{nAuAbv)M=kKn zMgOOeEKdf8OTO|`sVCnx_UqR>pFDlXMXG*KdhoM9NRiwYgkFg7%1%0B2UWn_9{BBW zi(Ynp7L|1~Djhg=G&K=N`~Bgoz}Bu0TR6WsI&MC@&)~>7%@S4zHRZxEpO(sp7d)R- zTm)))1Z^NHOYIU?+b2HZL0u1k>{4VGqQJAQ(V6y6+O+>ftKzA`v~wyV{?_@hx>Wy# zE(L|zidSHTux00of7+wJ4YHnk%)G~x)Cq^7ADk{S-wSpBiR2u~n=gpqG~f=6Uc7^N zxd$7)6Cro%?=xyF>PL6z&$ik^I_QIRx<=gRAS8P$G0YnY@PvBt$7&%M`ao@XGWvuE zi5mkN_5kYHJCgC;f_Ho&!s%CF7`#|B`tbUp4>88a8m$kE_O+i@pmEOT*_r0PhCjRvYxN*d5+w5 z<+S)w+1pvfxU6u{0}0sknRj8t^$uf?FCLg<%7SQ-gR~Y6u|f!Abx5U{*KyZ8o(S{G znhQx#Zs_b8jEk`5jd9CUYo>05&e69Ys&-x_*|!PoX$msbdBEGgPSpIl93~>ndH;t5 z?g>S+H^$HtoWcj4>WYo*Gu;Y#8LcoaP!HO?SFS&F9TkZnX`WBhh2jea0Vy%vVx~36 z-!7X*!Tw{Zdsl3qOsK&lf!nnI(lud){Cp$j$@cKrIh@#?+cEyC*m$8tnZIbhG~Zb8 z95)0Fa=3ddJQjW)9W+G{80kq`gZT`XNM=8eTkr^fzdU%d5p>J}v#h&h$)O+oYYaiC z7~hr4Q0PtTg(Xne6E%E@0lhv-CW^o0@EI3>0ZbxAwd2Q zkaU2c{THdFUnut_q0l+0DpJ5KMWNTa^i@v%r`~}fxdmmVFzq6{%vbv?MJ+Q86h6qf zKiGz6Vrb>!7)}8~9}bEy^#HSP)Z^_vqKg2tAfO^GWSN3hV4YzUz)N3m`%I&UEux{a z>>tz9rJBg(&!@S9o5=M@E&|@v2N+w+??UBa3)CDVmgO9(CkCr+a1(#edYE( z7=AAYEV$R1hHyNrAbMnG^0>@S_nLgY&p9vv_XH7|y*X)!GnkY0Fc_(e)0~)Y5B0?S zO)wZqg+nr7PiYMe}!Rb@(l zV=3>ZI(0z_siWqdi(P_*0k&+_l5k``E8WC(s`@v6N3tCfOjJkZ3E2+js++(KEL|!7 z6JZg>9o=$0`A#$_E(Rn7Q78lD1>F}$MhL@|()$cYY`aSA3FK&;&tk3-Fn$m?|G11= z8+AqH86^TNcY64-<)aD>Edj$nbSh>V#yTIi)@m1b2n%j-NCQ51$9C^L6pt|!FCI>S z>LoMC0n<0)p?dWQRLwQC%6wI02x4wAos$QHQ-;4>dBqO9*-d+<429tbfq7d4!Bz~A zw@R_I;~C=vgM@4fK?a|@=Zkm=3H1<#sg`7IM7zB#6JKC*lUC)sA&P)nfwMko15q^^TlLnl5fY75&oPQ4IH{}dT3fc% z!h+Ty;cx9$M$}mW~k$k(($-MeP_DwDJ zXi|*ZdNa$(kiU?}x0*G^XK!i{P4vJzF|aR+T{)yA8LBH!cMjJGpt~YNM$%jK0HK@r z-Au8gN>$8)y;2q-NU&vH`htwS%|ypsMWjg@&jytzR(I|Tx_0(w74iE~aGx%A^s*&- zk#_zHpF8|67{l$Xc;OU^XI`QB5XTUxen~bSmAL6J;tvJSkCU0gM3d#(oWW$IfQXE{ zn3IEWgD|FFf_r2i$iY`bA~B0m zA9y069nq|>2M~U#o)a3V_J?v!I5Y|FZVrj|IbzwDCPTFEP<}#;MDK$4+z+?k5&t!TFS*)Iw)D3Ij}!|C2=Jft4F4=K74tMRar>_~W~mxphIne& zf8?4b?Aez>?UUN5sA$RU7H7n!cG5_tRB*;uY!|bNRwr&)wbrjfH#P{MU;qH>B0Lf_ zQL)-~p>v4Hz#@zh+}jWS`$15LyVn_6_U0`+_<*bI*WTCO+c&>4pO0TIhypN%y(kYy zbpG4O13DpqpSk|q=%UyN5QY2pTAgF@?ck2}gbs*@_?{L>=p77^(s)ltdP1s4hTvR# zbVEL-oMb~j$4?)op8XBJM1hEtuOdwkMwxzOf!Oc63_}v2ZyCOX3D-l+QxJ?adyrSiIJ$W&@WV>oH&K3-1w<073L3DpnPP)xVQVzJG{i)57QSd0e;Nk z4Nk0qcUDTVj@R-&%Z>&u6)a5x3E!|b;-$@ezGJ?J9L zJ#_Lt*u#&vpp2IxBL7fA$a~aJ*1&wKioHc#eC(TR9Q<>9ymdbA?RFnaPsa)iPg7Z; zid$y8`qji`WmJ5nDcKSVb}G$9yOPDUv?h1UiI_S=v%J8%S<83{;qMd0({c8>lc=7V zv$okC+*w{557!ohpAUMyBHhKLAwzs&D11ENhrvr_OtsnS!U{B+CmDH-C=+po+uSqt z+WVVXl8fKe5iCZoP;>}4OVen6_|uw8*ff-r;)O2W+6p7BPT7sT<|Qv=6lgV#3`Ch${(-Wy#6NA$YanDSFV_3aa=PAn%l@^l(XxVdh!TyFFE&->QRkk@GKyy( zC3N%PhyJf^y9iSI;o|)q9U-;Akk>;M>C8E6=3T!vc?1( zyKE(2vV5X_-HDSB2>a6LR9MvCfda}}+bZ>X z+S(fTl)S})HZM`YM`uzRw>!i~X71Kb^FnwAlOM;!g_+l~ri;+f44XrdZb4Lj% zLnTNWm+yi8c7CSidV%@Y+C$j{{Yom*(15277jE z9jJKoT4E%31A+HcljnWqvFsatET*zaYtpHAWtF|1s_}q8!<94D>pAzlt1KT6*zLQF z+QCva$ffV8NM}D4kPEFY+viR{G!wCcp_=a#|l?MwO^f4^EqV7OCWWFn3rmjW=&X+g|Pp(!m2b#9mg zf|*G(z#%g%U^ET)RCAU^ki|7_Do17Ada$cv$~( zHG#hw*H+aJSX`fwUs+fCgF0bc3Yz3eQqR@qIogSt10 znM-VrdE@vOy!0O4tT{+7Ds-+4yp}DT-60aRoqOe@?ZqeW1xR{Vf(S+~+JYGJ&R1-*anVaMt_zSKsob;XbReSb02#(OZ z#D3Aev@!944qL=76Ns-<0PJ;dXn&sw6vB9Wte1{(ah0OPDEDY9J!WVsm`axr_=>uc zQRIf|m;>km2Ivs`a<#Kq@8qn&IeDumS6!2y$8=YgK;QNDcTU}8B zepl6erp@*v{>?ixmx1RS_1rkQC<(hHfN%u_tsNcRo^O<2n71wFlb-^F2vLUoIfB|Hjxm#aY&*+um7eR@%00 zR;6vT(zb2ewr$(CwbHgKRf#X(?%wBgzk8qWw=d@1x>$40h?wIUG2;Jxys__b)vnPF z{VWvLyXGjG4LRo}MH@AP-GOti6rPu^F04vaIukReB|8<7&5cebX<)Zk(VysCOLBuL zW9pEvRa--4vwT?k6P??+#lGMUYE;EsaU~=i_|j!1qCVS_UjMVhKT%CuovR;6*~rP0)s5eX zxVhGZv+qtpZ{_FDf9p{m`ravh=h>mPMVR7J-U@%MaAOU2eY@`s-M3Oi>oRtT?Y&9o({nn~qU4FaEq|l^qnkXer)Cf0IZw;GaBt)}EIen=1lqeg zAHD~nbloktsjFh&*2iYVZ=l1yo%{RK#rgTg8a2WRS8>kl03$CS(p3}E-18`!UpyOg zcH=`UYwn0b@K1`E&aQ%*riO|F-hq;S;kE7UwYd~Ox(u)>VyaE7DA6h_V3_kW2vAR} zBZi_RC*l3!t;JPD;<*z1FiZt;=KK-xuZ`j>?c5oxC^E2R=d`f68!-X=Xw2ONC@;@V zu|Svg4StiAD$#wGarWU~exyzzchb#8=V6F<6*nAca@x}!zXN}k1t78xaOX1yloahl zC4{Ifib;g}#xqD)@Jej<+wsP+JlAn)&WO=qSu>9eKRnm6IOjwOiU=bzd;3R{^cl5* zc9kR~Gd9x`Q$_G^uwc4T9JQhvz3~XG+XpwCgz98Z>Pez=J{DD)((r(!ICFKrmR-;} zL^`7lPsSmZT?p&QpVY&Ps~!n($zaAM8X@%z!}!>;B|CbIl!Y={$prE7WS)cgB{?+| zFnW-KRB-9zM5!L+t{e~B$5lu-N8Yvbu<+|l;OcJH_P;}LdB~2?zAK67?L8YvX})BM zW1=g!&!aNylEkx#95zN~R=D=_+g^bvi(`m0Cxv2EiSJ>&ruObdT4&wfCLa2Vm*a{H z8w@~1h9cs&FqyLbv7}{R)aH=Bo80E3&u_CAxNMrTy_$&cgxR10Gj9c7F~{hm#j+lj z#){r0Qz?MaCV}f2TyRvb=Eh|GNa8M(rqpMPVxnYugYHqe!G`M@x(;>F%H46LGM_cU z{*0k6-F!7r3;j{KOaDxrV16WUIiFAfcx?^t*}ca4B8!-d?R|$UxwV8tyHdKL zhx;7%0Zn#qtx;S)REtEP-meAlV8*1qGFbRJ*eeX&+hsiLF*g9%r0Zl`L^Kn`4I)ul z32#3pg6Mu$LEI@hssUb?T$di_z zHgaB3zw;*0Lnzo$a~T_cFT&y%rdb*kR`|6opI#Pbq~F%t%*KnyUNu|G?-I#~C=i#L zEfu}ckXK+#bWo11e+-E$oobK=nX!q;YZhp}LSm6&Qe-w0XCN{-KL}l?AOUNppM-)A zyTRT@xvO=k&Zj|3XKebEPKZrJDrta?GFKYrlpnSt zA8VzCoU+3vT$%E;kH)pzIV7ZD6MIRB#w`0dViS6g^&rI_mEQjP!m=f>u=Hd04PU^cb>f|JhZ19Vl zkx66rj+G-*9z{b6?PBfYnZ4m6(y*&kN`VB?SiqFiJ#@hegDUqAh4f!+AXW*NgLQGs z>XrzVFqg&m>FT^*5DAgmMCMuFkN4y*!rK^eevG!HFvs7nC672ACBBu5h(+#G@{0J- zPLsJ{ohQEr2N|PmEHw9 znQ`qe-xyv93I;Ym=WnoVU8dau&S^(*Wp=}PSGw;&DtaKz-);y)zjD|@-RT`*6nowj z7B%)h3>Lro-}5THC@BLymuL&3~kh8M}ZrZGtYKAmrT^cym$^O!$eeK$q5X2JF1w5a}4Z6yJ<=8&J?(m6U?;+ z{+*B;P@yGffMz;OSfm7NDhkGR5|7&~FNvel8Yj{F!DWnHG>%?ReZ$1w5I$Bt_u|4v z-ow>!SF!pCGrD&K8=-<;Gp@oB<@9C&%>vPHrp4sQEJj2FdedjC=0FqD>EG?NCf=KQKVd^stDZP7KNCAP-uEO*!?vgwvdp&Dm3h5Cldn!cIOL@u>1!HSfK+~kn-9Ekr|MWNApAJCJ5&5#izmjm z$CI|Boo@;O?Z(Bo9ejP>bbH|jRKn7W3y0L1!O6v$RUtt;%5R#**`+39c$JuO`SMU+ zbzu$7Eu`JQ+ri_ap{w(R_juHcw0X8~e$48TzBX%Yd+HkSSYt2){)+rYm48G^^G#W* zFiC0%tJs0q3%fX_Mt8A=!ODeM?}KLDt@ot6_%aAdLgJ7jCqh_1O`#DT`IGhP2LIMhF* z=l?}r%Tl#)!CpcItYE2!^N8bo`z9X(%0NK9Dgg^cA|rsz?aR+dD6=;#tvNhT5W}1; zFG@_F2cO&7Pdp1;lJ8?TYlI(VI8nbx_FIGRX^Z(d zyWyJi58uPgr>8w$ugIGhX1kr*po@^F>fntO1j&ocjyK za8Z*GGvQt+q~@R@Y=LdQt&v=8-&4WOU^_-YOuT9Fx-H7c;7%(nzWD(B%>dgQ^ zU6~0sR24(ANJ?U>HZ#m8%EmD1X{uL{igUzdbi+JN=G9t`kZMGk!iLCQQiVMhOP&(*~gU(d+&V4$(z=>4zqh(GX+9C&;~g2 z9K2$`gyTRJpG_)fYq=9sG^1I{*I=s%0NX^}8!mJVc?y$OYM^n!x(2jw$$;}n&dh%D;St+FA;eW=+28j#G^YLi@Gdk*H#r-#6u?7sF7#_pv?WS^K7feY1F^;!;$rgU%J zS$lZ(hmo$F>zg$V^`25cS|=QKO1Qj((VZ;&RB*9tS;OXa7 zy(n<$4O;q>q5{{H>n}1-PoFt;=5Ap+$K8LoiaJV7w8Gb%y5icLxGD~6=6hgYQv`ZI z2Opn57nS-1{bJUr(syi^;dv+XcX8?rQRLbhfk1py8M(gkz{TH#=lTd;K=dr!mwk2s z#XnC){9$x)tjD0cUQ90|hE2BkJ9+_tIVobRGD6OQ-uKJ#4fQy!4P;tSC6Az)q?c>E zXt(59YUKD?U}Ssn(3hs&fD$i3I*L_Et-%lx%HDe%#|)*q+ZM-v%Ds3u1LPpPKe-q} zc!9Rt)FvptekA2s+NXxF7I;sH1CNPpN@RT+-*|6h*ZWL{jgu9vth{q)u=E<7D(F06 zN~UUfzhsK)`=W%Z-vr#IIVwmdb(q7k+FX-lciYO%NE!xl25SV53Hwdql-3>8y5X1U zWa3_Qfp2Z;jVX+N+1?`(dx-EJL)%oQsI0G3S=ad&v{dzNal~flHvq(0HjY!v;oE>n z4gQSa2FdJI52Weu$+lED4VYSW;D`5Zn`C#@7Hxa1Ls*#TLBjje(%NYFF+4uOc~dK! zlnyxE4NWVz0c8yx`=sP2t)fHW(PPKZPp{SCwT-on2sEM9tyGO4AW7|R;Iw5|n1KpV zR^S>`h}rxcNv2u+7H6rCvMLMV3p*H#WcN}}t0@Us{w}{20i<-v> zyos+Ev_>@CA**@JrZ6Jzm=pWd6ys`c!7-@jf<~3;!|A_`221MFp-IPg28ABf6kj-Y#eaRcQ!t!|0SRtkQK^pz;YiTC@@lJ4MDpI(++=}nTC zRb4Ak&K16t*d-P(s5zPs+vbqk1u>e5Y&a!;cO(x;E4A4}_Cgp_VoIFwhA z-o^7)=BRYu)zLT8>-5os4@Ss8R&I^?#p?bY1H-c;$NNdXK%RNCJHh)2LhC?B9yL2y z(P-1t9f~NV0_bQ{4zF|-e^9LG9qqevchug76wtFn95+@{PtD)XESnR2u}QuG0jYoh z0df4#&dz_FStgOPG0?LVGW&{znCUzHU%*b1f~F+)7aefg7_j76Vb|2WuG#1oYH_~4 zrzy#g1WMQ#gof`)Ar((3)4m3mARX~3(Ij=>-BC zR@&7dF70|)q>tI$wIr?&;>+!pE`i6CkomA1zEb&JOkmg9!>#z-nB{%!&T@S-2@Q)9 z)ekri>9QUuaHM{bWu&pZ+3|z@e2YjVG^?8F$0qad4oO9UI|R~2)ujGKZiX)9P2;pk z-kPg%FQ23x*$PhgM_1uIBbuz3YC z#9Rz(hzqTU{b28?PeO)PZWzB~VXM5)*}eUt_|uff_A8M4v&@iY{kshk{7dHX1vgHs zC%vd9vD^c;%!7NNz=JX9Q{?$~G@6h!`N>72MR*!Q{xE7IV*?trmw>3qWCP*?>qb01 zqe|3!Y0nv7sp|Md9c z4J5EJA%TD-;emh%|L2kLpA^g>)i56v6HIU8h7M+KSWYw~HHz3`ILj*{==jD(l33>r zmOdINZ8^Jo?ll^~q@{^5l#*3f`ETncJmo?iRLz*=W=o3MJ!K^xjVcw*H}p63#p4XX z1)|C%{Y&)IpRIk5oMVsUi6oyKAFy8MH$@|Zpjr^lxlMX3O{0AZTjc{gso{KRuo30V zUJxq2K=_CwV*Qx_D!hJCBTuQ}5oMNrWUBNVaa8zyMg5lrXgv8Zw@rm5NAcFplYa>P zmUNB>EB|r?#Z!Gq^`(HZl__UJ*K5 z=>`{UTlt0;Y+LmP1Wb19IWK(SIWDrqh=+K81c`t@BCS|2#@K0u5eEwQ7CG92=Axx4 zQ?CPaVE5!XY`2r!Ce@m(tRtB=&+c>a09WzP-Ys!~i;V0hEq}PU8n1a;bVbJ17rYW1 zjz|KkLZoO7-S6oQp_ocIzS43P@CJJxQ$k;$!fS3*V)m|VtBIEgCtU@W`AG9VMU_d znB-Zs3I)I(Wg=xj)Wcx03h}U3i5{D@*udPLg?Jx7dp&KEIwJiW=eh}Ps#FxbsS?F}7z<;<5RP6-UAD+_An$s3y-JAC zh{JlAX3e^CDJl1gJDbH`e=hD88ER_6+Mw8CwK&^|$BnzA|AvDV`#xF^z9b6iWb)0@ z+gir=oSUaVcJi%1k+9!pd`(3|h~4}!NM7NHPNV6rI(W4~Ie5 zl@(Xg2`OSq|HJRUg3qgr-c!}9@W?pEJXKtxP7f(aE2Es33gRSu#~XiCIpV-J;JLM{(@qK2wEvsi@6-9(cyXX!6YS0n7;TK0Ldf*JGmlvrF0 zGQ+Z509rmWa)O}r`z2W3!6u{^ZQrY`KR#VlTRmllG2v$R!7%B~IU@XnNi!E1qM$J8 z%{XFU4vy_*M0tKjDY3E*7N!d%&vnx5qr#=!IKWZfoRo8j=7ji1{xW?g^)A|7 zaaA5Rg6rwCF?y33Kz-90z!ze`@5N916S)(fHPa>{F`UEF8N5PTNjbo)PF5W_YLB*# z?o`qxQTIzokhSdBa1QGmn9b;O#g}y_4d*j*j`cx^bk(=%QwiFxlAhFSNhO0$g|ue> zDh=p|hUow5Knbclx8V;+^H6N_GHwOi!S>Qxv&}FeG-?F7bbOWud`NCE6Tv-~ud&PS6 z;F*l>WT4zvv39&RTmCZQLE67$bwxRykz(UkGzx}(C23?iLR}S-43{WT80c$J*Q`XT zVy-3mu&#j}wp^p0G%NAiIVP2_PN{*!R%t7*IJBVvWVD#wxNRyF9aXsIAl)YpxfQr$d%Rt20U@UE}@w?|8^FMT%k36 zcGi_Mw+vMvA@#}0SfIiy0KEKwQ|`iR++|PF2;LtiH7ea($I{z z32QPp-FlEQ**K_A@OC943z`Qy7wC~&v z*a`z;(`5(e#M|qb4bkN6sWR_|(7W~8<)GnX)cJAt``gu8gqP(AheO-SjJMYlQsGs0 z!;RBZwy>bfw)!(Abmna(pwAh^-;&+#$vChUEXs5QOQi8TZfgQHK$tspm+rc%ee0gy zjTq5y20IJ`i{ogd8l?~8Sbt^R_6Fx*!n6~Jl#rIt@w@qu2eHeyEKhrzqLtEPdFrzy z9*I^6dIZ z)8Gdw1V^@xGue9trS?=(#e5(O#tCJv9fRvP=`a{mnOTboq<-W$-ES7)!Xhi*#}R#6 zS&7hR(QeUetr=$Pt6uV%N&}tC;(iKI>U!y$j6RW&%@8W|29wXe@~{QlQ0OjzS;_>q z(B!=A71r|@CmR7eWdu9n0;OJ zP@VOOo#T+N$s{`3m`3Li+HA4owg&>YqCwsA5|E$b;J&v#6RbT$D!x$Yaflo92wU?A zvgD8g(aY`g7}Y2^2i31ocm&k9Km`NQipEsjU>MuRzD35*Jk7^Q(O;M32!gt1cEB@- zBOHd@@Qo{fQ^7o{FiNdS)_vTiP8toqZ`iNi^1-4(hp+s751}Tf34b z_UYQ1q0~*jIp9pRIpI8ue}$|~uu0#p>-y8t{yEwB(8yAjMXrJ{`{rp7*-wlh8&bso zHV`LnAF7Bw+w}Wm9ii3U@lEvcc-i$0&h+eUmlQuREzg!ao)ZjwThhqIKA})}akyX7 zcbuIw9K}9aUZ;hvAxk~rqpk?bYMWr-@b-pMTR8))ggQa$kBv=IinobKCR0?S&g*+Al2J`VR7he{}0Pu zae7LYa!OoTOk8?ma)M@Ta%NxQacV~KMw&)}fkmF7wvmagnTbWo))`Kofr)`-pNe99 zMnam7vRRs5LTXHWNqTzhfQo90dTdg<=@9teXaX2tyziuRI?UOxKZ5fmd%yNGf%Kis zEDdSxjSP&;Y#smYU$Dk>Sr0J42D)@hAo|7QaAGz(Qp*{d%{I-#UsBYP2*yY8d0&$4 zI^(l62Q-y4>!>S{ zn;iO%>={D42;(0h@P{>EZnIzpFV|^F%-OJADQz(1GpUqqg#t!*i zcK}eD_qV$RmK}-y_}f$Xy7B+hY~f4s{iCD7zq%C|SepGu`+>h6TI}dUGS3%oOYsZ0 z#rWTU&aeMhM%=(r(8kK@3rr|wW^MFE;dK5&^Z!>`JV{CWi^Gq?3jz~C-5hFFwLJ@e zSm3z9mnI+vIcF+RjyOL!VuZP3rJDjPSm4vYolnm)H;BIz!?dLyE0^5(pm)5*>2clW zaI^*Z;p6iGZW~Gr0(Eh+%8Jkz{S9{}=}Ewi6W0wF3|BbVb?CR2x>4xST?woP;Mz8L zDfs+0L9ga3jcM)zCC=`-ah9#oulxt9bZq9zH*fJK$bhT=%(2bPMY~}cPfTyE{_4p+ zc}3pPX`B04z+T>XwRQ4$(`U~037JrmN`)3F8vu_OcBE}M&B;1Vd%|I|1tni?f_b&$ z5wpdJ6F*oif)r=IzB$ytT72GuZi$y>H0p_#amQcJLZ^4KZySOUrRyXy3A2(i=$zB9 znZnGFLC34k?N@s@`)u8aZN({9Hfe}|^@Xk(TmCqNBR*Bter>opM!SGiDU8ShK6FNp zvod~z>Tj!GOXB^#R>6}_D@j67f5cNc#P;yMV}`S*A_OmXk_BIq3I$C}3M~aPU)agY zWC+0JA-)}O@e4XTtjzen&g=J0GIVNjG`_gS6ErXj3cGxeDN*4xEk0PNzfzO@6gb&N zB$S-WV-@efQWs%UX$AVjFN5M@8U>+?Mcqg?@=Z-R`~n~;mQGVJT_vBL|3^fHxZ?#T zE(Sd`8%2WHG)TcNaCHmv_Id%D+K}H3s&c`bxKs(_ScZzyCTpvU zHv~yhtKF9G{s+GC*7>_D@F+qEq@YmXiKTV(j#X7^?WpvIg!Yxi6uBAhh7<91{8vFL zfT?Y~vwmE;(WOL!V5Ag&#@U$mP~T=*#_ ze#QynX>tO#4IJqSj^UB>8ubSEn>Nk!Z?jZE01CJCYuY`1S3 zf%2eyXaWoAQUw)KYO;wi<&+R3_7E%h(7F?xq!8l>!^3Jqj_tNPrG= z+y2S-0j;(AilOo;>SCQu#;Cn?y4Eu za`??!yHz)qFH1Z(3KMqgn+B$&t+5s0zY|}<1kB^Q8FEAumh;^;Yr~amTx1K2%2JUk z@7uIE&0DVch|1R=ro5rjr)w!iU{_09PqfhnGqhAN^$^oz#wVNdTRQ!8^nF};4);Jz#=dTBTMMW7icnZ$dK1E0UEgP4&DNk9MFoKOhtAkVUR`d_vc!x zc|1mY&%{PBxepp^JPHmFDBQ8t@DD-3!C)-ZhGJt)?{)^0MvC%RzI;4}>XoOUF;6~j z{S20Ra%PaiGvM$pFbH;N6)b1J(N;{+Gp^^Qk34JAuPKH}Ap}fen!WlC5vrQ0$pnyq z5poi8VG>>PnGw2^-CY3XdG3<;|0xU}#WBPqn{mO=z0RwL=MXn3=;oA(1C@V^6F;ogwB4EBUpltu=)(MC@To2kSPbL zDdGz|C<@`&!MmQ*e>H>2Qkwa~K%;yZw;SnM<=qwNHu-Dh$r(}-d}T}u!=UOAkzvEOiZ6>{)t$$# zlAmjO$1)&1Zh^zdh8uhmZ>OBA1T4%s9Jex_y4|ifY_=XoX6UzpP;MuC5su(6%;)NI z4d#4aW<*)L6o7w?MY2+jRx6-3S4i zC(~)A`|)5(s?)pBvTfYjwvr@Z-Dx-F7uq}z#WJB6&}0TIi6sGXFWOxD!As%cUg)_A zI)sRCf-5kPBU|rVm0A{!s=W2){AJwvShr6Tsvbg|NrXi!7zoMde_n>-+XFX0fiQy~ zjRp|;6~pR()0a>ETtC7mZD|i$Emj!r-gq!yhAFdV1uR*M<4O?t83N1JRT~8Cy8Vha z+STlcw&CoCJt$k^#ar+~DBmvtC5tr{(>|W6wHq*NSE!^#8*rs>!oYj%fl9~Nu*d4t zdk!|mGJehKW8xJE5ZOcHRfp4plI+l1Pct;rK={=P`YH8&1hNW*YE)4yF2@wa7JFaL zLHJH6ZWc1j|nQ55Znh#>tV`!~N7lY_05Cq%|8I-yN}yf@EzDG zBL z(b0sjh+ui^*s(rg)=l8fU<%cPfba<7y?>}j3R83$2KHzWbVF*`!x^V8JY`D0itC?ZSTYH|w3lUD#$5G$@!v(Lphex2O1;%>w;Qh$t7YF3EjFuySPC$>~%EspW}@Ctn1Bghd5*HVJ=tZK~8oMiZ@9IxfFLSk~>p9cT9gOSPLyP!^bOah`U-6{}C_ zmyhS7S_-tYDm|9C6(Wu2Qe=*g5@{**z@#Ekz3Y{o7fw!^4z$yi z&=a^zmtOpsRO0lFr&c=khr)cL2v9LFKXRDdE}tWlOgpR%}oWHCeJ4;(9U_HeJYl! zwz$p|t6?#eCju@0{IF0gbk>So3C{Ror~JTpuOW!G@^?lBVrf zf?%rDK2E3x=xGC)J_lEk{(ESh-Uw*#k-n4l42f3oC3BJX0-2NMZo?P)-6y1v+?|+< zfFHX8(bw;H@;6K!?=!B#eZrkowcdn7)roPT=WM@MK?>T-cUa$oQdYp&3YRdWu~rhA z@rZKmqj8Ftz-*@`&iH|) zC(H;QiqYx4{Mz@rm`qs~*Ue~4EHM^J7i{QnL~t)O)tnwIQC;23p}TBoc=9rcuS!cQ zQgl)_F@t9{c)ESLtAcg1AbCXqVS%i1ZZRiy$*?Bu=r2ad13e|ZeWV=3pSL>YAk>X& zQZAY4kJD`CYrK-nNti&;uJ*e{cRILOFk@z?B@fNO(exjUhf!b=yuC`@(RS#ko1HA+ zOwsym7?F)}ufcD5&IV+qr+i7Mo3)6M2oI)*3?@-%ah^0rL#0PIn}XmOTP9Xsg5C;t zqkFe6yT##_ZG5KuhVQY)89LfWOeXpXVNWX2PmiRqq<$C!<^WlyO~Q=pk${$DsWY-7 zZ->4<+c@KPgKzKosGPF+&Q*>L>WaN6_FC~SP~3gH7bvg6>QgPzp`&QTpf3W>HjxDxj!y zZb`O;&XZzI2YJ4!^Mq5~Vz7lLv`StN|TSP@jdF}@9;ql?u*#Q+_E}~hak(3B%AQNq)t7PKgAWTYp>EJz^VIj67KcZ3^vvZ7{b;; zcOOArcAw2$T+$UwIib|pt3i#NAuP#3?Z@Oaz?Mt(H&u7HZu!03kV7`t5IRcf7hwck zf{Ujp*YsH;dvcW0q|=o$;z#Cg52;n5t1phY44To!sQ99h`iVzXd+v(L%?A$Ks|Ne; z7fby7IVUXqN8gzsnL-s?uIv>=Qh!qAxoe{fRaI&EcSGCTdggq-Qq?DU%SBOummO5cRa9NW}V>A0IH#pxch)!$2p8=^-XYjsB%$S$U5nI zlJEMBb!BZ_O4@87cEYUBH7}Y_MF$+(~gdf-!7)D-D)+O{*18TC{HGZFF+`%IPcmK{O{YxR> zSfJHSeQCChuPUAWe_x~gy*f!!wvt_tL-Dp=nUm+juu;4L6N1IIG4dsVMat#T^p7p1n*Tx2a!YaivBTqLsSJAF=kJej?@QWf)Y-8Ks>WkC456{B#hW-ML zI+f23(}F=MeSdbWQ>R98TOzv#Haw}ua+17H=P5|~#BDmoEPkzl#lBTvCoyj`XU|IS zHn?dXbq>rqUW8^kQN01zL~6!Vxn4!$Pu|F&#XbiF{{>T z)&khW&2Y?d8^jC|phWKQ4!CM9b66+l*HTdPm+)M|e5yT)I32Q~2ENVJ*ZH;JF^Y907{XNHLoQ+85J~!w@3h_5d04o=~|1 zCBAvjnXMn`S#qMkPZE}9#RX`%al{`J=oFKk(aJYT&Ss`4iBrXa_pQ=3lS1IUFA|Rr zgnh;c8nkGH)|*yyoUZ?tE1XKwkF$n6`sdkf^7)(wZ52xtm86N>o&&jG_@#ue(B`xPM|8oGz94>*kl17-|d^y0`D=&hScq6gGQ%Z6|LU zG@<~h-R{xW)y7k1x7XFw!TWW~HPC^bCO_;xG#A4he?=xkLjS=~U!uR+q>vqJxCN~J z+I}|P5RTv*qRT{k2N^Kz8OX*mz$hYR!aYq-f5bN4R4=omUVP19L|)EZq?O0#B9 z<3G&oAZ`UeIqZWlujz8UNNSK#{=_c`*(&TwlIr3ZpC0sfS5Jy?;t+&wb1g4Q91rRNiEt1|L zisgH;)V()S&(TSB|1yAxZLH%BY`nnhUw_6sz~zdKCCc!ZV*Ws6`U4u|CBpv4pYIX1 z5*)5C*N#D}gj<@pdZxtw!`5aFVQ^Jj?1W z+EsBx6>WV`%wnP@Fp{XlqFkbHf%LfCgIi_|w?uPPjHAgOF+lDnAb+WEB+i_53PFmu zj!=umx@ez9mVxC&jA_RtKRfQG>Cz`A77S2SpOt7%Rt*}fG|yO+2t7CMuK$^}D#i}k zZmO9yUwK6%!LbRsULVnxUxfxso5KFES=!WCm>y&YSR@0CS|iON0v59pkQ7dVA{j*+ zmcRtD@lxXuFq@#$DKKSal#ApSJLw58m_NIJ?z;eD3Z8u*-#}EaK zyG~L>-7laE`Y}{g#FPs9YA-wT4>X>xRNtTHp8_rhvWA|eJH(!o-G~C&tvHB9$UEJI{ngD>QjBz=wl~x-j1MB z4)L_#jZSvaQkbmVbN)4{#^r&ZmfhhV%?tet3`xJ;#jI}DsS94qc&s)#2kXv5pkt;K zaY6emqzF1JWMxI(7h}mk*MQ5C8WLAol60!DPj|u0jMrLTkU7G?ud**S@bYx-vp$+r zMVXWc4H}2=yF+YML9!k~LT(|<#By?F2bS~weMi9dD@DA&k#0e&MM1YT!qoQDeNLwB zA;{KvwSzP?-K(>@_b@4vTkIX7xwj}ckrusCw!k=#;Krt6;}3q4d*)?c{>I|C2I^4p zR(o48TqHbw?4Z`c`>?P{`cT;FpJoFW1wJ3IVO#5Q`wsB>o>zsRDDATmct`aaYQbTL zJVlHeok9_?w83#Z*J(_BMs-;N;mNeq{;f3S zSy{i5hNY5s`c#)~KhQZ{0_hNmrMD2b7CLC2+x#EmLcNa8V1Q=jz@e~VV)Yq!Z|$nv$TEG3j6K4opW+mH z3~z?*H$qobb652kQ}ZHFHUVj$%JAwS-Ie=Vh&Iivx3hjMCZ1k)4dRjdhxRb17P;Gz zZCsB4J=l1S8`O|(g!8c$aOMaYeUoCJj&n#kbDxe(^GQ)E)$Rq+i-wbPKeaQvL!`Y- zcL=QOLcWBdDq_`HLow9P5BG2EMY$v;w9cR$C{ zMv)5zrmYv!uzHFAxDI>aftAp&ad>GYoPt!d;A*$s)^6E5l5ct#&O7A0p^8J1ceXa) znIq{NgKbbOSC`6E_af2bCoI(gD@(krDr^mDVw>cRz3zJ^&9kbuf6)J@Cd#zbnko5m zdyD^j^!9J7`oH!u{~wlOl7jYM(OcdI^#*5Y>BjUumq_g&tx<#_pkzQL3{!g?50d=#eCov*uIw$N*glXJe1F{FuUF_wCElS)Z2X= z8&w0?WkCX%HfL)#n-m1tiLy!jDMqH$LikJF=#lu@k5%&vN zOEmQQ^n*t^76E;JhHPzQqbY0+m8GQ9;~dJLLZ@*sqVX0ui5yz%8Hyn87vqUisY_0- zDtUu5haWdOvDBOX9Y;=s;7ul^_xLxfU(?k(HStRfk0Ab!pY(scal?Nz{Qu?etFHNA ztD=60Y>dte)hUle1IUyYIFgMxgGpvx%Odv4q;WPV?Zj<0pph+zWMfSd=SIUcB_#7^ zgNlm4(v!WIBm4?kpvZnCvp?TXW7~Azs3LT8Gh<0Ew=&W*e+4X_xQ{(e+UCESTaWwz zd1ly>%|#A|W%fgeL_3gAwxjeb?Wi3rAR3U#9Rie*)dfz7YxUK;ex+a4F>@qyQAL0^ zZncndzG56R$F&?R4SOX>&%UDdBid6 zIn=GRfcto+s-%gMB)Wx7!_Z+SS)f3IG!&s%P2eNfHI6~E*=>e`^RpvJQY?T95IOKL zeX-_BCdRE#f06_QAoDyMH;#IIBnT#PWSOtks+PCo`04X-brsea32I~@X(Bwl*Q`$c z{Al@04k=Mmd0}}ts=u%dCO;qn-;qh>Hr7bB6!NOVxy@Yi#GK2vusj7iU9757HTqN~ zNMoKeZY}o)nA*{CqTTPKnWi*JgZFZj&EjD$V;O9zqHV#tB#r5Ur$V3To8iP-bO*Gl_d%qc2$SoU`Hu-6*hWbuWzAn(83_jZ%>P{PY3XVV!q$~ALE^GC( zdIGgR(HnV8Rn*P^7b8#AzONo*U_W}{Ne!=#*qNJIRZzapu_fOkvki(|8NDg>&D=OZ zL3G)1WS*8CFh`-sb*#8*hIN7WDjw6<$D&T|B>JPi`K!*5DF(O*^A+r*Jfnt))c8|M zQKtgEytAqpy@~XZGnVYMJmZSG0U~uvP?i*?DhgDOSYtx6s%6u*vL$SW87`&xJ9cmDLrPHI@G7Pb*cizPGf|!5th41a2ijel>Xfk3i?7Bd*{|)@>|ZBi zH6gO9a2Yd&_ZeKmNQC^e&S$cl!3D2oBCX)C;Ve{0qc|4+*fwK!x{=QYtb#3QD1|Yi z%r?t<$-Mjbli1fF(C?V&w#;Gq3-**PgsGPPsXN(0fb?pIDc{s6b<9{t%6D*47A9ZHlc4rEGU<}u;tiom3^lA-&)1i=j z|I#)cctK)AH-b2*a3Wm%Gt*;#GWjNF6q0q^Evid`6G2yhMg_4TaMUK&x*D*5+KtlF#!)86A7pn~&yvD-Rh%`@(o!Wc#9t=t;(9_y*(MWS;4cPU&cJcE+h} z6fZHrjH@7{6~n40#qgL(yA-oVrt;Kcu=fV1WQ0QY`_I8lVds$PYR7KDvhsTbkC8q6 zct`{-n;z2!($SBZ?;(ZMu1sY(VY)KJ@%p)!LEBL+M{ck-$kHEx=3N+%$#msc!LKD> z?(7`Owu6Iuf-Nb|5wFxCm}U)Du@JO|nHV?%8lk(y3x-=F_d}u8>#AU~iWtSD6|VuV&YM=#_v-HDjZ4mS|L2%K2K}Mhz zVb)f#Q>%4Du>|ea6cbNYrpi<6A!rSmbeh7+xGZ{-TPG);DG9qg=>9!44ScDdh49-_ z;|KUp*RQ-So$jyV%Ss5FnJa^|LYAl%8niBhd%(W!x$Rpq@pcp6(XF^fHFRF2KQP>$ zo@`Qi&QlkFxp%0@2)7RlN4+NzCWo{?_x}5$E?kh!!UM3Vg9R+=xPLWty|S}5Gt_qg z+-v~8k*0?Bf0^Q+IZS56Ny~Q$pap&c2NUt&f7P9P+zEz*>bOO!5J8(uhIJ#%lgMNl z3;y^@Yht z_Dko1D=J@nc@`zIXz6dWsr`Kdt!m8`gGlx59A(t5ZjDVmrsjl#0wT@It~$j=uGRM! z@XJK@Q})NA_sQpEZkNduP-h{cP|l+Qqwr{g--LeHY2&||4dJFD34ZCj7@+4ZH4}La zjfr1gHXr8j#ppOa+gkiuHYf$a+VGA${f!~LtdO!~|X+>{b zY8=`^(0d9`z1f!nNzD`;4&65cNlg)@h5m5oOj&gG%mslXlc+jou#n#`d_l6}hwB+CG5k*Sr36Yrz zP2B)Pq#G?*Iwb)FJiXU@lTvTrdR&WRpV8sUz(Sx3C%f;BHSLY@I$!TqSg!%IetroG zD$gu&K<>-imH@Bh&}f!zwO-`w8Dt>MMZ>8V@{X1g?!2BS0S;GtXTW(%@{L=6uC*fB znj>TvA9Cj80~Hn`A5GSVpyqA$*6rlEa`u=Z!{-DRtCo0{jnK|3KxpDEi3&^DwWNg4 z%|~wf=EtEq^ku$fbX{@*EYr&TP@j@?OyLdVKVk*&H23K=xzmgV8p0Y|jK+@cNaPE1 zovLSR73MssgV04G7S-h7L}ID!!8|-X7U6-7?t~caWg)yk6*s=m)9us~kZ7pC6I1+@ zd&wXWPx{8Z>47wN=yJJ;BgQ&`z)H7hxm}Jq_9GiAq)9R- z7(@1=H+oqdJ(YFEq(LiJW=s}h(Yx~}5%_cQ&3xV0VUT%{sXE!% zVMqItDE@pLL%E2I2<48s8InBVbnt|shpL|$wrvbdWe!LJMr$c+e86OWy77OJ6k_2&3KMqL9=QFd2QUVwwR8X*sgj}5OpiFWK zkiv)DX__mAlH9kRszqfgqLLvBrDbP&mL;Amd=_UXSF4&!?$+*0ZswW?9oH!-BQgjS z*IQf1yzUikvx`UPXLZi2UvHaGMOee-cPA0C5fni_Q zcj2Hhbit;RZ5t^!?2;o_*D4W$VcsfIc+m?Z?b!Uv2;-s&XYSCUiczc2-b0I0g-hNj z@xi1}g6j<*=Dr7UMa-%w&YN`cBbWT>BQ~p;QyS!^#eQ>q9dy!?Nrh+?bfo*_kEe;nyR%9=3OTAD90?RT8#Bk}X#Pkr(TqBF2&!V=` z^iWLr%Yk96POnG@bEb?cv#Uk)5}bP0=~;%g>Sm{t#hoNp#yeFj7UxuD?en)EXw2%= zTS`>YY)#O023TqIXj@8o2KAM29NQM4QH=;sYP$pcqtRoxg?ZK@CWy{=P7(uI7%TOp; zP-^!0wmMVv-f2E>6tEj7ZTG#-KaZMuUUgl1|nl&p%3Dc8tZ4 zW{0iAY38oin5YwiQlKRrH8RP-h95fX$>v!l2*6R~)3vTQ7V(gjstAxGVc>U<8Jwb) zPTqZIfoIV>X`vA2EuAW0Ghj||3;hwn0w`nHnL~5Xr-xuSDNmuyhoZWBBa|hf3)-7$ z6nhe93c?Vv(WT4=mKowy$9Fu8Y)h5yEW6z&zzB7;Yf(a|ei#jb>!ayFWo?MkgWxQK z47{-ws_k4#8xv#$x229MEUK#x*X1k=2QLLnaWhYREFj!ta9&)3I+w+wuB-hQ0SFLZ zlvuP9c*O0k+Bm_8bPyfY2o>Ts&0yRSIg4c@Rv71IVHGS{L3?%!54(HvY;tru5FCHC z9_ER%i7@?-Tq&gCLBVg_3g3?9Gu6P$T^70*)YqUQTN$IHtc4g5UG7WN_J&c!4-lZ& z0a=#~p%2D>Wvx?z(9bP0Z<&FgpEnI^CYsg{+)}t}Teb>kj&)7NNmPz4Zv@MJA2cA4 zE{uQ3IbdMxWrxK|%90Rdmx)yBJ3FI$YLuF4DF~35POQtBilKK{44PuvYIHjt?~mW& zzNwc$LazTnX6dO-hE|>Wu0KO)5xDdvCq>WTfkeI85j!LDvSNHy0&TTnCpr_Y@_=eYt;}dhqY5=4^QRl&pzt9Bed!EmviR=h>B6ynC7MGc`x^9c*)$$|imA)E z9KmcfaDlPY6j0i|;UW8=8oO5$aRyZaYTM*qBd?3;u=u(KdjqYJ_fLd`tRoym(-gX) zqoT2Ua$jR%Ibg0>jte$VWiyOhLaYcnGe^pQ(V0O%I}YnENL$+J%d>ulP(v~JZtnH_wYk$}A_OsQn5BbzOkG2(!baa2N({4d%BrLdzn_qpUhmGmod2kf3s)xrh|=VU=smdZ ze#hs3hAI5A(;4e45x>FbZjXU=hACbM{;p^HFvP31DFz6_lHCVuZC63Xv9`wzN@Y6rcuoPF<~3V<@&m2~m3D5&4GW7GA+XXs{sPo!wDK z85d-&4Og)(j6Q8x3f?Ooxm7VJf?Nw>3_s3fV9y_1xSDfCy31yBhkr2LI_&)xUpcLxXfuNl6z9z^w)MF}E8U)#3YWS4&8 z{-CVR?>0{F?ccm>oP#mMTY-&w90y~vwccFmV3Wd60@~aufc|xzwLI_AA^-goYhcMf z>+D@$bjnFLRX|X?6oMyaW_}(z!Ys&@5~HmlWUY|}!wJnBP8YPsWvf1%(iPjQZ2#s7 zd=-ANqy%pCwL5&H8Tzs{Ux(<1et1ny> z?C%$W*FgAI%!nl0a{QuH&7L*cr$DOVP-67{8fQkKPfPD$L+Lv zSnj#tSMG<%-tcmKzH8dSPFO)VC^+Dw0|si;bY^#=`Ilum3dEF5!JrA9J z^7-aQuXu7vwaQBlnT>)~G|scmodeOzMFBpiJ_`6WePZh+=vMX276uFz4Vd%}>sndc z95j(>Uq_*mC-r*$6iUb)5mCYRy8>n-Y?K==}9iFFRN zB_u(i5p)JpS@Is*ArpnM&nOOwsI6t6IAmTNaVm+)*gWI?2fN{+=&1n$oGYcUGS!0y znn-1azfTgI zyHQk7RQGW=l@WF&jO?B1KXJa9;4BdKcfcpq35}=O+x=GE;TGw}Ub3M+AbPW8_LG;zZ%{IenPEAQ0yCE`_ z5medk+}GQkcA+x*kGZgwAC&01r6-zspCxwld`4~iEZGot%8<4p%sS7d>FR_YB` z1Ifjyuvj`fc|U|FGJ>_SBP*e_IMD*V%9fftjgs&{b6*4#VT3Vun6n`CvL$#d*2ygL z)7eoDSMZ1NGifW#;&EW?%%%0BG5R6&cx8T(iz?c$ah{_eCRo%Dp%dN0c9w$xeo))f z!{R2?4ug`a98BH;1&H}cNC!iP7dTNKFKcpxcOl6#wP-SCOy% z!JYwOsHXEGr4S3cKrNjJ=%MF4T z@!bVaWe=0&6`nIQ;)FZc{l;u(ho}|4c%t0S8wEmM$g~?uCNTxxtk^R4o;IIHXg4Nb zZhIyY?230y#03^WP!{XWxKemhpfBjbwIDOpx8d|`8Pt~dI`s(SzLBSax8yVhRmu9{ zw$*00x8`h$)GaBWP=7&dA{3Isa5b890UcZ}9{lKpxjTOUjiBd@0mQR5q$sBg0u@Iy zwll8RkI|Pv!)|-}!4Q;*3w)M>CtQ|YfuY*dE7B89}m%)-8C#3~yUl6@M z@$xCS^_0V!62E%u6hMI}Baijc^H8CqqH=??%n$8DrN(@_lxx_H?j+3I+s>0uS4W-> zq0;-tBt+ZUCJDUZPCC#K`72}xS)J822;Tq5LaYD!CkRo6su~3oN zg&ag$fC3ZxSR5uvsAWN7eFh2^)f87O^;9TTDscs|OpfUC5ghp1K49VjDrt>4fKO=L zLxxhlumLD^ZNtMYZExK9PV1gvZsMjXa&<%d^2M4I|F-IW|5xsB0rGy*D60s$dYsg6 zMdyH$$qnp@ADG-=TiGN!GTMc$NnfrNngX>@GClAFT;EKG&5U1Bb*)IV83-ppR>OmP z;mE%>wS^m>hiH7_YYVSpTmR5U_95QXcNL(22X&|AmEtABFNSh^r+yF3YBOQc4!O80 zW_5fFeqSWTBALo%V#({BIC-%Lq^vp1z-V;gLfX5Rua>+TgW*Re+49!T|9sLVQu&ivPtDwn<# zB=%%^7~>Vd1WyRru7m;?SybRpuTdTkp!CqN?qy2_^y(`WSe9uYa9qE|o zcGg`Ff;qg;-$@F&9QY~YAiHAU+kZCb9ucTo{Gb6k#xmH@V2*O=2$V9hv3N!FG!${7 zTp-rnDN>xcgi;~=_Mxb*sFFSwD6?;CdR1Cbi8F3{DehvaW-t1+1l`nx@J2Uuss#I} z7YEQopO?lmS-vrY<18fFZQj;RUYHV1%R8M@0Tkd>SU5a}8CH-r{t1(N7NT#$sq)^w zmVCLx`_@z>k8uq?b|oJ{kgpSC_o3O$%4V2RH#rTN1lnS2uTuJCihJod=< zbK*bD&;BL?vnWrN{SD(*)sBR6Em-F63?LK}2oSl&aN^HYHdZan2q(BF z)D7uS5-tMDl2IECM|7gx%2> zc};Ho`i;kR%Dy)GUpF~6W1Ki*Wd%6#FMi5xBe)PX;SaussO4z3-v?U!u2?q%8AwgJaANO0!?)r6)*$^idCj}7^=gi;C5G{41QB@Q*c8MR zn@7|~dhs0<3%J0Tf=dI8%-XKKYj#sRI^D}q0b6V;M(o(HwO9@8wBzAG+cAYdGz_#F+444xshfBlAac=NZ;*fOTY9TtZ05z^pR5AEUigsEZVK|3P%EN69l9T#rt ztMj^w%zcjN9ADJ>WP_UYuZX&jZR@ji&u>=*IXGQau?w2zE-No+$nTgu_GgZsa&$M# zZYvI)dh>Bd=#L)dh+N*aEL{^5`qD^U_KpbEKUE%6$K7WS@R1G!nIcLmnv5J+Ack3a z2%04+f%{()h=i%kj`tsqCkKKoh%KE`ZGs_5p$zYHg~mcPi@d*l{hE-c6mFY*IgBX* zL6~^BD26Gh26+p)EPJ2IL;Sue$6HLwX#VB^s1h4Q+Hww|5(zlpA&M+;`=Svm=S+;v zJkHERRBWx#%q|GpK%F+Rc$V1Q(oO+`kKp_?Haa3}B9gaq1r)nI#4!25hPe^VDlLJ6 z5!=XtON&dC5`5o5js^}ccFq*%Q{E2ZcqcfHG;3~hzIV1Smr2JnUrzA}qvJS0pHByD zCj6^D|3`QKV-Mkn7l`7C+;{KiDa87OI_;q(s#HJaMS4T(P0Ely98^+ZR5*wy_!G56 z3+J?z-u?HtV2|%ah$ea4I0FGlLpsR$NLzoiQt?zYqY;)WuKzk zX&zj^7gwX#;?y|AsCmpgmqu;LL}sQV%xExYp;~&@;1uwbc*ZH@^yP4QVY8iniz)@m z`NT(X?G-$aA(h8Yb5{k|ODM1t4fD*k+EhMk&aPsfdgTiZ`crm;aE@iffH$0xl)xzk zP;cf1mo~EIT*L1pFr>c)6bMypnY#=C1chd$F z%xSI__^fdrclZD!Ywh;nrQKS)Gv4n`Ga?-lrHjRFhZVaU8$}1Fr&DC&0+5EHg+pD* z&pKO@6Taone5>3KFT+$B7Il<7`8grSj`|R;58(C6d48Z%;pV6 zj;G<~o22D(mZ@K0+17Z31aLV+Ib~<-!z5SSzQzTB0}{rh&2duz%ly zaG}^#dJ9k$#eoF^;`w!0|1(z1zu5!@L z@tL*vL%QefR>d1{NE>i|3C`dpl0@?KUi{TkiN6mGNRUDey67%i8-Y4@?C?4BK3S) zfr7HErec}l`_~GWBpfXk`;cTxqhQ@?lDsP1%O4g~b66sRNmD#`1VWS0+t5BO78E2& zICkZ`iPxc*m11BQxRt7dE1Ik0(P7<}s}!ezaiQ@+*Mlw==xGFmqi$4i>jy2&9mUsA z*j>?_P%uwoz{pMh_#KrelvNTR1Opo6mb0SRdK0M!Onk`Fp z=ys4!Z0vaFCTK~5b`EdIQS#2A*Qxqp3-@B7aA|=0WBE1wz(P~(nkuXl$tH%v&|#9R zeLm0olbua(?JgZv2G?R6yz3gVQMwP#Y?)mq-k6@gOK|{k8!R#T#dqf~3JgcyYV_!1 zp9v$!CMgIg^wGUhsG`m7QN0#1VZJ^W5m6TdZ-x>ULth(W{8-URkIild7h~&lW-x6# zkamVW=Fm$^>gUSsTS%jcc8$w;GJ85Mm6ERkFl=0h8YO#a*X7vZdhL(NZ^$yXf-l)ch{DbY`+M4q6{fN>WVq;uQz|Q)ZP2YT2wh+vZ+$wOqNyK`2r(RlH>uebaK2avbVcg z{@;W^5h;qUc)ExRI?u}9`&={vL4h#9%kfVg8oSDKpXrtx)=Dkv95RS`c6_Ya%CPQC zTS5MSS`B|Ys|SBOr^kwpi#7i^XAT5X7Z2tT*1m^K5{>uKVM+tlmjz}bI(8LGIh*ms zsMRF~)Z zhf64Z9SiFjJH1?Ww#3?_{~Ehqr&!d1@{PteLg{| z77qv)uM`QvK+3m{7!R~TPcnJ&7Vd@$JSpSW?&Q|)()t24_zF+GMe1DJe9u=JL((pz z4@A;xoiw;3?LGCEciG5$Z{N|`rA>OUUZZTmgJoTfSjMXtou~^{@2Gdt3#}aVPkp&$ z;<#mYqWv~IR4PWq6R@TK>G(xHnxscc2G>Kz zna3IzOUIMP6YyJPT55w=uM}j6{e%$j8MAVCg2K`y>GEQHGW+Q1C~P&o&OS8KcHC@N z=WVu!LBgQ8k675M3KmokUnj4A2`EwxIHITBFM{dT(;41?F>3Zo@~au76RvQJs*KoS z&L@-VLeWtdWPLNQgrr$_l(4LdjNv_DW?{dFzQj%)S2oXPWW_8#V2>5y%Hx-?Of->d(WT$~az&0U;asF!k=o??sn0dY zP~Sai?n7|WSX9ty2<<9(n`Ys=AX@RNRjzxYcMjsFZ?*klo(9`Xy0pz%+dO3^(+0== zbA1P2Ogj6>A;Xc#xtnp7B~iZ?OK=h>aDmEqi5QqA&V7UYaQwbvoMw%fid2k?v=$&W zU9LC1N7!8#Q-WfmkA|V1){F$W1nSN@5^O7TnxTnpys|30Y$U>gDEnU0u7`$EzCUgxKF=SKK zc(M!e{m6AkXWHEu3NF(2SA@7<23J^(Jg^;%h5KGp(c)gN$N7PNs6sUOs-M(%hY-0? z|B;LE-P5z_yS}s1J{j;76a!AP{;PNwe>?_)&boGne>lMWCEi7uGGMK$fW+GXaJzP@ zLeKG9htxxEMuTA+D1<>_B7;wzX8q{haH4_P(6W0v8!dhg{dEgbRwR;)&j-;kT{BT* zGF5alYiw*J#lFCK_w@1W)i+2V*HX%u9(Z`}>My23@3YcyD46nzA%%NuA6 z$lONl=$>A5cNf{XGkwN zKJmz+b(iE7?Za|mYx@aj!F+AgUP^!_!U^+IR_LR7^Wd6_?3V!V5M8Vknv-+Y*0=VB z3RDkWb~q(Xg>VWlaH=;l$s&6kowW8sh+In-9=`2&@$jt{s5oin8d<4-abf1&S1-yY z4Xll-Q5$CpVd1vYSL)4;BBv`+o2Uw73krO-6KUK|T~D`hx1+))!2)*!D_zF}$3nUF z@+Bco^6H5c!eU*o;#dsv6N7QlCIKiGMYk#s&zjCk;|@N&6P?8zHiT>2<9Z~6OW+dy z1;en?LH?maVakQZ=w<717oPTVD5{odQy#~CajBt5Rs?}0C1?oiNK3OWSt#y7$R%ayCbDQ7oAH<-&`Wp2>)fn@T+)hdW? zvE+)d2_$+7ALBDazH-i|WSMsT%KI8p;uxa*y6SzABt(4(r{>`#y^}+@uNBzb65Cdz zz%0=Yndh4^T4e5FymIOP2e;OLU$IhxNx)$Py!MR08zX)l`2XVJ z^~^~xQbAU_TL8%u;DbF~QB3)XgcU}tLY7)W0SyEOdbQ!8*+P<|dL`kJ9q|#!JE2iF z2P|F)Gcm)p=B!P3ckkv1x081a-vK`zC7nzWwj4fZ4YttY{*0j83 z`PT;>OuT#X3hZf2Y|#0OO*KdOdF<`w8GXTMqD!jidZDjP_B-7vFClC@%wCpeyiVBR z-jHXmyT>GNns9^GS}Ruz7(N+Gs|YythV2@4+Vsb`i=eGpP)ZXpdFz-;FN8{;cCt`v zc+QT8%U1bDX*pG@Uj@NNt;c*Ds=wF$3*_JHS9k(r_YmL_=>d2n_*Y@vV3A``LM;>6=Nn|z zre+N07A%UrbNF+fy2fh#6N|1jjqmfH-t*^9**oh)QB;1kEqHS}+ypo@-}EWd{rd6h z%$flx&-P89`bb8uk&YOaJsvhT3Wg!wx(1MRS$J~<4L!=WM+XbG8e#Rw9dqM9!@ z+#_6QHns5>W898fQL8nHugDl&2EBr0Q&x_YDt@cktT5=HQP5iCd`p4gHB$_A!2NZi zfd&6%=r+PKcF zcD>}A2!}ZrljP{g7lSURAIQNm87b5}hmrWXJFAsVr&+soJYUbIW<3f`8Rn&64AN|n zSdEEN^c|s2!F}}qI+8?SVwkqY15P7FqL;E!ycf$J%{gv!1HO@T*!_;91hNgu4&Yv_ zLVv=T^B%)U-s|Imj%(pjRp^!<7P~u*P@4{oI(<@|8!tD9aMICh#2eS4$eGG3v%|!D z3A9hb5HtqpqehMMa#N!Ts_sj&kZ`-;{^vSa$2KvUzQTu(^Rn+6Ub!urJ5;1XyfGF+ zPk&ug5Jz{R?Xt?FQ>0Rd;JiS)`RxM2aDHoU{Tt$KM~`fJ4=u@MHp~=H1h{{0>(l^Z z)`#oM8@Fg94%5>@ozPzIKn4u?Z9^Kdq zb>z6+;*Il{_Z$%8;%)VaMOgBcyqA`}UcP78_o$yfdftM9!cK-_c98twa zHqXs$;lCQr75r$Jq!!*D1TBMN$&{KKiwJy76aO*8aAD0)##01^2jiQZ=S6PyL9z`dPCX(PcIvRFR%Q%oq&J*9@-?yiy6KV#!b`ri50d zRQ+HHJA+XuO_7QOd(_ieE+CfY<*sY!`#?Q6B zy5398or>DtM&>Pt;fqQzX%#y7TO~D@!Q8N`jsznSaHVV@QII_GY`mUV{igy`NP(A}J%X}?5&&wsZWPQiBz zc?)>svRp9m2Q!__B)myK^VmyYTJ!dL1hE0?7sFX%XPzI+HQT~=qMN2?g-TJ)yv&^o zP-?RkV&wTaPG0K7dqAKQ@lbwGb9HunYmN}@dk%i*Y6CgtG26<8lS=_zY90qI7DfB}ire6El{#mc z;nEwoLQ&~Dc`v!lIOL$!8Cqc^q1h(sj5ncZeba?%Dy69??%`Jp?ZZZ>TN*R4Ep}sI zw{?js2HG>`K26%gY%2}$aMg~J`MfG&2;w$5vc%2GLM?tmm92FD7>Lt&#@luqnUb7n zMTH2f?x*aH%6_dW3+wKB{N5x-bY8Q7_w;nlC+dFhl!&BN&Ff1*S?}lyRicHzJ65=f zO#y?AA+n$PMh7kEH#NpfC>Lnwc{{Z)Vlk`VfVXgIAuJw^YU76nsxsw4)XG69SOl3M zXsToc7Sjz)_Km2o@OS4l8Pk|X#8Bcodlqp{eX(rt5%t!Csf6D|iO(IUR*jxn8u2KO zQ2ElC42(){N+?>x3X&7oo+mgooiaS zIvzb95Qu_Akw-&VCsEKR{6ZwE1sQ^Dq&q8pmb6%CggTRbctH9@U2Nq8LLNW}pd=Wl z)2ye3h=#^9CL^`Tj0Z|w$>T;#V)NRoh|No=l@&1z-e+UkRuibQ&9wG2&Ky}hRs@pk z&{u^6Votln-4}O_cY$AM;?jnlE9nfz_he1h*m+5^E44Gg@Gffy)%TbyGEpeMe`{2) z5*7nD8Bstj#>{{T1EU_vd5^`35WIP5gh(GPDeFoGC)=FJWY{fZomyNDEx}y7*y@Q+ zE!*X`kfss8HWb@hx{mGnzB$zNE*{{roGJ) z74vfpFx-*xmyL|>aP{5|H_RRB2nK&RUyU)Q5Nyxk0h)N4isUHfG~i4EXs`76b>R{p zaTE$B^0yjYa0Dz4T!#L-BNMU4i_Hbr=KTo*#^mn;q#H-@)7~#Sw!WzJVyR2QRWHPVe)!r_j!+mZ)-gCwne;e2sekE2s#u zBB@|AlL)>RmIfI%!jyQ9yJ=36Y=kjt3Ss$!7>SBfYIXZ3iz10mkjP@voHl-|)^tIh z#IY2OH0SyP1y$O`Gex+}Lv)?dR?e$O)x$1IK~cET zQ>(H{FhP9X=x~9~8;=t1n2V;CyWI65+}B__iGq-W+!Er~oYCPvy%Po`*xl&OqhjBD zAY4Ky{Ib^XLF8{~54CQ6@9!S7KA#DyA;cCC4>(OU)A_lDLI*%?VKI zVF7!a^&(NWCGBf}7T177CBQTaEqJ;4=I>8sWt6@0_tP^XfDa+y^Fs#!aMb<(TLYk) zx#~9>06Tw+{0|I*1`1Fvhk^oP1X%b0y#E*V9xyumxR8KO1iyck6;%?Xmy{C&9Mu1N zvW7l2DgnShC<8udfX|;-p6~a!#s5ntD<~%^CaS3PLRRdr2;|R*0khqY3km3(U>e}N zwVm0c5a{ypIj35H*oP5cau-UI%12Jj*Mk^K9u z))ybJ{`#KRAIyIO{HY7|XQcJ#IqF>voJ9l7^EQBze{cRjuUcPVz+e9f@cF6^u)cF~ z6?Akk0mQyF)&CjT`8ng>v6_7`fMyBsA^DRIaIf`s2IS#4jFNwr;g6Th=XhX6ZYx@V zyea@v)Bg=m7ho&?4W782u7QQ2G9diCgteuijJ377qs{N3@iw)WdI2E!fL{82L-^0D z))&xce+LbS`D@{54>(sQW@=$5sIPBmZ!fEBrEC1B(!%q+kHG7QeUG4h2e9Y;J?{hn zQPbb#UG)!X4uGk{$kf;o5I!3aO8)nGSMbC)-2qeyHX!eee`XwTul2o0`YrVH_LKmK zMOgf|jOV*DHmd+K4g{#3?<2;aSFJBS#&6MOtd0L`EsWV6g`ordOsoK9{(da#&#TtA z6CeWen_Bpr?A`B+&$(K^f(v-Wjsc?p(Vu{Td#x`v;OB2J0fzz|bS*4?kG9e&6WRl) z%y)o+>F@1i2j~~SK@+mJcK9y4VI!++Y6Y;l{uJAI-UTFP8_1>rZA1zv>UYV6Kd)L} zU(Vk`|L6juE{6J!{}(;|Icfk-UP(0oRS1Ae^Cu+WUhA7G{9DvN9*Q5>-!uLDig>QM z`zLg*ZvsF><~J4bqgwyl@bg^b@F$)FU_k#3-rt)3zbPI*uZ`#Wc|TdaRDa9z&m+!r z*_@wnvv2-y^87IX|8@fXYyQ4(ZatU1`3Y$J_P>kZJV*JS>iZ-4{rWB&^T+jl9<$W_ zTPeSXuz8;Nxrof4$!mSne@*(7j@&*7g7gZzZ2H25WNe}Vn+a>?{-Z~R_w z&m}m1qM{o93)FuQ46!nEyV!!gHSIhx~u?BuD(h^XuU8ua5jb=X`!t`zNPZ^#A7k{c!c% zr}ii2dCvdF{Edh0^GrW?VEjq2llLzO{yIwiz68(R$9@tF6#hc+=PdDW48PAy^4#6y zCy{UIFGRm|*MEB4o^PT5L=LX_1^L&`^au3sH`JdO;`!F)Pb#&ybLsOPyPvR& zHU9+rW5D=_{k!J{cy8DK$wbij3)A!WhriU_|0vLNTk}tv^QK>D{sQ}>K!4o+VeETu zbo_}g(fTj&|GNqDd3`;%qx>XV1sDeYcrynq2!C%?c_j@FcnkclF2e+b1PDE++xh+1 F{{tUq7iIte literal 0 HcmV?d00001 diff --git a/modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.properties.mustache b/modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.properties.mustache new file mode 100644 index 00000000000..b7a36473955 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/gradle-wrapper.properties.mustache @@ -0,0 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/modules/swagger-codegen/src/main/resources/scala/gradle.properties.mustache b/modules/swagger-codegen/src/main/resources/scala/gradle.properties.mustache new file mode 100644 index 00000000000..05644f0754a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/gradle.properties.mustache @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/scala/gradlew.bat.mustache b/modules/swagger-codegen/src/main/resources/scala/gradlew.bat.mustache new file mode 100644 index 00000000000..72d362dafd8 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/gradlew.bat.mustache @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/swagger-codegen/src/main/resources/scala/gradlew.mustache b/modules/swagger-codegen/src/main/resources/scala/gradlew.mustache new file mode 100755 index 00000000000..9d82f789151 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/gradlew.mustache @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/modules/swagger-codegen/src/main/resources/scala/settings.gradle.mustache b/modules/swagger-codegen/src/main/resources/scala/settings.gradle.mustache new file mode 100644 index 00000000000..b8fd6c4c41f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/settings.gradle.mustache @@ -0,0 +1 @@ +rootProject.name = "{{artifactId}}" \ No newline at end of file diff --git a/samples/client/petstore/scala/.swagger-codegen-ignore b/samples/client/petstore/scala/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/scala/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/scala/LICENSE b/samples/client/petstore/scala/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/scala/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/scala/build.gradle b/samples/client/petstore/scala/build.gradle new file mode 100644 index 00000000000..979db7783c4 --- /dev/null +++ b/samples/client/petstore/scala/build.gradle @@ -0,0 +1,120 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'io.swagger' +version = '1.0.0' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 23 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'scala' + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = 'swagger-scala-client' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + scala_version = "2.10.4" + joda_version = "1.2" + jodatime_version = "2.2" + jersey_version = "1.19" + swagger_core_version = "1.5.8" + jersey_async_version = "1.0.5" + jackson_version = "2.4.2" + junit_version = "4.8.1" + scala_test_version = "2.2.4" +} + +dependencies { + compile "com.fasterxml.jackson.module:jackson-module-scala_2.10:$jackson_version" + compile "com.sun.jersey:jersey-client:$jersey_version" + compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" + compile "org.jfarcand:jersey-ahc-client:$jersey_async_version" + compile "org.scala-lang:scala-library:$scala_version" + compile "io.swagger:swagger-core:$swagger_core_version" + testCompile "org.scalatest:scalatest_2.10:$scala_test_version" + testCompile "junit:junit:$junit_version" + compile "joda-time:joda-time:$jodatime_version" + compile "org.joda:joda-convert:$joda_version" +} diff --git a/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html new file mode 100644 index 00000000000..832cc577c49 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html @@ -0,0 +1,121 @@ + + + + + +Test results - Class PetApiTest + + + + + +
+

Class PetApiTest

+
+
+ + + + + +
+
+ + + + + + + +
+
+
4
+

tests

+
+
+
+
0
+

failures

+
+
+
+
0
+

ignored

+
+
+
+
8.201s
+

duration

+
+
+
+
+
+
100%
+

successful

+
+
+
+
+ +
+

Tests

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TestDurationResult
PetApi should add and fetch a pet2.414spassed
PetApi should find pets by status2.665spassed
PetApi should find pets by tag0.567spassed
PetApi should update a pet2.555spassed
+
+
+

Standard output

+ +
finding by tags
+
+
+
+
+ +
+ + diff --git a/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html new file mode 100644 index 00000000000..3de64cc1941 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html @@ -0,0 +1,101 @@ + + + + + +Test results - Class StoreApiTest + + + + + +
+

Class StoreApiTest

+ +
+ + + + + +
+
+ + + + + + + +
+
+
2
+

tests

+
+
+
+
0
+

failures

+
+
+
+
0
+

ignored

+
+
+
+
3.613s
+

duration

+
+
+
+
+
+
100%
+

successful

+
+
+
+
+ +
+

Tests

+ + + + + + + + + + + + + + + + + + +
TestDurationResult
StoreApi should delete an order2.357spassed
StoreApi should place and fetch an order1.256spassed
+
+
+ +
+ + diff --git a/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html new file mode 100644 index 00000000000..450651fcea9 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html @@ -0,0 +1,121 @@ + + + + + +Test results - Class UserApiTest + + + + + +
+

Class UserApiTest

+ +
+ + + + + +
+
+ + + + + + + +
+
+
6
+

tests

+
+
+
+
0
+

failures

+
+
+
+
0
+

ignored

+
+
+
+
10.898s
+

duration

+
+
+
+
+
+
100%
+

successful

+
+
+
+
+ +
+

Tests

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TestDurationResult
UserApi should authenticate a user0.559spassed
UserApi should create 2 users1.912spassed
UserApi should create 3 users2.355spassed
UserApi should fetch a user0.594spassed
UserApi should log out a user2.130spassed
UserApi should update a user3.348spassed
+
+
+ +
+ + diff --git a/samples/client/petstore/scala/build/reports/tests/css/base-style.css b/samples/client/petstore/scala/build/reports/tests/css/base-style.css new file mode 100644 index 00000000000..4afa73e3ddc --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/css/base-style.css @@ -0,0 +1,179 @@ + +body { + margin: 0; + padding: 0; + font-family: sans-serif; + font-size: 12pt; +} + +body, a, a:visited { + color: #303030; +} + +#content { + padding-left: 50px; + padding-right: 50px; + padding-top: 30px; + padding-bottom: 30px; +} + +#content h1 { + font-size: 160%; + margin-bottom: 10px; +} + +#footer { + margin-top: 100px; + font-size: 80%; + white-space: nowrap; +} + +#footer, #footer a { + color: #a0a0a0; +} + +#line-wrapping-toggle { + vertical-align: middle; +} + +#label-for-line-wrapping-toggle { + vertical-align: middle; +} + +ul { + margin-left: 0; +} + +h1, h2, h3 { + white-space: nowrap; +} + +h2 { + font-size: 120%; +} + +ul.tabLinks { + padding-left: 0; + padding-top: 10px; + padding-bottom: 10px; + overflow: auto; + min-width: 800px; + width: auto !important; + width: 800px; +} + +ul.tabLinks li { + float: left; + height: 100%; + list-style: none; + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + padding-bottom: 5px; + margin-bottom: 0; + -moz-border-radius: 7px; + border-radius: 7px; + margin-right: 25px; + border: solid 1px #d4d4d4; + background-color: #f0f0f0; +} + +ul.tabLinks li:hover { + background-color: #fafafa; +} + +ul.tabLinks li.selected { + background-color: #c5f0f5; + border-color: #c5f0f5; +} + +ul.tabLinks a { + font-size: 120%; + display: block; + outline: none; + text-decoration: none; + margin: 0; + padding: 0; +} + +ul.tabLinks li h2 { + margin: 0; + padding: 0; +} + +div.tab { +} + +div.selected { + display: block; +} + +div.deselected { + display: none; +} + +div.tab table { + min-width: 350px; + width: auto !important; + width: 350px; + border-collapse: collapse; +} + +div.tab th, div.tab table { + border-bottom: solid #d0d0d0 1px; +} + +div.tab th { + text-align: left; + white-space: nowrap; + padding-left: 6em; +} + +div.tab th:first-child { + padding-left: 0; +} + +div.tab td { + white-space: nowrap; + padding-left: 6em; + padding-top: 5px; + padding-bottom: 5px; +} + +div.tab td:first-child { + padding-left: 0; +} + +div.tab td.numeric, div.tab th.numeric { + text-align: right; +} + +span.code { + display: inline-block; + margin-top: 0em; + margin-bottom: 1em; +} + +span.code pre { + font-size: 11pt; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + background-color: #f7f7f7; + border: solid 1px #d0d0d0; + min-width: 700px; + width: auto !important; + width: 700px; +} + +span.wrapped pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: break-all; +} + +label.hidden { + display: none; +} \ No newline at end of file diff --git a/samples/client/petstore/scala/build/reports/tests/css/style.css b/samples/client/petstore/scala/build/reports/tests/css/style.css new file mode 100644 index 00000000000..3dc4913e7a0 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/css/style.css @@ -0,0 +1,84 @@ + +#summary { + margin-top: 30px; + margin-bottom: 40px; +} + +#summary table { + border-collapse: collapse; +} + +#summary td { + vertical-align: top; +} + +.breadcrumbs, .breadcrumbs a { + color: #606060; +} + +.infoBox { + width: 110px; + padding-top: 15px; + padding-bottom: 15px; + text-align: center; +} + +.infoBox p { + margin: 0; +} + +.counter, .percent { + font-size: 120%; + font-weight: bold; + margin-bottom: 8px; +} + +#duration { + width: 125px; +} + +#successRate, .summaryGroup { + border: solid 2px #d0d0d0; + -moz-border-radius: 10px; + border-radius: 10px; +} + +#successRate { + width: 140px; + margin-left: 35px; +} + +#successRate .percent { + font-size: 180%; +} + +.success, .success a { + color: #008000; +} + +div.success, #successRate.success { + background-color: #bbd9bb; + border-color: #008000; +} + +.failures, .failures a { + color: #b60808; +} + +.skipped, .skipped a { + color: #c09853; +} + +div.failures, #successRate.failures { + background-color: #ecdada; + border-color: #b60808; +} + +ul.linkList { + padding-left: 0; +} + +ul.linkList li { + list-style: none; + margin-bottom: 5px; +} diff --git a/samples/client/petstore/scala/build/reports/tests/index.html b/samples/client/petstore/scala/build/reports/tests/index.html new file mode 100644 index 00000000000..6393b771932 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/index.html @@ -0,0 +1,150 @@ + + + + + +Test results - Test Summary + + + + + +
+

Test Summary

+
+ + + + + +
+
+ + + + + + + +
+
+
12
+

tests

+
+
+
+
0
+

failures

+
+
+
+
0
+

ignored

+
+
+
+
22.712s
+

duration

+
+
+
+
+
+
100%
+

successful

+
+
+
+
+ +
+

Packages

+ + + + + + + + + + + + + + + + + + + + + +
PackageTestsFailuresIgnoredDurationSuccess rate
+default-package +120022.712s100%
+
+
+

Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassTestsFailuresIgnoredDurationSuccess rate
+PetApiTest +4008.201s100%
+StoreApiTest +2003.613s100%
+UserApiTest +60010.898s100%
+
+
+ +
+ + diff --git a/samples/client/petstore/scala/build/reports/tests/js/report.js b/samples/client/petstore/scala/build/reports/tests/js/report.js new file mode 100644 index 00000000000..83bab4a19f3 --- /dev/null +++ b/samples/client/petstore/scala/build/reports/tests/js/report.js @@ -0,0 +1,194 @@ +(function (window, document) { + "use strict"; + + var tabs = {}; + + function changeElementClass(element, classValue) { + if (element.getAttribute("className")) { + element.setAttribute("className", classValue); + } else { + element.setAttribute("class", classValue); + } + } + + function getClassAttribute(element) { + if (element.getAttribute("className")) { + return element.getAttribute("className"); + } else { + return element.getAttribute("class"); + } + } + + function addClass(element, classValue) { + changeElementClass(element, getClassAttribute(element) + " " + classValue); + } + + function removeClass(element, classValue) { + changeElementClass(element, getClassAttribute(element).replace(classValue, "")); + } + + function initTabs() { + var container = document.getElementById("tabs"); + + tabs.tabs = findTabs(container); + tabs.titles = findTitles(tabs.tabs); + tabs.headers = findHeaders(container); + tabs.select = select; + tabs.deselectAll = deselectAll; + tabs.select(0); + + return true; + } + + function getCheckBox() { + return document.getElementById("line-wrapping-toggle"); + } + + function getLabelForCheckBox() { + return document.getElementById("label-for-line-wrapping-toggle"); + } + + function findCodeBlocks() { + var spans = document.getElementById("tabs").getElementsByTagName("span"); + var codeBlocks = []; + for (var i = 0; i < spans.length; ++i) { + if (spans[i].className.indexOf("code") >= 0) { + codeBlocks.push(spans[i]); + } + } + return codeBlocks; + } + + function forAllCodeBlocks(operation) { + var codeBlocks = findCodeBlocks(); + + for (var i = 0; i < codeBlocks.length; ++i) { + operation(codeBlocks[i], "wrapped"); + } + } + + function toggleLineWrapping() { + var checkBox = getCheckBox(); + + if (checkBox.checked) { + forAllCodeBlocks(addClass); + } else { + forAllCodeBlocks(removeClass); + } + } + + function initControls() { + if (findCodeBlocks().length > 0) { + var checkBox = getCheckBox(); + var label = getLabelForCheckBox(); + + checkBox.onclick = toggleLineWrapping; + checkBox.checked = false; + + removeClass(label, "hidden"); + } + } + + function switchTab() { + var id = this.id.substr(1); + + for (var i = 0; i < tabs.tabs.length; i++) { + if (tabs.tabs[i].id === id) { + tabs.select(i); + break; + } + } + + return false; + } + + function select(i) { + this.deselectAll(); + + changeElementClass(this.tabs[i], "tab selected"); + changeElementClass(this.headers[i], "selected"); + + while (this.headers[i].firstChild) { + this.headers[i].removeChild(this.headers[i].firstChild); + } + + var h2 = document.createElement("H2"); + + h2.appendChild(document.createTextNode(this.titles[i])); + this.headers[i].appendChild(h2); + } + + function deselectAll() { + for (var i = 0; i < this.tabs.length; i++) { + changeElementClass(this.tabs[i], "tab deselected"); + changeElementClass(this.headers[i], "deselected"); + + while (this.headers[i].firstChild) { + this.headers[i].removeChild(this.headers[i].firstChild); + } + + var a = document.createElement("A"); + + a.setAttribute("id", "ltab" + i); + a.setAttribute("href", "#tab" + i); + a.onclick = switchTab; + a.appendChild(document.createTextNode(this.titles[i])); + + this.headers[i].appendChild(a); + } + } + + function findTabs(container) { + return findChildElements(container, "DIV", "tab"); + } + + function findHeaders(container) { + var owner = findChildElements(container, "UL", "tabLinks"); + return findChildElements(owner[0], "LI", null); + } + + function findTitles(tabs) { + var titles = []; + + for (var i = 0; i < tabs.length; i++) { + var tab = tabs[i]; + var header = findChildElements(tab, "H2", null)[0]; + + header.parentNode.removeChild(header); + + if (header.innerText) { + titles.push(header.innerText); + } else { + titles.push(header.textContent); + } + } + + return titles; + } + + function findChildElements(container, name, targetClass) { + var elements = []; + var children = container.childNodes; + + for (var i = 0; i < children.length; i++) { + var child = children.item(i); + + if (child.nodeType === 1 && child.nodeName === name) { + if (targetClass && child.className.indexOf(targetClass) < 0) { + continue; + } + + elements.push(child); + } + } + + return elements; + } + + // Entry point. + + window.onload = function() { + initTabs(); + initControls(); + }; +} (window, window.document)); \ No newline at end of file diff --git a/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml new file mode 100644 index 00000000000..cc2e356f55e --- /dev/null +++ b/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml new file mode 100644 index 00000000000..0944febda9b --- /dev/null +++ b/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml new file mode 100644 index 00000000000..4773a968d0e --- /dev/null +++ b/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/samples/client/petstore/scala/build/test-results/binary/test/output.bin b/samples/client/petstore/scala/build/test-results/binary/test/output.bin new file mode 100644 index 00000000000..51c4ba6dd66 --- /dev/null +++ b/samples/client/petstore/scala/build/test-results/binary/test/output.bin @@ -0,0 +1 @@ +finding by tags diff --git a/samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx b/samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx new file mode 100644 index 0000000000000000000000000000000000000000..dfffe31d6255ce161034f51b7dfff3bcf73779a0 GIT binary patch literal 36 QcmZQ%Vq|4N1OL$g0Eo>G`Tzg` literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/build/test-results/binary/test/results.bin b/samples/client/petstore/scala/build/test-results/binary/test/results.bin new file mode 100644 index 0000000000000000000000000000000000000000..a2b463d4a3dbe53dbf45eb3df60789f20a0bd3d0 GIT binary patch literal 605 zcmZQ(X6g<|EpaT!3`s36VPIekRb#L{$-=k@BB)TDkzbmVqL7#Z#Ca(SX{ja2848IC z1*s(r?}Q-A-OU-8XQL`FEl5c$NrkHWEeuf?XvDyRW^7s}&`h9N#R^H43dJRfC8fm- zFGV2Aqh~X)&PO#CMR`eLI>UArh}zgo3|u{-#i>Oo{wUnS#yJNn3iAle1EoO4440tV zOV}8=7o#amEG@}M%`3@FhIj<5emzuunJEL$JT&z=`RNMzr6oW=LyQ)HxU8;&ffrqA za#1SCP$RI)Vul}l5T$Jl417408bg(Ch6Z`RF$4cxGzY-L9Bls-DTtwSycpPfgG=&@ zQc;2?_6ZZ)N|-P#YzlG`lYxu9VcAR8U;Q6mNyP IF^7o(0G=Maj{pDw literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp new file mode 100644 index 0000000000000000000000000000000000000000..407a6ed065bd255fcc8bee40e43ab9e049919e09 GIT binary patch literal 10545 zcmcJV3wRt=701ur$!;>qY}(Cc+onlVHrYHjAx)FgHqC~#yV-7;Z9;95rfnqDO|osb zO*UzEQ(9g=@PQ9}q9}@@D2f&eC=x-dD2i556h%=KMNt$*Q4~c%&z-yJ%w)CX=n<(M)zGF_w+ZrpL0W zsdQT*5CXfq2HQG&4<(K!S|<|e1Fbto4<*O4p?<-!Zu@DyY=|?+uED{!&|rV4J49gV z+0a5LAh6^tM^V5lm=1<(uwTsOcFS*_=6=8q4Aal4guwuq-=#x-&7- zKDyUcMf@>`T9;gjVRM%H)tzlMQR4KfiEx+{L`L?P5B057oxV-P(Wp3MuXA#;q!~dV-LMvz!o@>Zu(iLDds(?o*ZK1gQxtTCsD)?@u@yr&Be(2huB5#h29m z;X*|zbY_+>Eh+GBxwcU?mAD{ z6(P=w?(8KkZl$ir*W_u4l&wwZ#p98%r_HOXQGZz3wzpf`)@thO50A7{eS=qRi~32y z)_p_e+tv&-K5;tAG9KMuM0OH~*XJfKhoi10;wdUx9dXwTY;D5vFFWp-y#U9*qRw-q z2*+>k?6vZH3YXO;kstM{{;imoo_*cpyIU$c+Eq{SKwZR`cP14#=d&*y_cfT;*Sx!B z%v+!J>C3 zrl%*42PVgcqk+scfr7?paF~GatlA8WO(ZgzLMTP4@$6C$p+y4?mKMVj@E{|5FqI+T zpD);j?mDbl$I&(dBx<>isCgZDSU6ZzgXK^`2U}?|#!O>u0b@*qDyXK$)fS^}8ubN? zx(0rzrN)587&nda1&nbG>YIHW-{v{2(3i*Y!XOH#~8l06f6T!XdH zPL1m@vKWao8IGD}ab#mbjO+&Jpyo{$W6U&)BO421WJ7R1HFjH!x@iRh|3u0vB&`XVd7UQs$stWbwELJ76a@_G4sm zLS|%5vpBLkjqEPiP0f2O#+YdoM^>ki9fpgjal~TOO`|xnI*sf;NKoUb#TYk@;>hYW zvg5Fy8V^{EL#9z2S)E2U1&66|!eShb=OPteHclgZ6}*8O-)J!o znMQGB<215Y!&|8Ftpp0krY5JSGD!jfdjkmCnlpj*_S0-<*?k&Z1Mi?iz7unTmEf^? z@D(O^Df7<{4X$OL_i~!i(>1t`Y47JWqit(&J<~qOX+~$(;0C6BnA42rtHF&-`zWUw z{Z)gTnD%i_Gg_zyH#6;%oMv=L4Q^rDr#a1Nf*PD)+O3>s^f?VqGVOLwGg_GjcQWm> zoMv<@4enyv=Q+)2NE*yB?F*b1rT3x+_cHB^oMyBX4Nfub%baF(4Gr#N+E+QvXbc+M z&$O>|nsM)I@Bq`k$!W&zt-)!geVfyww6ZmLkZIrLG~))<;31}cpVN$cP=kk=_CroH zZZi!YVcL&5&A5{^c$8^B#aktj9v?iIOl$BMJN9!tKX=Tm*~gjoOHRwx>=R7;HK*lj z_DQDwmeX=I`xMiD&uO`ueVS>1b6T!upJm!#IW1SS&oS-qoR+KE=b83T zPRrHo3rzbrr{!w)MW(&PX{=@m7#hJhNNYTex+DtI3OJ3`EO9ZdkkeSr5|wGioW^RF zXiRf+8mn2dglS7TjnynEW15%KSj`e2)0S}>t68#wX%(EtYL-+ot%}oF&5~-S;rpc} zF05vWpJ_Fm#%h)Xm{v!iC_6Qfok^v!<(4-FEelO{6knR_?EPGDo<GYeA!+q=S|CA4k8uEB7KE}FYTwug}+v9m!U=T8zlvPaDWr= zses!;z4)nt8~1(A!@qTcf`0&9O$~EUb^^aS$a?&}3>|nByiksx^qUWl5wgMfj!h65 zxMu?^M4ZZ#s4s?71*=4yb8cHC#}73kPTgYXRSyj!PSdT6yq;z_SHx+(W09P-&~}F7 zV3}#EorCl8&ucw;_^MVw>#^JV88hf77A zEAr>d&bbm^E#kaxvGckLUN7RjDSy7~*K;+zS;To;{(RXv*TCEH`NE!G^Zl@S4&HTp zp1%5Scn^+k$rssZoZW%Xv1`S=_sQ@!A@4dd?*p>D>&3he$?|Rx^FAWWyHU*hm@Mxm zG4B&HyiUx=&0^lCWOy{cw}^S4k>#Bb^KO&nofPx#kmcPe=6z0h~`<4uk=J&Li_Z=A?&F_O^-uGmA z4~cm{kmWrr=KV;P_lTJH6ItG)V&2bWcr?F{iFv<};f0X*xS01V86K{5;0ZDBH?q7Z z#k}9i@}3g&{vgYHTFm>CEbkdH?=LdE^D!UKig|yN;nDm)C+7V_miN4v_b*xA3u4}X zWO*-&dHVqUE*FCgaC%kXG^8%QJmrt9-o z?5=dT*x58knoS(tJjR1;d)c}uM;rbdO>S|&E@xJo?k24WSZD4NFo0?YjT{s4cJ zIEn40LCUf-%)B=<`*yy6KED8*W1rz9@p-`QI1QDY2>a4YRLp(VPeWhHC_J+!{_w_1 zo^>#Wk-LE1b;taL+W`+p_MJBtzH;VDuA*1*_z+6v^kz_DmcwwgV2}=tq4`HD)a$4c zSdem>(;2E=N%MOQ<6Hmm`Ol=@XAy;Wk zs4W62mB{brehGWz@eAj8oiP9a literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp new file mode 100644 index 0000000000000000000000000000000000000000..0539403de97cd71d5d0abbb3e9fede0e71f84f08 GIT binary patch literal 2287 zcma)-ZCBbz6vyu*nP4EO!Lo{0>|i3IRSLBAvF;{_71Vl^mR4I%PhhErDp(S_r@Q?~ z`}k`2?2G*X`=R#i4HV0<*|WUJ%-oy%yZ2`1&+zv@fBppkX*eV>V^_@!Gudi49P6@{ z)GM~rGONx`yHRzlX5*d@2!XB5)G^v{N7|H9SCwoE2Jtu8nbf(7szQ!iW+1%Zroj2dYQT`*5!EcRmM-l=~-r| z_Un=`Z|EV)mX65I-gxTlq_BNH8uL>v#&mA+y_vo{zKeODYlek%-7nkLT_?U+HdOkw)+S_Nk!0k;vlu`wrI|$O0zFS_svc4}UjHBWV$0YKM_&#XP z_;B=2n9uQPJxr7-s-TQz^Xls2gL+v#RqZPR{Cwh+K)9o>V;|BJ{Tr&YyPI5 zHxj2Z$S~@M5l{#S&beh1U_D{}*N+Ibd0iV%r(4_bE?~$IhHlIm1|GQ7!#=9iqe|XXNrqKecPTutA*We%T2|xCjZO63bX_k- zXddeLGERm^@U@%s8v^2{)v%l`84OtS0|h)wQFUFa47qM)+;Sn?{I*6QwBN-0tz@<= zvvN^;>JE5g?pux8llEn$*81d;t}j3W{$jJ;s@8TaH#BnGRb$DrEoAjZqv@FLm5zcP z>Rp`z0}dM@;KToe0M0T5aoj~Ki8H~OF8l$ZA92A!9!I(BgfX~++_{E1Ty@)?{RJ2Q-?j?cHT?OT=YJjuPQZc(yfj$b%bi{BZrJCx z(?1PVIRp1SDz6Myc@@??;LYC#s{9DHJYfCTfnd}=o{9U-8BF3Hm9+3XY@^B^->fcq isBEuOWDNx9u6Wq*c!uBrXIH`!K7JdQPtd_rfPVq7pOYy7 literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp new file mode 100644 index 0000000000000000000000000000000000000000..74d2409d2e0ba550401e032be317d63ed5a7be59 GIT binary patch literal 572 zcmah`!AiqG5Pj38iHXr_)mE(_LXg^n6+N~TROl&qY3+TRF1nB=CE0+#qNjOad5sFTdMOw{d=X#RrL{z-_;x_RPr=>TF$x7{Cs8**Ex_MaD%L`y7?n9~6EKhwSkM&2W_3 literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/git_push.sh b/samples/client/petstore/scala/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/scala/git_push.sh +++ b/samples/client/petstore/scala/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/scala/gradle.properties b/samples/client/petstore/scala/gradle.properties new file mode 100644 index 00000000000..05644f0754a --- /dev/null +++ b/samples/client/petstore/scala/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2c6137b87896c8f70315ae454e00a969ef5f6019 GIT binary patch literal 53639 zcmafaW0a=B^559DjdyI@wr$%scWm3Xy<^+Pj_sKpY&N+!|K#4>Bz;ajPk*RBjZ;RV75EK*;qpZCo(BB5~-#>pF^k0$_Qx&3rs}{XFZ)$uJU-ZpbB>L3?|knJ{J+ge{%=bI`#Yn9v&Fxx>fd=_|H)(FY-DO{ z_Wxu>{a02GXCp^PGw1(fh-I*;dGTM?mA^##pNEJ#c-Y%I7@3kW(VN&Bxw!bn$iWOU zB8BZ)vT4(}GX%q~h3EYwbR?$d6|xnvg_e@4>dl5l+%FtPbGqa`;Uk##t$#g&CK4GO zz%my0ZR1Fv@~b2_>T0cBP)ECz-Uc^nW9e+`W4!=mSJPopgoe3A(NMzBd0mR?$&3XA zRL1}bJ2Q%R#bWHrC`j_)tPKMEyHuGSpdJMhT(Ob(e9H+#=Skp%#jzj=BVvc(-RSWB z{_T`UcEeWD{z`!3-y;_N|Ljr4%f;2qPSM%n?_s%GnYsM!d3p)CxmudpyIPqTxjH!i z;}A+!>>N;pko++K5n~I7m4>yco2%Zc$59RohB(l%KcJc9s^nw^?2JGy>O4#x5+CZH zqU~7kA>WE)ngvsdfKhLUX0Lc3r+In0Uyn}LZhm?n){&LHNJws546du%pia=j zyH8CD{^Qx%kFe@kX*$B!DxLa(Y?BO32sm8%#_ynjU-m>PJbabL`~0Ai zeJm<6okftSJUd2!X(>}i#KAh-NR2!Kg%c2JD=G|T%@Q0JQzqKB)Qc4E-{ZF=#PGZg zior4-caRB-Jj;l}Xb_!)TjB`jC}})6z~3AsRE&t~CO&)g{dqM0iK;lvav8?kE1< zmCrHxDZe?&rEK7M4tG-i!`Zk-*IzSk0M0&Ul8+J>*UD(A^;bAFDcz>d&lzAlw}b## zjfu@)rAou-86EN%8_Nv;%bNUmy*<6sbgB9)ZCihdSh_VT2iGFv+T8p&Z&wO02nKtdx?eZh^=*<>SZHSn(Pv)bgn{ zb15>YnVnJ^PO025c~^uK&W1C1XTs1az44L~-9Z-fU3{VvA?T& zdpi&S`mZ|$tMuN{{i|O}fAx#*KkroHe;6z^7c*x`2Rk!a2L~HB$A4@(Rz*hvM+og( zJW+4;S-A$#+Gec-rn8}at+q5gRrNy^iU?Z4Gz_|qzS~sG_EV#m%-VW!jQ>f3jc-Vq zW;~>OqI1Th&*fx#`c^=|A4GGoDp+ZH!n0_fDo-ks3d&GlT=(qzr(?Qw`PHvo3PoU6YJE zu{35)=P`LRm@+=ziAI)7jktM6KHx*v&WHVBYp<~UtR3c?Wv_{a0(k&NF!o#+@|Y6Y z>{||-i0v8N2ntXRrVx~#Z1JMA3C2ki}OkJ4W`WjZIuLByNUEL2HqqKrbi{9a8` zk-w0I$a<6;W6&X<&EbIqul`;nvc+D~{g5al{0oOSp~ zhg;6nG1Bh-XyOBM63jb_z`7apSsta``K{!Q{}mZ!m4rTmWi^<*BN2dh#PLZ)oXIJY zl#I3@$+8Fvi)m<}lK_}7q~VN%BvT^{q~ayRA7mwHO;*r0ePSK*OFv_{`3m+96HKgt z=nD-=Pv90Ae1p)+SPLT&g(Fdqbcc(Vnk5SFyc|Tq08qS;FJ1K4rBmtns%Su=GZchE zR(^9W-y!{QfeVPBeHpaBA{TZpQ*(d$H-*GI)Y}>X2Lk&27aFkqXE7D?G_iGav2r&P zx3V=8GBGi8agj5!H?lDMr`1nYmvKZj!~0{GMPb!tM=VIJXbTk9q8JRoSPD*CH@4I+ zfG-6{Z=Yb->)MIUmXq-#;=lNCyF1G*W+tW6gdD||kQfW$J_@=Y9KmMD!(t#9-fPcJ z>%&KQC-`%E`{y^i!1u=rJP_hhGErM$GYE3Y@ZzzA2a-PC>yaoDziZT#l+y)tfyR}U z5Epq`ACY|VUVISHESM5$BpWC0FpDRK&qi?G-q%Rd8UwIq&`d(Mqa<@(fH!OfNIgFICEG?j_Gj7FS()kY^P(I!zbl`%HB z7Rx=q2vZFjy^XypORT$^NJv_`Vm7-gkJWYsN5xg>snt5%oG?w1K#l_UH<>4@d0G@3 z)r?|yba6;ksyc+5+8YZ?)NZ+ER!4fIzK>>cs^(;ib7M}asT&)+J=J@U^~ffJ>65V# zt_lyUp52t`vT&gcQ%a6Ca)p8u6v}3iJzf?zsx#e9t)-1OtqD$Mky&Lpz6_v?p0|y4 zI{Nq9z89OxQbsqX)UYj z(BGu`28f8C^e9R2jf0Turq;v+fPCWD*z8!8-Q-_s`ILgwo@mtnjpC_D$J zCz7-()9@8rQ{4qy<5;*%bvX3k$grUQ{Bt;B#w))A+7ih631uN?!_~?i^g+zO^lGK$>O1T1$6VdF~%FKR6~Px%M`ibJG*~uQ>o^r9qLo*`@^ry@KX^$LH0>NGPL%MG8|;8 z@_)h2uvB1M!qjGtZgy~7-O=GUa`&;xEFvC zwIt?+O;Fjwgn3aE%`_XfZEw5ayP+JS8x?I|V3ARbQ5@{JAl1E*5a{Ytc(UkoDKtD# zu)K4XIYno7h3)0~5&93}pMJMDr*mcYM|#(FXS@Pj)(2!cl$)R-GwwrpOW!zZ2|wN) zE|B38xr4_NBv|%_Lpnm$We<_~S{F1x42tph3PAS`0saF^PisF6EDtce+9y6jdITmu zqI-CLeTn2%I3t3z_=e=YGzUX6i5SEujY`j|=aqv#(Q=iWPkKhau@g|%#xVC2$6<{2 zAoimy5vLq6rvBo3rv&^VqtaKt_@Vx^gWN{f4^@i6H??!ra^_KC-ShWC(GBNt3o~T^ zudX<0v!;s$rIflR?~Tu4-D=%~E=glv+1|pg*ea30re-2K@8EqQ{8#WY4X-br_!qpq zL;PRCi^e~EClLpGb1MrsXCqfD2m615mt;EyR3W6XKU=4(A^gFCMMWgn#5o1~EYOH* zOlolGlD;B!j%lRFaoc)q_bOH-O!r}g1Bhlhy*dRoTf-bI%`A`kU)Q=HA9HgCKqq&A z2$_rtL-uIA7`PiJfw380j@M4Fff-?(Xe(aR`4>BZyDN2$2E7QQ1}95@X819fnA(}= za=5VF-%;l}aHSRHCfs(#Qf%dPue~fGpy7qPs*eLX2Aa0+@mPxnS4Wm8@kP7KEL)8s z@tNmawLHST-FS4h%20%lVvd zkXpxWa43E`zX{6-{2c+L9C`l(ZRG8`kO9g7t&hx?>j~5_C;y5u*Bvl79)Bq?@T7bN z=G2?QDa0J3VwCfZG0BjOFP>xz4jtv3LS>jz#1x~b9u1*n9>Y6?u8W?I^~;N{GC<1y} zc&Wz{L`kJUSt=oA=5ZHtNj3PSB%w5^=0(U7GC^zUgcdkujo>ruzyBurtTjKuNf1-+ zzn~oZFXCbR&xq&W{ar~T`@fNef5M$u^-C92HMBo=*``D8Q^ktX z(qT{_R=*EI?-R9nNUFNR#{(Qb;27bM14bjI`c#4RiinHbnS445Jy^%krK%kpE zFw%RVQd6kqsNbiBtH*#jiPu3(%}P7Vhs0G9&Dwb4E-hXO!|whZ!O$J-PU@j#;GrzN zwP9o=l~Nv}4OPvv5rVNoFN>Oj0TC%P>ykicmFOx*dyCs@7XBH|w1k2hb`|3|i^GEL zyg7PRl9eV ztQ1z)v~NwH$ebcMSKc-4D=?G^3sKVG47ZWldhR@SHCr}SwWuj5t!W$&HAA*Wo_9tM zw5vs`2clw`z@~R-#W8d4B8!rFtO}+-$-{6f_`O-^-EhGraqg%$D618&<9KG``D|Rb zQJ&TSE3cfgf8i}I^DLu+-z{{;QM>K3I9~3R9!0~=Y`A1=6`CF#XVH@MWO?3@xa6ev zdw08_9L=>3%)iXA(_CE@ipRQ{Tb+@mxoN^3ktgmt^mJ(u#=_Plt?5qMZOA3&I1&NU zOG+0XTsIkbhGsp(ApF2MphRG^)>vqagn!-%pRnppa%`-l@DLS0KUm8*e9jGT0F%0J z*-6E@Z*YyeZ{eP7DGmxQedo}^+w zM~>&E$5&SW6MxP##J56Eo@0P34XG})MLCuhMyDFf**?tziO?_Ad&Jhd z`jok^B{3ff*7cydrxYjdxX`14`S+34kW^$fxDmNn2%fsQ6+Zou0%U{3Y>L}UIbQbw z*E#{Von}~UEAL?vvihW)4?Kr-R?_?JSN?B?QzhUWj==1VNEieTMuTJ#-nl*c@qP+` zGk@aE0oAD5!9_fO=tDQAt9g0rKTr{Z0t~S#oy5?F3&aWm+igqKi| zK9W3KRS|1so|~dx%90o9+FVuN7)O@by^mL=IX_m^M87i&kT1^#9TCpI@diZ_p$uW3 zbA+-ER9vJ{ii?QIZF=cfZT3#vJEKC|BQhNd zGmxBDLEMnuc*AET~k8g-P-K+S~_(+GE9q6jyIMka(dr}(H% z$*z;JDnyI@6BQ7KGcrv03Hn(abJ_-vqS>5~m*;ZJmH$W`@csQ8ejiC8S#sYTB;AoF zXsd!kDTG#3FOo-iJJpd$C~@8}GQJ$b1A85MXp?1#dHWQu@j~i4L*LG40J}+V=&-(g zh~Hzk(l1$_y}PX}Ypluyiib0%vwSqPaJdy9EZ;?+;lFF8%Kb7cwPD17C}@N z2OF;}QCM4;CDx~d;XnunQAx5mQbL#);}H57I+uB9^v|cmZwuXGkoH-cAJ%nIjSO$E z{BpYdC9poyO5pvdL+ZPWFuK}c8WGEq-#I3myONq^BL%uG`RIoSBTEK9sAeU4UBh7f zzM$s|&NtAGN&>`lp5Ruc%qO^oL;VGnzo9A8{fQn@YoORA>qw;^n2pydq>;Ji9(sPH zLGsEeTIH?_6C3uyWoW(gkmM(RhFkiDuQPXmL7Oes(+4)YIHt+B@i`*%0KcgL&A#ua zAjb8l_tO^Ag!ai3f54t?@{aoW%&Hdst}dglRzQlS=M{O!=?l z*xY2vJ?+#!70RO8<&N^R4p+f=z z*&_e}QT%6-R5Wt66moGfvorp$yE|3=-2_(y`FnL0-7A?h%4NMZ#F#Rcb^}971t5ib zw<20w|C?HVv%|)Q)Pef8tGjwQ+!+<{>IVjr@&SRVO*PyC?Efnsq;Eq{r;U2)1+tgp z)@pZ}gJmzf{m=K@7YA_8X#XK+)F465h%z38{V-K8k%&_GF+g^s&9o6^B-&|MDFI)H zj1ofQL>W(MJLOu3xkkJZV@$}GEG~XBz~WvRjxhT0$jKKZKjuKi$rmR-al}Hb3xDL) z^xGG2?5+vUAo4I;$(JgeVQe9+e)vvJ={pO~05f|J={%dsSLVcF>@F9p4|nYK&hMua zWjNvRod}l~WmGo|LX2j#w$r$y?v^H?Gu(_?(WR_%D@1I@$yMTKqD=Ca2) zWBQmx#A$gMrHe^A8kxAgB}c2R5)14G6%HfpDf$(Di|p8ntcN;Hnk)DR1;toC9zo77 zcWb?&&3h65(bLAte%hstI9o%hZ*{y=8t$^!y2E~tz^XUY2N2NChy;EIBmf(Kl zfU~&jf*}p(r;#MP4x5dI>i`vjo`w?`9^5(vfFjmWp`Ch!2Ig}rkpS|T%g@2h-%V~R zg!*o7OZSU-%)M8D>F^|z+2F|!u1mOt?5^zG%;{^CrV^J?diz9AmF!UsO?Pl79DKvD zo-2==yjbcF5oJY!oF?g)BKmC8-v|iL6VT|Gj!Gk5yaXfhs&GeR)OkZ}=q{exBPv)& zV!QTQBMNs>QQ))>(rZOn0PK+-`|7vKvrjky3-Kmuf8uJ`x6&wsA5S(tMf=m;79Hzv za%lZ(OhM&ZUCHtM~FRd#Uk3Iy%oXe^)!Jci39D(a$51WER+%gIZYP)!}nDtDw_FgPL3e>1ilFN=M(j~V` zjOtRhOB8bX8}*FD0oy}+s@r4XQT;OFH__cEn-G#aYHpJDI4&Zo4y2>uJdbPYe zOMGMvbA6#(p00i1{t~^;RaHmgZtE@we39mFaO0r|CJ0zUk$|1Pp60Q&$A;dm>MfP# zkfdw?=^9;jsLEXsccMOi<+0-z|NZb(#wwkcO)nVxJxkF3g(OvW4`m36ytfPx5e-ujFXf($)cVOn|qt9LL zNr!InmcuVkxEg8=_;E)+`>n2Y0eAIDrklnE=T9Pyct>^4h$VDDy>}JiA=W9JE79<6 zv%hpzeJC)TGX|(gP!MGWRhJV}!fa1mcvY%jC^(tbG3QIcQnTy&8UpPPvIekWM!R?R zKQanRv+YZn%s4bqv1LBgQ1PWcEa;-MVeCk`$^FLYR~v%9b-@&M%giqnFHV;5P5_et z@R`%W>@G<6GYa=JZ)JsNMN?47)5Y3@RY`EVOPzxj;z6bn#jZv|D?Fn#$b}F!a}D9{ ztB_roYj%34c-@~ehWM_z;B{G5;udhY`rBH0|+u#!&KLdnw z;!A%tG{%Ua;}OW$BG`B#^8#K$1wX2K$m`OwL-6;hmh{aiuyTz;U|EKES= z9UsxUpT^ZZyWk0;GO;Fe=hC`kPSL&1GWS7kGX0>+votm@V-lg&OR>0*!Iay>_|5OT zF0w~t01mupvy4&HYKnrG?sOsip%=<>nK}Bxth~}g)?=Ax94l_=mC{M@`bqiKtV5vf zIP!>8I;zHdxsaVt9K?{lXCc$%kKfIwh&WM__JhsA?o$!dzxP znoRU4ZdzeN3-W{6h~QQSos{-!W@sIMaM z4o?97?W5*cL~5%q+T@>q%L{Yvw(a2l&68hI0Ra*H=ZjU!-o@3(*7hIKo?I7$gfB(Vlr!62-_R-+T;I0eiE^><*1_t|scfB{r9+a%UxP~CBr zl1!X^l01w8o(|2da~Mca)>Mn}&rF!PhsP_RIU~7)B~VwKIruwlUIlOI5-yd4ci^m{ zBT(H*GvKNt=l7a~GUco)C*2t~7>2t?;V{gJm=WNtIhm4x%KY>Rm(EC^w3uA{0^_>p zM;Na<+I<&KwZOUKM-b0y6;HRov=GeEi&CqEG9^F_GR*0RSM3ukm2c2s{)0<%{+g78 zOyKO%^P(-(U09FO!75Pg@xA{p+1$*cD!3=CgW4NO*p}&H8&K`(HL&$TH2N-bf%?JL zVEWs;@_UDD7IoM&P^(k-U?Gs*sk=bLm+f1p$ggYKeR_7W>Zz|Dl{{o*iYiB1LHq`? ztT)b^6Pgk!Kn~ozynV`O(hsUI52|g{0{cwdQ+=&@$|!y8{pvUC_a5zCemee6?E{;P zVE9;@3w92Nu9m_|x24gtm23{ST8Bp;;iJlhaiH2DVcnYqot`tv>!xiUJXFEIMMP(ZV!_onqyQtB_&x}j9 z?LXw;&z%kyYjyP8CQ6X);-QW^?P1w}&HgM}irG~pOJ()IwwaDp!i2$|_{Ggvw$-%K zp=8N>0Fv-n%W6{A8g-tu7{73N#KzURZl;sb^L*d%leKXp2Ai(ZvO96T#6*!73GqCU z&U-NB*0p@?f;m~1MUN}mfdpBS5Q-dbhZ$$OWW=?t8bT+R5^vMUy$q$xY}ABi60bb_ z9;fj~2T2Ogtg8EDNr4j96{@+9bRP#Li7YDK1Jh8|Mo%NON|bYXi~D(W8oiC2SSE#p z=yQ0EP*}Z)$K$v?MJp8s=xroI@gSp&y!De;aik!U7?>3!sup&HY{6!eElc+?ZW*|3 zjJ;Nx>Kn@)3WP`{R821FpY6p1)yeJPi6yfq=EffesCZjO$#c;p!sc8{$>M-i#@fCt zw?GQV4MTSvDH(NlD2S*g-YnxCDp*%|z9^+|HQ(#XI0Pa8-Io=pz8C&Lp?23Y5JopL z!z_O3s+AY&`HT%KO}EB73{oTar{hg)6J7*KI;_Gy%V%-oO3t+vcyZ?;&%L z3t4A%Ltf=2+f8qITmoRfolL;I__Q8Z&K9*+_f#Sue$2C;xTS@%Z*z-lOAF-+gj1C$ zKEpt`_qg;q^41dggeNsJv#n=5i+6Wyf?4P_a=>s9n(ET_K|*zvh633Mv3Xm3OE!n` zFk^y65tStyk4aamG*+=5V^UePR2e0Fbt7g$({L1SjOel~1^9SmP2zGJ)RZX(>6u4^ zQ78wF_qtS~6b+t&mKM=w&Dt=k(oWMA^e&V#&Y5dFDc>oUn+OU0guB~h3};G1;X=v+ zs_8IR_~Y}&zD^=|P;U_xMA{Ekj+lHN@_n-4)_cHNj0gY4(Lx1*NJ^z9vO>+2_lm4N zo5^}vL2G%7EiPINrH-qX77{y2c*#;|bSa~fRN2)v=)>U@;YF}9H0XR@(+=C+kT5_1 zy?ZhA&_&mTY7O~ad|LX+%+F{GTgE0K8OKaC2@NlC1{j4Co8;2vcUbGpA}+hBiDGCS zl~yxngtG}PI$M*JZYOi{Ta<*0f{3dzV0R}yIV7V>M$aX=TNPo|kS;!!LP3-kbKWj` zR;R%bSf%+AA#LMkG$-o88&k4bF-uIO1_OrXb%uFp((Pkvl@nVyI&^-r5p}XQh`9wL zKWA0SMJ9X|rBICxLwhS6gCTVUGjH&)@nofEcSJ-t4LTj&#NETb#Z;1xu(_?NV@3WH z;c(@t$2zlY@$o5Gy1&pvja&AM`YXr3aFK|wc+u?%JGHLRM$J2vKN~}5@!jdKBlA>;10A(*-o2>n_hIQ7&>E>TKcQoWhx7um zx+JKx)mAsP3Kg{Prb(Z7b};vw&>Tl_WN)E^Ew#Ro{-Otsclp%Ud%bb`8?%r>kLpjh z@2<($JO9+%V+To>{K?m76vT>8qAxhypYw;Yl^JH@v9^QeU01$3lyvRt^C#(Kr#1&2 ziOa@LG9p6O=jO6YCVm-d1OB+_c858dtHm>!h6DUQ zj?dKJvwa2OUJ@qv4!>l1I?bS$Rj zdUU&mofGqgLqZ2jGREYM>;ubg@~XE>T~B)9tM*t-GmFJLO%^tMWh-iWD9tiYqN>eZ zuCTF%GahsUr#3r3I5D*SaA75=3lfE!SpchB~1Xk>a7Ik!R%vTAqhO z#H?Q}PPN8~@>ZQ^rAm^I=*z>a(M4Hxj+BKrRjJcRr42J@DkVoLhUeVWjEI~+)UCRs zja$08$Ff@s9!r47##j1A5^B6br{<%L5uW&8t%_te(t@c|4Fane;UzM{jKhXfC zQa|k^)d*t}!<)K)(nnDxQh+Q?e@YftzoGIIG?V?~$cDY_;kPF>N}C9u7YcZzjzc7t zx3Xi|M5m@PioC>dCO$ia&r=5ZLdGE8PXlgab`D}>z`dy(+;Q%tz^^s*@5D)gll+QL z6@O3@K6&zrhitg~{t*EQ>-YN zy&k{89XF*^mdeRJp{#;EAFi_U<7}|>dl^*QFg**9wzlA#N9!`Qnc68+XRbO-Za=t zy@wz`mi0MmgE?4b>L$q&!%B!6MC7JjyG#Qvwj{d8)bdF`hA`LWSv+lBIs(3~hKSQ^0Se!@QOt;z5`!;Wjy1l8w=(|6%GPeK)b)2&Ula zoJ#7UYiJf>EDwi%YFd4u5wo;2_gb`)QdsyTm-zIX954I&vLMw&_@qLHd?I~=2X}%1 zcd?XuDYM)(2^~9!3z)1@hrW`%-TcpKB1^;IEbz=d0hv4+jtH;wX~%=2q7YW^C67Fk zyxhyP=Au*oC7n_O>l)aQgISa=B$Be8x3eCv5vzC%fSCn|h2H#0`+P1D*PPuPJ!7Hs z{6WlvyS?!zF-KfiP31)E&xYs<)C03BT)N6YQYR*Be?;bPp>h?%RAeQ7@N?;|sEoQ% z4FbO`m}Ae_S79!jErpzDJ)d`-!A8BZ+ASx>I%lITl;$st<;keU6oXJgVi?CJUCotEY>)blbj&;Qh zN*IKSe7UpxWPOCl1!d0I*VjT?k6n3opl8el=lonT&1Xt8T{(7rpV(?%jE~nEAx_mK z2x=-+Sl-h<%IAsBz1ciQ_jr9+nX57O=bO_%VtCzheWyA}*Sw!kN-S9_+tM}G?KEqqx1H036ELVw3Ja0!*Kr-Qo>)t*?aj2$x;CajQ@t`vbVbNp1Oczu@ zIKB+{5l$S;n(ny4#$RSd#g$@+V+qpAU&pBORg2o@QMHYLxS;zGOPnTA`lURgS{%VA zujqnT8gx7vw18%wg2)A>Kn|F{yCToqC2%)srDX&HV#^`^CyAG4XBxu7QNb(Ngc)kN zPoAhkoqR;4KUlU%%|t2D8CYQ2tS2|N#4ya9zsd~cIR=9X1m~a zq1vs3Y@UjgzTk#$YOubL*)YvaAO`Tw+x8GwYPEqbiAH~JNB?Q@9k{nAuAbv)M=kKn zMgOOeEKdf8OTO|`sVCnx_UqR>pFDlXMXG*KdhoM9NRiwYgkFg7%1%0B2UWn_9{BBW zi(Ynp7L|1~Djhg=G&K=N`~Bgoz}Bu0TR6WsI&MC@&)~>7%@S4zHRZxEpO(sp7d)R- zTm)))1Z^NHOYIU?+b2HZL0u1k>{4VGqQJAQ(V6y6+O+>ftKzA`v~wyV{?_@hx>Wy# zE(L|zidSHTux00of7+wJ4YHnk%)G~x)Cq^7ADk{S-wSpBiR2u~n=gpqG~f=6Uc7^N zxd$7)6Cro%?=xyF>PL6z&$ik^I_QIRx<=gRAS8P$G0YnY@PvBt$7&%M`ao@XGWvuE zi5mkN_5kYHJCgC;f_Ho&!s%CF7`#|B`tbUp4>88a8m$kE_O+i@pmEOT*_r0PhCjRvYxN*d5+w5 z<+S)w+1pvfxU6u{0}0sknRj8t^$uf?FCLg<%7SQ-gR~Y6u|f!Abx5U{*KyZ8o(S{G znhQx#Zs_b8jEk`5jd9CUYo>05&e69Ys&-x_*|!PoX$msbdBEGgPSpIl93~>ndH;t5 z?g>S+H^$HtoWcj4>WYo*Gu;Y#8LcoaP!HO?SFS&F9TkZnX`WBhh2jea0Vy%vVx~36 z-!7X*!Tw{Zdsl3qOsK&lf!nnI(lud){Cp$j$@cKrIh@#?+cEyC*m$8tnZIbhG~Zb8 z95)0Fa=3ddJQjW)9W+G{80kq`gZT`XNM=8eTkr^fzdU%d5p>J}v#h&h$)O+oYYaiC z7~hr4Q0PtTg(Xne6E%E@0lhv-CW^o0@EI3>0ZbxAwd2Q zkaU2c{THdFUnut_q0l+0DpJ5KMWNTa^i@v%r`~}fxdmmVFzq6{%vbv?MJ+Q86h6qf zKiGz6Vrb>!7)}8~9}bEy^#HSP)Z^_vqKg2tAfO^GWSN3hV4YzUz)N3m`%I&UEux{a z>>tz9rJBg(&!@S9o5=M@E&|@v2N+w+??UBa3)CDVmgO9(CkCr+a1(#edYE( z7=AAYEV$R1hHyNrAbMnG^0>@S_nLgY&p9vv_XH7|y*X)!GnkY0Fc_(e)0~)Y5B0?S zO)wZqg+nr7PiYMe}!Rb@(l zV=3>ZI(0z_siWqdi(P_*0k&+_l5k``E8WC(s`@v6N3tCfOjJkZ3E2+js++(KEL|!7 z6JZg>9o=$0`A#$_E(Rn7Q78lD1>F}$MhL@|()$cYY`aSA3FK&;&tk3-Fn$m?|G11= z8+AqH86^TNcY64-<)aD>Edj$nbSh>V#yTIi)@m1b2n%j-NCQ51$9C^L6pt|!FCI>S z>LoMC0n<0)p?dWQRLwQC%6wI02x4wAos$QHQ-;4>dBqO9*-d+<429tbfq7d4!Bz~A zw@R_I;~C=vgM@4fK?a|@=Zkm=3H1<#sg`7IM7zB#6JKC*lUC)sA&P)nfwMko15q^^TlLnl5fY75&oPQ4IH{}dT3fc% z!h+Ty;cx9$M$}mW~k$k(($-MeP_DwDJ zXi|*ZdNa$(kiU?}x0*G^XK!i{P4vJzF|aR+T{)yA8LBH!cMjJGpt~YNM$%jK0HK@r z-Au8gN>$8)y;2q-NU&vH`htwS%|ypsMWjg@&jytzR(I|Tx_0(w74iE~aGx%A^s*&- zk#_zHpF8|67{l$Xc;OU^XI`QB5XTUxen~bSmAL6J;tvJSkCU0gM3d#(oWW$IfQXE{ zn3IEWgD|FFf_r2i$iY`bA~B0m zA9y069nq|>2M~U#o)a3V_J?v!I5Y|FZVrj|IbzwDCPTFEP<}#;MDK$4+z+?k5&t!TFS*)Iw)D3Ij}!|C2=Jft4F4=K74tMRar>_~W~mxphIne& zf8?4b?Aez>?UUN5sA$RU7H7n!cG5_tRB*;uY!|bNRwr&)wbrjfH#P{MU;qH>B0Lf_ zQL)-~p>v4Hz#@zh+}jWS`$15LyVn_6_U0`+_<*bI*WTCO+c&>4pO0TIhypN%y(kYy zbpG4O13DpqpSk|q=%UyN5QY2pTAgF@?ck2}gbs*@_?{L>=p77^(s)ltdP1s4hTvR# zbVEL-oMb~j$4?)op8XBJM1hEtuOdwkMwxzOf!Oc63_}v2ZyCOX3D-l+QxJ?adyrSiIJ$W&@WV>oH&K3-1w<073L3DpnPP)xVQVzJG{i)57QSd0e;Nk z4Nk0qcUDTVj@R-&%Z>&u6)a5x3E!|b;-$@ezGJ?J9L zJ#_Lt*u#&vpp2IxBL7fA$a~aJ*1&wKioHc#eC(TR9Q<>9ymdbA?RFnaPsa)iPg7Z; zid$y8`qji`WmJ5nDcKSVb}G$9yOPDUv?h1UiI_S=v%J8%S<83{;qMd0({c8>lc=7V zv$okC+*w{557!ohpAUMyBHhKLAwzs&D11ENhrvr_OtsnS!U{B+CmDH-C=+po+uSqt z+WVVXl8fKe5iCZoP;>}4OVen6_|uw8*ff-r;)O2W+6p7BPT7sT<|Qv=6lgV#3`Ch${(-Wy#6NA$YanDSFV_3aa=PAn%l@^l(XxVdh!TyFFE&->QRkk@GKyy( zC3N%PhyJf^y9iSI;o|)q9U-;Akk>;M>C8E6=3T!vc?1( zyKE(2vV5X_-HDSB2>a6LR9MvCfda}}+bZ>X z+S(fTl)S})HZM`YM`uzRw>!i~X71Kb^FnwAlOM;!g_+l~ri;+f44XrdZb4Lj% zLnTNWm+yi8c7CSidV%@Y+C$j{{Yom*(15277jE z9jJKoT4E%31A+HcljnWqvFsatET*zaYtpHAWtF|1s_}q8!<94D>pAzlt1KT6*zLQF z+QCva$ffV8NM}D4kPEFY+viR{G!wCcp_=a#|l?MwO^f4^EqV7OCWWFn3rmjW=&X+g|Pp(!m2b#9mg zf|*G(z#%g%U^ET)RCAU^ki|7_Do17Ada$cv$~( zHG#hw*H+aJSX`fwUs+fCgF0bc3Yz3eQqR@qIogSt10 znM-VrdE@vOy!0O4tT{+7Ds-+4yp}DT-60aRoqOe@?ZqeW1xR{Vf(S+~+JYGJ&R1-*anVaMt_zSKsob;XbReSb02#(OZ z#D3Aev@!944qL=76Ns-<0PJ;dXn&sw6vB9Wte1{(ah0OPDEDY9J!WVsm`axr_=>uc zQRIf|m;>km2Ivs`a<#Kq@8qn&IeDumS6!2y$8=YgK;QNDcTU}8B zepl6erp@*v{>?ixmx1RS_1rkQC<(hHfN%u_tsNcRo^O<2n71wFlb-^F2vLUoIfB|Hjxm#aY&*+um7eR@%00 zR;6vT(zb2ewr$(CwbHgKRf#X(?%wBgzk8qWw=d@1x>$40h?wIUG2;Jxys__b)vnPF z{VWvLyXGjG4LRo}MH@AP-GOti6rPu^F04vaIukReB|8<7&5cebX<)Zk(VysCOLBuL zW9pEvRa--4vwT?k6P??+#lGMUYE;EsaU~=i_|j!1qCVS_UjMVhKT%CuovR;6*~rP0)s5eX zxVhGZv+qtpZ{_FDf9p{m`ravh=h>mPMVR7J-U@%MaAOU2eY@`s-M3Oi>oRtT?Y&9o({nn~qU4FaEq|l^qnkXer)Cf0IZw;GaBt)}EIen=1lqeg zAHD~nbloktsjFh&*2iYVZ=l1yo%{RK#rgTg8a2WRS8>kl03$CS(p3}E-18`!UpyOg zcH=`UYwn0b@K1`E&aQ%*riO|F-hq;S;kE7UwYd~Ox(u)>VyaE7DA6h_V3_kW2vAR} zBZi_RC*l3!t;JPD;<*z1FiZt;=KK-xuZ`j>?c5oxC^E2R=d`f68!-X=Xw2ONC@;@V zu|Svg4StiAD$#wGarWU~exyzzchb#8=V6F<6*nAca@x}!zXN}k1t78xaOX1yloahl zC4{Ifib;g}#xqD)@Jej<+wsP+JlAn)&WO=qSu>9eKRnm6IOjwOiU=bzd;3R{^cl5* zc9kR~Gd9x`Q$_G^uwc4T9JQhvz3~XG+XpwCgz98Z>Pez=J{DD)((r(!ICFKrmR-;} zL^`7lPsSmZT?p&QpVY&Ps~!n($zaAM8X@%z!}!>;B|CbIl!Y={$prE7WS)cgB{?+| zFnW-KRB-9zM5!L+t{e~B$5lu-N8Yvbu<+|l;OcJH_P;}LdB~2?zAK67?L8YvX})BM zW1=g!&!aNylEkx#95zN~R=D=_+g^bvi(`m0Cxv2EiSJ>&ruObdT4&wfCLa2Vm*a{H z8w@~1h9cs&FqyLbv7}{R)aH=Bo80E3&u_CAxNMrTy_$&cgxR10Gj9c7F~{hm#j+lj z#){r0Qz?MaCV}f2TyRvb=Eh|GNa8M(rqpMPVxnYugYHqe!G`M@x(;>F%H46LGM_cU z{*0k6-F!7r3;j{KOaDxrV16WUIiFAfcx?^t*}ca4B8!-d?R|$UxwV8tyHdKL zhx;7%0Zn#qtx;S)REtEP-meAlV8*1qGFbRJ*eeX&+hsiLF*g9%r0Zl`L^Kn`4I)ul z32#3pg6Mu$LEI@hssUb?T$di_z zHgaB3zw;*0Lnzo$a~T_cFT&y%rdb*kR`|6opI#Pbq~F%t%*KnyUNu|G?-I#~C=i#L zEfu}ckXK+#bWo11e+-E$oobK=nX!q;YZhp}LSm6&Qe-w0XCN{-KL}l?AOUNppM-)A zyTRT@xvO=k&Zj|3XKebEPKZrJDrta?GFKYrlpnSt zA8VzCoU+3vT$%E;kH)pzIV7ZD6MIRB#w`0dViS6g^&rI_mEQjP!m=f>u=Hd04PU^cb>f|JhZ19Vl zkx66rj+G-*9z{b6?PBfYnZ4m6(y*&kN`VB?SiqFiJ#@hegDUqAh4f!+AXW*NgLQGs z>XrzVFqg&m>FT^*5DAgmMCMuFkN4y*!rK^eevG!HFvs7nC672ACBBu5h(+#G@{0J- zPLsJ{ohQEr2N|PmEHw9 znQ`qe-xyv93I;Ym=WnoVU8dau&S^(*Wp=}PSGw;&DtaKz-);y)zjD|@-RT`*6nowj z7B%)h3>Lro-}5THC@BLymuL&3~kh8M}ZrZGtYKAmrT^cym$^O!$eeK$q5X2JF1w5a}4Z6yJ<=8&J?(m6U?;+ z{+*B;P@yGffMz;OSfm7NDhkGR5|7&~FNvel8Yj{F!DWnHG>%?ReZ$1w5I$Bt_u|4v z-ow>!SF!pCGrD&K8=-<;Gp@oB<@9C&%>vPHrp4sQEJj2FdedjC=0FqD>EG?NCf=KQKVd^stDZP7KNCAP-uEO*!?vgwvdp&Dm3h5Cldn!cIOL@u>1!HSfK+~kn-9Ekr|MWNApAJCJ5&5#izmjm z$CI|Boo@;O?Z(Bo9ejP>bbH|jRKn7W3y0L1!O6v$RUtt;%5R#**`+39c$JuO`SMU+ zbzu$7Eu`JQ+ri_ap{w(R_juHcw0X8~e$48TzBX%Yd+HkSSYt2){)+rYm48G^^G#W* zFiC0%tJs0q3%fX_Mt8A=!ODeM?}KLDt@ot6_%aAdLgJ7jCqh_1O`#DT`IGhP2LIMhF* z=l?}r%Tl#)!CpcItYE2!^N8bo`z9X(%0NK9Dgg^cA|rsz?aR+dD6=;#tvNhT5W}1; zFG@_F2cO&7Pdp1;lJ8?TYlI(VI8nbx_FIGRX^Z(d zyWyJi58uPgr>8w$ugIGhX1kr*po@^F>fntO1j&ocjyK za8Z*GGvQt+q~@R@Y=LdQt&v=8-&4WOU^_-YOuT9Fx-H7c;7%(nzWD(B%>dgQ^ zU6~0sR24(ANJ?U>HZ#m8%EmD1X{uL{igUzdbi+JN=G9t`kZMGk!iLCQQiVMhOP&(*~gU(d+&V4$(z=>4zqh(GX+9C&;~g2 z9K2$`gyTRJpG_)fYq=9sG^1I{*I=s%0NX^}8!mJVc?y$OYM^n!x(2jw$$;}n&dh%D;St+FA;eW=+28j#G^YLi@Gdk*H#r-#6u?7sF7#_pv?WS^K7feY1F^;!;$rgU%J zS$lZ(hmo$F>zg$V^`25cS|=QKO1Qj((VZ;&RB*9tS;OXa7 zy(n<$4O;q>q5{{H>n}1-PoFt;=5Ap+$K8LoiaJV7w8Gb%y5icLxGD~6=6hgYQv`ZI z2Opn57nS-1{bJUr(syi^;dv+XcX8?rQRLbhfk1py8M(gkz{TH#=lTd;K=dr!mwk2s z#XnC){9$x)tjD0cUQ90|hE2BkJ9+_tIVobRGD6OQ-uKJ#4fQy!4P;tSC6Az)q?c>E zXt(59YUKD?U}Ssn(3hs&fD$i3I*L_Et-%lx%HDe%#|)*q+ZM-v%Ds3u1LPpPKe-q} zc!9Rt)FvptekA2s+NXxF7I;sH1CNPpN@RT+-*|6h*ZWL{jgu9vth{q)u=E<7D(F06 zN~UUfzhsK)`=W%Z-vr#IIVwmdb(q7k+FX-lciYO%NE!xl25SV53Hwdql-3>8y5X1U zWa3_Qfp2Z;jVX+N+1?`(dx-EJL)%oQsI0G3S=ad&v{dzNal~flHvq(0HjY!v;oE>n z4gQSa2FdJI52Weu$+lED4VYSW;D`5Zn`C#@7Hxa1Ls*#TLBjje(%NYFF+4uOc~dK! zlnyxE4NWVz0c8yx`=sP2t)fHW(PPKZPp{SCwT-on2sEM9tyGO4AW7|R;Iw5|n1KpV zR^S>`h}rxcNv2u+7H6rCvMLMV3p*H#WcN}}t0@Us{w}{20i<-v> zyos+Ev_>@CA**@JrZ6Jzm=pWd6ys`c!7-@jf<~3;!|A_`221MFp-IPg28ABf6kj-Y#eaRcQ!t!|0SRtkQK^pz;YiTC@@lJ4MDpI(++=}nTC zRb4Ak&K16t*d-P(s5zPs+vbqk1u>e5Y&a!;cO(x;E4A4}_Cgp_VoIFwhA z-o^7)=BRYu)zLT8>-5os4@Ss8R&I^?#p?bY1H-c;$NNdXK%RNCJHh)2LhC?B9yL2y z(P-1t9f~NV0_bQ{4zF|-e^9LG9qqevchug76wtFn95+@{PtD)XESnR2u}QuG0jYoh z0df4#&dz_FStgOPG0?LVGW&{znCUzHU%*b1f~F+)7aefg7_j76Vb|2WuG#1oYH_~4 zrzy#g1WMQ#gof`)Ar((3)4m3mARX~3(Ij=>-BC zR@&7dF70|)q>tI$wIr?&;>+!pE`i6CkomA1zEb&JOkmg9!>#z-nB{%!&T@S-2@Q)9 z)ekri>9QUuaHM{bWu&pZ+3|z@e2YjVG^?8F$0qad4oO9UI|R~2)ujGKZiX)9P2;pk z-kPg%FQ23x*$PhgM_1uIBbuz3YC z#9Rz(hzqTU{b28?PeO)PZWzB~VXM5)*}eUt_|uff_A8M4v&@iY{kshk{7dHX1vgHs zC%vd9vD^c;%!7NNz=JX9Q{?$~G@6h!`N>72MR*!Q{xE7IV*?trmw>3qWCP*?>qb01 zqe|3!Y0nv7sp|Md9c z4J5EJA%TD-;emh%|L2kLpA^g>)i56v6HIU8h7M+KSWYw~HHz3`ILj*{==jD(l33>r zmOdINZ8^Jo?ll^~q@{^5l#*3f`ETncJmo?iRLz*=W=o3MJ!K^xjVcw*H}p63#p4XX z1)|C%{Y&)IpRIk5oMVsUi6oyKAFy8MH$@|Zpjr^lxlMX3O{0AZTjc{gso{KRuo30V zUJxq2K=_CwV*Qx_D!hJCBTuQ}5oMNrWUBNVaa8zyMg5lrXgv8Zw@rm5NAcFplYa>P zmUNB>EB|r?#Z!Gq^`(HZl__UJ*K5 z=>`{UTlt0;Y+LmP1Wb19IWK(SIWDrqh=+K81c`t@BCS|2#@K0u5eEwQ7CG92=Axx4 zQ?CPaVE5!XY`2r!Ce@m(tRtB=&+c>a09WzP-Ys!~i;V0hEq}PU8n1a;bVbJ17rYW1 zjz|KkLZoO7-S6oQp_ocIzS43P@CJJxQ$k;$!fS3*V)m|VtBIEgCtU@W`AG9VMU_d znB-Zs3I)I(Wg=xj)Wcx03h}U3i5{D@*udPLg?Jx7dp&KEIwJiW=eh}Ps#FxbsS?F}7z<;<5RP6-UAD+_An$s3y-JAC zh{JlAX3e^CDJl1gJDbH`e=hD88ER_6+Mw8CwK&^|$BnzA|AvDV`#xF^z9b6iWb)0@ z+gir=oSUaVcJi%1k+9!pd`(3|h~4}!NM7NHPNV6rI(W4~Ie5 zl@(Xg2`OSq|HJRUg3qgr-c!}9@W?pEJXKtxP7f(aE2Es33gRSu#~XiCIpV-J;JLM{(@qK2wEvsi@6-9(cyXX!6YS0n7;TK0Ldf*JGmlvrF0 zGQ+Z509rmWa)O}r`z2W3!6u{^ZQrY`KR#VlTRmllG2v$R!7%B~IU@XnNi!E1qM$J8 z%{XFU4vy_*M0tKjDY3E*7N!d%&vnx5qr#=!IKWZfoRo8j=7ji1{xW?g^)A|7 zaaA5Rg6rwCF?y33Kz-90z!ze`@5N916S)(fHPa>{F`UEF8N5PTNjbo)PF5W_YLB*# z?o`qxQTIzokhSdBa1QGmn9b;O#g}y_4d*j*j`cx^bk(=%QwiFxlAhFSNhO0$g|ue> zDh=p|hUow5Knbclx8V;+^H6N_GHwOi!S>Qxv&}FeG-?F7bbOWud`NCE6Tv-~ud&PS6 z;F*l>WT4zvv39&RTmCZQLE67$bwxRykz(UkGzx}(C23?iLR}S-43{WT80c$J*Q`XT zVy-3mu&#j}wp^p0G%NAiIVP2_PN{*!R%t7*IJBVvWVD#wxNRyF9aXsIAl)YpxfQr$d%Rt20U@UE}@w?|8^FMT%k36 zcGi_Mw+vMvA@#}0SfIiy0KEKwQ|`iR++|PF2;LtiH7ea($I{z z32QPp-FlEQ**K_A@OC943z`Qy7wC~&v z*a`z;(`5(e#M|qb4bkN6sWR_|(7W~8<)GnX)cJAt``gu8gqP(AheO-SjJMYlQsGs0 z!;RBZwy>bfw)!(Abmna(pwAh^-;&+#$vChUEXs5QOQi8TZfgQHK$tspm+rc%ee0gy zjTq5y20IJ`i{ogd8l?~8Sbt^R_6Fx*!n6~Jl#rIt@w@qu2eHeyEKhrzqLtEPdFrzy z9*I^6dIZ z)8Gdw1V^@xGue9trS?=(#e5(O#tCJv9fRvP=`a{mnOTboq<-W$-ES7)!Xhi*#}R#6 zS&7hR(QeUetr=$Pt6uV%N&}tC;(iKI>U!y$j6RW&%@8W|29wXe@~{QlQ0OjzS;_>q z(B!=A71r|@CmR7eWdu9n0;OJ zP@VOOo#T+N$s{`3m`3Li+HA4owg&>YqCwsA5|E$b;J&v#6RbT$D!x$Yaflo92wU?A zvgD8g(aY`g7}Y2^2i31ocm&k9Km`NQipEsjU>MuRzD35*Jk7^Q(O;M32!gt1cEB@- zBOHd@@Qo{fQ^7o{FiNdS)_vTiP8toqZ`iNi^1-4(hp+s751}Tf34b z_UYQ1q0~*jIp9pRIpI8ue}$|~uu0#p>-y8t{yEwB(8yAjMXrJ{`{rp7*-wlh8&bso zHV`LnAF7Bw+w}Wm9ii3U@lEvcc-i$0&h+eUmlQuREzg!ao)ZjwThhqIKA})}akyX7 zcbuIw9K}9aUZ;hvAxk~rqpk?bYMWr-@b-pMTR8))ggQa$kBv=IinobKCR0?S&g*+Al2J`VR7he{}0Pu zae7LYa!OoTOk8?ma)M@Ta%NxQacV~KMw&)}fkmF7wvmagnTbWo))`Kofr)`-pNe99 zMnam7vRRs5LTXHWNqTzhfQo90dTdg<=@9teXaX2tyziuRI?UOxKZ5fmd%yNGf%Kis zEDdSxjSP&;Y#smYU$Dk>Sr0J42D)@hAo|7QaAGz(Qp*{d%{I-#UsBYP2*yY8d0&$4 zI^(l62Q-y4>!>S{ zn;iO%>={D42;(0h@P{>EZnIzpFV|^F%-OJADQz(1GpUqqg#t!*i zcK}eD_qV$RmK}-y_}f$Xy7B+hY~f4s{iCD7zq%C|SepGu`+>h6TI}dUGS3%oOYsZ0 z#rWTU&aeMhM%=(r(8kK@3rr|wW^MFE;dK5&^Z!>`JV{CWi^Gq?3jz~C-5hFFwLJ@e zSm3z9mnI+vIcF+RjyOL!VuZP3rJDjPSm4vYolnm)H;BIz!?dLyE0^5(pm)5*>2clW zaI^*Z;p6iGZW~Gr0(Eh+%8Jkz{S9{}=}Ewi6W0wF3|BbVb?CR2x>4xST?woP;Mz8L zDfs+0L9ga3jcM)zCC=`-ah9#oulxt9bZq9zH*fJK$bhT=%(2bPMY~}cPfTyE{_4p+ zc}3pPX`B04z+T>XwRQ4$(`U~037JrmN`)3F8vu_OcBE}M&B;1Vd%|I|1tni?f_b&$ z5wpdJ6F*oif)r=IzB$ytT72GuZi$y>H0p_#amQcJLZ^4KZySOUrRyXy3A2(i=$zB9 znZnGFLC34k?N@s@`)u8aZN({9Hfe}|^@Xk(TmCqNBR*Bter>opM!SGiDU8ShK6FNp zvod~z>Tj!GOXB^#R>6}_D@j67f5cNc#P;yMV}`S*A_OmXk_BIq3I$C}3M~aPU)agY zWC+0JA-)}O@e4XTtjzen&g=J0GIVNjG`_gS6ErXj3cGxeDN*4xEk0PNzfzO@6gb&N zB$S-WV-@efQWs%UX$AVjFN5M@8U>+?Mcqg?@=Z-R`~n~;mQGVJT_vBL|3^fHxZ?#T zE(Sd`8%2WHG)TcNaCHmv_Id%D+K}H3s&c`bxKs(_ScZzyCTpvU zHv~yhtKF9G{s+GC*7>_D@F+qEq@YmXiKTV(j#X7^?WpvIg!Yxi6uBAhh7<91{8vFL zfT?Y~vwmE;(WOL!V5Ag&#@U$mP~T=*#_ ze#QynX>tO#4IJqSj^UB>8ubSEn>Nk!Z?jZE01CJCYuY`1S3 zf%2eyXaWoAQUw)KYO;wi<&+R3_7E%h(7F?xq!8l>!^3Jqj_tNPrG= z+y2S-0j;(AilOo;>SCQu#;Cn?y4Eu za`??!yHz)qFH1Z(3KMqgn+B$&t+5s0zY|}<1kB^Q8FEAumh;^;Yr~amTx1K2%2JUk z@7uIE&0DVch|1R=ro5rjr)w!iU{_09PqfhnGqhAN^$^oz#wVNdTRQ!8^nF};4);Jz#=dTBTMMW7icnZ$dK1E0UEgP4&DNk9MFoKOhtAkVUR`d_vc!x zc|1mY&%{PBxepp^JPHmFDBQ8t@DD-3!C)-ZhGJt)?{)^0MvC%RzI;4}>XoOUF;6~j z{S20Ra%PaiGvM$pFbH;N6)b1J(N;{+Gp^^Qk34JAuPKH}Ap}fen!WlC5vrQ0$pnyq z5poi8VG>>PnGw2^-CY3XdG3<;|0xU}#WBPqn{mO=z0RwL=MXn3=;oA(1C@V^6F;ogwB4EBUpltu=)(MC@To2kSPbL zDdGz|C<@`&!MmQ*e>H>2Qkwa~K%;yZw;SnM<=qwNHu-Dh$r(}-d}T}u!=UOAkzvEOiZ6>{)t$$# zlAmjO$1)&1Zh^zdh8uhmZ>OBA1T4%s9Jex_y4|ifY_=XoX6UzpP;MuC5su(6%;)NI z4d#4aW<*)L6o7w?MY2+jRx6-3S4i zC(~)A`|)5(s?)pBvTfYjwvr@Z-Dx-F7uq}z#WJB6&}0TIi6sGXFWOxD!As%cUg)_A zI)sRCf-5kPBU|rVm0A{!s=W2){AJwvShr6Tsvbg|NrXi!7zoMde_n>-+XFX0fiQy~ zjRp|;6~pR()0a>ETtC7mZD|i$Emj!r-gq!yhAFdV1uR*M<4O?t83N1JRT~8Cy8Vha z+STlcw&CoCJt$k^#ar+~DBmvtC5tr{(>|W6wHq*NSE!^#8*rs>!oYj%fl9~Nu*d4t zdk!|mGJehKW8xJE5ZOcHRfp4plI+l1Pct;rK={=P`YH8&1hNW*YE)4yF2@wa7JFaL zLHJH6ZWc1j|nQ55Znh#>tV`!~N7lY_05Cq%|8I-yN}yf@EzDG zBL z(b0sjh+ui^*s(rg)=l8fU<%cPfba<7y?>}j3R83$2KHzWbVF*`!x^V8JY`D0itC?ZSTYH|w3lUD#$5G$@!v(Lphex2O1;%>w;Qh$t7YF3EjFuySPC$>~%EspW}@Ctn1Bghd5*HVJ=tZK~8oMiZ@9IxfFLSk~>p9cT9gOSPLyP!^bOah`U-6{}C_ zmyhS7S_-tYDm|9C6(Wu2Qe=*g5@{**z@#Ekz3Y{o7fw!^4z$yi z&=a^zmtOpsRO0lFr&c=khr)cL2v9LFKXRDdE}tWlOgpR%}oWHCeJ4;(9U_HeJYl! zwz$p|t6?#eCju@0{IF0gbk>So3C{Ror~JTpuOW!G@^?lBVrf zf?%rDK2E3x=xGC)J_lEk{(ESh-Uw*#k-n4l42f3oC3BJX0-2NMZo?P)-6y1v+?|+< zfFHX8(bw;H@;6K!?=!B#eZrkowcdn7)roPT=WM@MK?>T-cUa$oQdYp&3YRdWu~rhA z@rZKmqj8Ftz-*@`&iH|) zC(H;QiqYx4{Mz@rm`qs~*Ue~4EHM^J7i{QnL~t)O)tnwIQC;23p}TBoc=9rcuS!cQ zQgl)_F@t9{c)ESLtAcg1AbCXqVS%i1ZZRiy$*?Bu=r2ad13e|ZeWV=3pSL>YAk>X& zQZAY4kJD`CYrK-nNti&;uJ*e{cRILOFk@z?B@fNO(exjUhf!b=yuC`@(RS#ko1HA+ zOwsym7?F)}ufcD5&IV+qr+i7Mo3)6M2oI)*3?@-%ah^0rL#0PIn}XmOTP9Xsg5C;t zqkFe6yT##_ZG5KuhVQY)89LfWOeXpXVNWX2PmiRqq<$C!<^WlyO~Q=pk${$DsWY-7 zZ->4<+c@KPgKzKosGPF+&Q*>L>WaN6_FC~SP~3gH7bvg6>QgPzp`&QTpf3W>HjxDxj!y zZb`O;&XZzI2YJ4!^Mq5~Vz7lLv`StN|TSP@jdF}@9;ql?u*#Q+_E}~hak(3B%AQNq)t7PKgAWTYp>EJz^VIj67KcZ3^vvZ7{b;; zcOOArcAw2$T+$UwIib|pt3i#NAuP#3?Z@Oaz?Mt(H&u7HZu!03kV7`t5IRcf7hwck zf{Ujp*YsH;dvcW0q|=o$;z#Cg52;n5t1phY44To!sQ99h`iVzXd+v(L%?A$Ks|Ne; z7fby7IVUXqN8gzsnL-s?uIv>=Qh!qAxoe{fRaI&EcSGCTdggq-Qq?DU%SBOummO5cRa9NW}V>A0IH#pxch)!$2p8=^-XYjsB%$S$U5nI zlJEMBb!BZ_O4@87cEYUBH7}Y_MF$+(~gdf-!7)D-D)+O{*18TC{HGZFF+`%IPcmK{O{YxR> zSfJHSeQCChuPUAWe_x~gy*f!!wvt_tL-Dp=nUm+juu;4L6N1IIG4dsVMat#T^p7p1n*Tx2a!YaivBTqLsSJAF=kJej?@QWf)Y-8Ks>WkC456{B#hW-ML zI+f23(}F=MeSdbWQ>R98TOzv#Haw}ua+17H=P5|~#BDmoEPkzl#lBTvCoyj`XU|IS zHn?dXbq>rqUW8^kQN01zL~6!Vxn4!$Pu|F&#XbiF{{>T z)&khW&2Y?d8^jC|phWKQ4!CM9b66+l*HTdPm+)M|e5yT)I32Q~2ENVJ*ZH;JF^Y907{XNHLoQ+85J~!w@3h_5d04o=~|1 zCBAvjnXMn`S#qMkPZE}9#RX`%al{`J=oFKk(aJYT&Ss`4iBrXa_pQ=3lS1IUFA|Rr zgnh;c8nkGH)|*yyoUZ?tE1XKwkF$n6`sdkf^7)(wZ52xtm86N>o&&jG_@#ue(B`xPM|8oGz94>*kl17-|d^y0`D=&hScq6gGQ%Z6|LU zG@<~h-R{xW)y7k1x7XFw!TWW~HPC^bCO_;xG#A4he?=xkLjS=~U!uR+q>vqJxCN~J z+I}|P5RTv*qRT{k2N^Kz8OX*mz$hYR!aYq-f5bN4R4=omUVP19L|)EZq?O0#B9 z<3G&oAZ`UeIqZWlujz8UNNSK#{=_c`*(&TwlIr3ZpC0sfS5Jy?;t+&wb1g4Q91rRNiEt1|L zisgH;)V()S&(TSB|1yAxZLH%BY`nnhUw_6sz~zdKCCc!ZV*Ws6`U4u|CBpv4pYIX1 z5*)5C*N#D}gj<@pdZxtw!`5aFVQ^Jj?1W z+EsBx6>WV`%wnP@Fp{XlqFkbHf%LfCgIi_|w?uPPjHAgOF+lDnAb+WEB+i_53PFmu zj!=umx@ez9mVxC&jA_RtKRfQG>Cz`A77S2SpOt7%Rt*}fG|yO+2t7CMuK$^}D#i}k zZmO9yUwK6%!LbRsULVnxUxfxso5KFES=!WCm>y&YSR@0CS|iON0v59pkQ7dVA{j*+ zmcRtD@lxXuFq@#$DKKSal#ApSJLw58m_NIJ?z;eD3Z8u*-#}EaK zyG~L>-7laE`Y}{g#FPs9YA-wT4>X>xRNtTHp8_rhvWA|eJH(!o-G~C&tvHB9$UEJI{ngD>QjBz=wl~x-j1MB z4)L_#jZSvaQkbmVbN)4{#^r&ZmfhhV%?tet3`xJ;#jI}DsS94qc&s)#2kXv5pkt;K zaY6emqzF1JWMxI(7h}mk*MQ5C8WLAol60!DPj|u0jMrLTkU7G?ud**S@bYx-vp$+r zMVXWc4H}2=yF+YML9!k~LT(|<#By?F2bS~weMi9dD@DA&k#0e&MM1YT!qoQDeNLwB zA;{KvwSzP?-K(>@_b@4vTkIX7xwj}ckrusCw!k=#;Krt6;}3q4d*)?c{>I|C2I^4p zR(o48TqHbw?4Z`c`>?P{`cT;FpJoFW1wJ3IVO#5Q`wsB>o>zsRDDATmct`aaYQbTL zJVlHeok9_?w83#Z*J(_BMs-;N;mNeq{;f3S zSy{i5hNY5s`c#)~KhQZ{0_hNmrMD2b7CLC2+x#EmLcNa8V1Q=jz@e~VV)Yq!Z|$nv$TEG3j6K4opW+mH z3~z?*H$qobb652kQ}ZHFHUVj$%JAwS-Ie=Vh&Iivx3hjMCZ1k)4dRjdhxRb17P;Gz zZCsB4J=l1S8`O|(g!8c$aOMaYeUoCJj&n#kbDxe(^GQ)E)$Rq+i-wbPKeaQvL!`Y- zcL=QOLcWBdDq_`HLow9P5BG2EMY$v;w9cR$C{ zMv)5zrmYv!uzHFAxDI>aftAp&ad>GYoPt!d;A*$s)^6E5l5ct#&O7A0p^8J1ceXa) znIq{NgKbbOSC`6E_af2bCoI(gD@(krDr^mDVw>cRz3zJ^&9kbuf6)J@Cd#zbnko5m zdyD^j^!9J7`oH!u{~wlOl7jYM(OcdI^#*5Y>BjUumq_g&tx<#_pkzQL3{!g?50d=#eCov*uIw$N*glXJe1F{FuUF_wCElS)Z2X= z8&w0?WkCX%HfL)#n-m1tiLy!jDMqH$LikJF=#lu@k5%&vN zOEmQQ^n*t^76E;JhHPzQqbY0+m8GQ9;~dJLLZ@*sqVX0ui5yz%8Hyn87vqUisY_0- zDtUu5haWdOvDBOX9Y;=s;7ul^_xLxfU(?k(HStRfk0Ab!pY(scal?Nz{Qu?etFHNA ztD=60Y>dte)hUle1IUyYIFgMxgGpvx%Odv4q;WPV?Zj<0pph+zWMfSd=SIUcB_#7^ zgNlm4(v!WIBm4?kpvZnCvp?TXW7~Azs3LT8Gh<0Ew=&W*e+4X_xQ{(e+UCESTaWwz zd1ly>%|#A|W%fgeL_3gAwxjeb?Wi3rAR3U#9Rie*)dfz7YxUK;ex+a4F>@qyQAL0^ zZncndzG56R$F&?R4SOX>&%UDdBid6 zIn=GRfcto+s-%gMB)Wx7!_Z+SS)f3IG!&s%P2eNfHI6~E*=>e`^RpvJQY?T95IOKL zeX-_BCdRE#f06_QAoDyMH;#IIBnT#PWSOtks+PCo`04X-brsea32I~@X(Bwl*Q`$c z{Al@04k=Mmd0}}ts=u%dCO;qn-;qh>Hr7bB6!NOVxy@Yi#GK2vusj7iU9757HTqN~ zNMoKeZY}o)nA*{CqTTPKnWi*JgZFZj&EjD$V;O9zqHV#tB#r5Ur$V3To8iP-bO*Gl_d%qc2$SoU`Hu-6*hWbuWzAn(83_jZ%>P{PY3XVV!q$~ALE^GC( zdIGgR(HnV8Rn*P^7b8#AzONo*U_W}{Ne!=#*qNJIRZzapu_fOkvki(|8NDg>&D=OZ zL3G)1WS*8CFh`-sb*#8*hIN7WDjw6<$D&T|B>JPi`K!*5DF(O*^A+r*Jfnt))c8|M zQKtgEytAqpy@~XZGnVYMJmZSG0U~uvP?i*?DhgDOSYtx6s%6u*vL$SW87`&xJ9cmDLrPHI@G7Pb*cizPGf|!5th41a2ijel>Xfk3i?7Bd*{|)@>|ZBi zH6gO9a2Yd&_ZeKmNQC^e&S$cl!3D2oBCX)C;Ve{0qc|4+*fwK!x{=QYtb#3QD1|Yi z%r?t<$-Mjbli1fF(C?V&w#;Gq3-**PgsGPPsXN(0fb?pIDc{s6b<9{t%6D*47A9ZHlc4rEGU<}u;tiom3^lA-&)1i=j z|I#)cctK)AH-b2*a3Wm%Gt*;#GWjNF6q0q^Evid`6G2yhMg_4TaMUK&x*D*5+KtlF#!)86A7pn~&yvD-Rh%`@(o!Wc#9t=t;(9_y*(MWS;4cPU&cJcE+h} z6fZHrjH@7{6~n40#qgL(yA-oVrt;Kcu=fV1WQ0QY`_I8lVds$PYR7KDvhsTbkC8q6 zct`{-n;z2!($SBZ?;(ZMu1sY(VY)KJ@%p)!LEBL+M{ck-$kHEx=3N+%$#msc!LKD> z?(7`Owu6Iuf-Nb|5wFxCm}U)Du@JO|nHV?%8lk(y3x-=F_d}u8>#AU~iWtSD6|VuV&YM=#_v-HDjZ4mS|L2%K2K}Mhz zVb)f#Q>%4Du>|ea6cbNYrpi<6A!rSmbeh7+xGZ{-TPG);DG9qg=>9!44ScDdh49-_ z;|KUp*RQ-So$jyV%Ss5FnJa^|LYAl%8niBhd%(W!x$Rpq@pcp6(XF^fHFRF2KQP>$ zo@`Qi&QlkFxp%0@2)7RlN4+NzCWo{?_x}5$E?kh!!UM3Vg9R+=xPLWty|S}5Gt_qg z+-v~8k*0?Bf0^Q+IZS56Ny~Q$pap&c2NUt&f7P9P+zEz*>bOO!5J8(uhIJ#%lgMNl z3;y^@Yht z_Dko1D=J@nc@`zIXz6dWsr`Kdt!m8`gGlx59A(t5ZjDVmrsjl#0wT@It~$j=uGRM! z@XJK@Q})NA_sQpEZkNduP-h{cP|l+Qqwr{g--LeHY2&||4dJFD34ZCj7@+4ZH4}La zjfr1gHXr8j#ppOa+gkiuHYf$a+VGA${f!~LtdO!~|X+>{b zY8=`^(0d9`z1f!nNzD`;4&65cNlg)@h5m5oOj&gG%mslXlc+jou#n#`d_l6}hwB+CG5k*Sr36Yrz zP2B)Pq#G?*Iwb)FJiXU@lTvTrdR&WRpV8sUz(Sx3C%f;BHSLY@I$!TqSg!%IetroG zD$gu&K<>-imH@Bh&}f!zwO-`w8Dt>MMZ>8V@{X1g?!2BS0S;GtXTW(%@{L=6uC*fB znj>TvA9Cj80~Hn`A5GSVpyqA$*6rlEa`u=Z!{-DRtCo0{jnK|3KxpDEi3&^DwWNg4 z%|~wf=EtEq^ku$fbX{@*EYr&TP@j@?OyLdVKVk*&H23K=xzmgV8p0Y|jK+@cNaPE1 zovLSR73MssgV04G7S-h7L}ID!!8|-X7U6-7?t~caWg)yk6*s=m)9us~kZ7pC6I1+@ zd&wXWPx{8Z>47wN=yJJ;BgQ&`z)H7hxm}Jq_9GiAq)9R- z7(@1=H+oqdJ(YFEq(LiJW=s}h(Yx~}5%_cQ&3xV0VUT%{sXE!% zVMqItDE@pLL%E2I2<48s8InBVbnt|shpL|$wrvbdWe!LJMr$c+e86OWy77OJ6k_2&3KMqL9=QFd2QUVwwR8X*sgj}5OpiFWK zkiv)DX__mAlH9kRszqfgqLLvBrDbP&mL;Amd=_UXSF4&!?$+*0ZswW?9oH!-BQgjS z*IQf1yzUikvx`UPXLZi2UvHaGMOee-cPA0C5fni_Q zcj2Hhbit;RZ5t^!?2;o_*D4W$VcsfIc+m?Z?b!Uv2;-s&XYSCUiczc2-b0I0g-hNj z@xi1}g6j<*=Dr7UMa-%w&YN`cBbWT>BQ~p;QyS!^#eQ>q9dy!?Nrh+?bfo*_kEe;nyR%9=3OTAD90?RT8#Bk}X#Pkr(TqBF2&!V=` z^iWLr%Yk96POnG@bEb?cv#Uk)5}bP0=~;%g>Sm{t#hoNp#yeFj7UxuD?en)EXw2%= zTS`>YY)#O023TqIXj@8o2KAM29NQM4QH=;sYP$pcqtRoxg?ZK@CWy{=P7(uI7%TOp; zP-^!0wmMVv-f2E>6tEj7ZTG#-KaZMuUUgl1|nl&p%3Dc8tZ4 zW{0iAY38oin5YwiQlKRrH8RP-h95fX$>v!l2*6R~)3vTQ7V(gjstAxGVc>U<8Jwb) zPTqZIfoIV>X`vA2EuAW0Ghj||3;hwn0w`nHnL~5Xr-xuSDNmuyhoZWBBa|hf3)-7$ z6nhe93c?Vv(WT4=mKowy$9Fu8Y)h5yEW6z&zzB7;Yf(a|ei#jb>!ayFWo?MkgWxQK z47{-ws_k4#8xv#$x229MEUK#x*X1k=2QLLnaWhYREFj!ta9&)3I+w+wuB-hQ0SFLZ zlvuP9c*O0k+Bm_8bPyfY2o>Ts&0yRSIg4c@Rv71IVHGS{L3?%!54(HvY;tru5FCHC z9_ER%i7@?-Tq&gCLBVg_3g3?9Gu6P$T^70*)YqUQTN$IHtc4g5UG7WN_J&c!4-lZ& z0a=#~p%2D>Wvx?z(9bP0Z<&FgpEnI^CYsg{+)}t}Teb>kj&)7NNmPz4Zv@MJA2cA4 zE{uQ3IbdMxWrxK|%90Rdmx)yBJ3FI$YLuF4DF~35POQtBilKK{44PuvYIHjt?~mW& zzNwc$LazTnX6dO-hE|>Wu0KO)5xDdvCq>WTfkeI85j!LDvSNHy0&TTnCpr_Y@_=eYt;}dhqY5=4^QRl&pzt9Bed!EmviR=h>B6ynC7MGc`x^9c*)$$|imA)E z9KmcfaDlPY6j0i|;UW8=8oO5$aRyZaYTM*qBd?3;u=u(KdjqYJ_fLd`tRoym(-gX) zqoT2Ua$jR%Ibg0>jte$VWiyOhLaYcnGe^pQ(V0O%I}YnENL$+J%d>ulP(v~JZtnH_wYk$}A_OsQn5BbzOkG2(!baa2N({4d%BrLdzn_qpUhmGmod2kf3s)xrh|=VU=smdZ ze#hs3hAI5A(;4e45x>FbZjXU=hACbM{;p^HFvP31DFz6_lHCVuZC63Xv9`wzN@Y6rcuoPF<~3V<@&m2~m3D5&4GW7GA+XXs{sPo!wDK z85d-&4Og)(j6Q8x3f?Ooxm7VJf?Nw>3_s3fV9y_1xSDfCy31yBhkr2LI_&)xUpcLxXfuNl6z9z^w)MF}E8U)#3YWS4&8 z{-CVR?>0{F?ccm>oP#mMTY-&w90y~vwccFmV3Wd60@~aufc|xzwLI_AA^-goYhcMf z>+D@$bjnFLRX|X?6oMyaW_}(z!Ys&@5~HmlWUY|}!wJnBP8YPsWvf1%(iPjQZ2#s7 zd=-ANqy%pCwL5&H8Tzs{Ux(<1et1ny> z?C%$W*FgAI%!nl0a{QuH&7L*cr$DOVP-67{8fQkKPfPD$L+Lv zSnj#tSMG<%-tcmKzH8dSPFO)VC^+Dw0|si;bY^#=`Ilum3dEF5!JrA9J z^7-aQuXu7vwaQBlnT>)~G|scmodeOzMFBpiJ_`6WePZh+=vMX276uFz4Vd%}>sndc z95j(>Uq_*mC-r*$6iUb)5mCYRy8>n-Y?K==}9iFFRN zB_u(i5p)JpS@Is*ArpnM&nOOwsI6t6IAmTNaVm+)*gWI?2fN{+=&1n$oGYcUGS!0y znn-1azfTgI zyHQk7RQGW=l@WF&jO?B1KXJa9;4BdKcfcpq35}=O+x=GE;TGw}Ub3M+AbPW8_LG;zZ%{IenPEAQ0yCE`_ z5medk+}GQkcA+x*kGZgwAC&01r6-zspCxwld`4~iEZGot%8<4p%sS7d>FR_YB` z1Ifjyuvj`fc|U|FGJ>_SBP*e_IMD*V%9fftjgs&{b6*4#VT3Vun6n`CvL$#d*2ygL z)7eoDSMZ1NGifW#;&EW?%%%0BG5R6&cx8T(iz?c$ah{_eCRo%Dp%dN0c9w$xeo))f z!{R2?4ug`a98BH;1&H}cNC!iP7dTNKFKcpxcOl6#wP-SCOy% z!JYwOsHXEGr4S3cKrNjJ=%MF4T z@!bVaWe=0&6`nIQ;)FZc{l;u(ho}|4c%t0S8wEmM$g~?uCNTxxtk^R4o;IIHXg4Nb zZhIyY?230y#03^WP!{XWxKemhpfBjbwIDOpx8d|`8Pt~dI`s(SzLBSax8yVhRmu9{ zw$*00x8`h$)GaBWP=7&dA{3Isa5b890UcZ}9{lKpxjTOUjiBd@0mQR5q$sBg0u@Iy zwll8RkI|Pv!)|-}!4Q;*3w)M>CtQ|YfuY*dE7B89}m%)-8C#3~yUl6@M z@$xCS^_0V!62E%u6hMI}Baijc^H8CqqH=??%n$8DrN(@_lxx_H?j+3I+s>0uS4W-> zq0;-tBt+ZUCJDUZPCC#K`72}xS)J822;Tq5LaYD!CkRo6su~3oN zg&ag$fC3ZxSR5uvsAWN7eFh2^)f87O^;9TTDscs|OpfUC5ghp1K49VjDrt>4fKO=L zLxxhlumLD^ZNtMYZExK9PV1gvZsMjXa&<%d^2M4I|F-IW|5xsB0rGy*D60s$dYsg6 zMdyH$$qnp@ADG-=TiGN!GTMc$NnfrNngX>@GClAFT;EKG&5U1Bb*)IV83-ppR>OmP z;mE%>wS^m>hiH7_YYVSpTmR5U_95QXcNL(22X&|AmEtABFNSh^r+yF3YBOQc4!O80 zW_5fFeqSWTBALo%V#({BIC-%Lq^vp1z-V;gLfX5Rua>+TgW*Re+49!T|9sLVQu&ivPtDwn<# zB=%%^7~>Vd1WyRru7m;?SybRpuTdTkp!CqN?qy2_^y(`WSe9uYa9qE|o zcGg`Ff;qg;-$@F&9QY~YAiHAU+kZCb9ucTo{Gb6k#xmH@V2*O=2$V9hv3N!FG!${7 zTp-rnDN>xcgi;~=_Mxb*sFFSwD6?;CdR1Cbi8F3{DehvaW-t1+1l`nx@J2Uuss#I} z7YEQopO?lmS-vrY<18fFZQj;RUYHV1%R8M@0Tkd>SU5a}8CH-r{t1(N7NT#$sq)^w zmVCLx`_@z>k8uq?b|oJ{kgpSC_o3O$%4V2RH#rTN1lnS2uTuJCihJod=< zbK*bD&;BL?vnWrN{SD(*)sBR6Em-F63?LK}2oSl&aN^HYHdZan2q(BF z)D7uS5-tMDl2IECM|7gx%2> zc};Ho`i;kR%Dy)GUpF~6W1Ki*Wd%6#FMi5xBe)PX;SaussO4z3-v?U!u2?q%8AwgJaANO0!?)r6)*$^idCj}7^=gi;C5G{41QB@Q*c8MR zn@7|~dhs0<3%J0Tf=dI8%-XKKYj#sRI^D}q0b6V;M(o(HwO9@8wBzAG+cAYdGz_#F+444xshfBlAac=NZ;*fOTY9TtZ05z^pR5AEUigsEZVK|3P%EN69l9T#rt ztMj^w%zcjN9ADJ>WP_UYuZX&jZR@ji&u>=*IXGQau?w2zE-No+$nTgu_GgZsa&$M# zZYvI)dh>Bd=#L)dh+N*aEL{^5`qD^U_KpbEKUE%6$K7WS@R1G!nIcLmnv5J+Ack3a z2%04+f%{()h=i%kj`tsqCkKKoh%KE`ZGs_5p$zYHg~mcPi@d*l{hE-c6mFY*IgBX* zL6~^BD26Gh26+p)EPJ2IL;Sue$6HLwX#VB^s1h4Q+Hww|5(zlpA&M+;`=Svm=S+;v zJkHERRBWx#%q|GpK%F+Rc$V1Q(oO+`kKp_?Haa3}B9gaq1r)nI#4!25hPe^VDlLJ6 z5!=XtON&dC5`5o5js^}ccFq*%Q{E2ZcqcfHG;3~hzIV1Smr2JnUrzA}qvJS0pHByD zCj6^D|3`QKV-Mkn7l`7C+;{KiDa87OI_;q(s#HJaMS4T(P0Ely98^+ZR5*wy_!G56 z3+J?z-u?HtV2|%ah$ea4I0FGlLpsR$NLzoiQt?zYqY;)WuKzk zX&zj^7gwX#;?y|AsCmpgmqu;LL}sQV%xExYp;~&@;1uwbc*ZH@^yP4QVY8iniz)@m z`NT(X?G-$aA(h8Yb5{k|ODM1t4fD*k+EhMk&aPsfdgTiZ`crm;aE@iffH$0xl)xzk zP;cf1mo~EIT*L1pFr>c)6bMypnY#=C1chd$F z%xSI__^fdrclZD!Ywh;nrQKS)Gv4n`Ga?-lrHjRFhZVaU8$}1Fr&DC&0+5EHg+pD* z&pKO@6Taone5>3KFT+$B7Il<7`8grSj`|R;58(C6d48Z%;pV6 zj;G<~o22D(mZ@K0+17Z31aLV+Ib~<-!z5SSzQzTB0}{rh&2duz%ly zaG}^#dJ9k$#eoF^;`w!0|1(z1zu5!@L z@tL*vL%QefR>d1{NE>i|3C`dpl0@?KUi{TkiN6mGNRUDey67%i8-Y4@?C?4BK3S) zfr7HErec}l`_~GWBpfXk`;cTxqhQ@?lDsP1%O4g~b66sRNmD#`1VWS0+t5BO78E2& zICkZ`iPxc*m11BQxRt7dE1Ik0(P7<}s}!ezaiQ@+*Mlw==xGFmqi$4i>jy2&9mUsA z*j>?_P%uwoz{pMh_#KrelvNTR1Opo6mb0SRdK0M!Onk`Fp z=ys4!Z0vaFCTK~5b`EdIQS#2A*Qxqp3-@B7aA|=0WBE1wz(P~(nkuXl$tH%v&|#9R zeLm0olbua(?JgZv2G?R6yz3gVQMwP#Y?)mq-k6@gOK|{k8!R#T#dqf~3JgcyYV_!1 zp9v$!CMgIg^wGUhsG`m7QN0#1VZJ^W5m6TdZ-x>ULth(W{8-URkIild7h~&lW-x6# zkamVW=Fm$^>gUSsTS%jcc8$w;GJ85Mm6ERkFl=0h8YO#a*X7vZdhL(NZ^$yXf-l)ch{DbY`+M4q6{fN>WVq;uQz|Q)ZP2YT2wh+vZ+$wOqNyK`2r(RlH>uebaK2avbVcg z{@;W^5h;qUc)ExRI?u}9`&={vL4h#9%kfVg8oSDKpXrtx)=Dkv95RS`c6_Ya%CPQC zTS5MSS`B|Ys|SBOr^kwpi#7i^XAT5X7Z2tT*1m^K5{>uKVM+tlmjz}bI(8LGIh*ms zsMRF~)Z zhf64Z9SiFjJH1?Ww#3?_{~Ehqr&!d1@{PteLg{| z77qv)uM`QvK+3m{7!R~TPcnJ&7Vd@$JSpSW?&Q|)()t24_zF+GMe1DJe9u=JL((pz z4@A;xoiw;3?LGCEciG5$Z{N|`rA>OUUZZTmgJoTfSjMXtou~^{@2Gdt3#}aVPkp&$ z;<#mYqWv~IR4PWq6R@TK>G(xHnxscc2G>Kz zna3IzOUIMP6YyJPT55w=uM}j6{e%$j8MAVCg2K`y>GEQHGW+Q1C~P&o&OS8KcHC@N z=WVu!LBgQ8k675M3KmokUnj4A2`EwxIHITBFM{dT(;41?F>3Zo@~au76RvQJs*KoS z&L@-VLeWtdWPLNQgrr$_l(4LdjNv_DW?{dFzQj%)S2oXPWW_8#V2>5y%Hx-?Of->d(WT$~az&0U;asF!k=o??sn0dY zP~Sai?n7|WSX9ty2<<9(n`Ys=AX@RNRjzxYcMjsFZ?*klo(9`Xy0pz%+dO3^(+0== zbA1P2Ogj6>A;Xc#xtnp7B~iZ?OK=h>aDmEqi5QqA&V7UYaQwbvoMw%fid2k?v=$&W zU9LC1N7!8#Q-WfmkA|V1){F$W1nSN@5^O7TnxTnpys|30Y$U>gDEnU0u7`$EzCUgxKF=SKK zc(M!e{m6AkXWHEu3NF(2SA@7<23J^(Jg^;%h5KGp(c)gN$N7PNs6sUOs-M(%hY-0? z|B;LE-P5z_yS}s1J{j;76a!AP{;PNwe>?_)&boGne>lMWCEi7uGGMK$fW+GXaJzP@ zLeKG9htxxEMuTA+D1<>_B7;wzX8q{haH4_P(6W0v8!dhg{dEgbRwR;)&j-;kT{BT* zGF5alYiw*J#lFCK_w@1W)i+2V*HX%u9(Z`}>My23@3YcyD46nzA%%NuA6 z$lONl=$>A5cNf{XGkwN zKJmz+b(iE7?Za|mYx@aj!F+AgUP^!_!U^+IR_LR7^Wd6_?3V!V5M8Vknv-+Y*0=VB z3RDkWb~q(Xg>VWlaH=;l$s&6kowW8sh+In-9=`2&@$jt{s5oin8d<4-abf1&S1-yY z4Xll-Q5$CpVd1vYSL)4;BBv`+o2Uw73krO-6KUK|T~D`hx1+))!2)*!D_zF}$3nUF z@+Bco^6H5c!eU*o;#dsv6N7QlCIKiGMYk#s&zjCk;|@N&6P?8zHiT>2<9Z~6OW+dy z1;en?LH?maVakQZ=w<717oPTVD5{odQy#~CajBt5Rs?}0C1?oiNK3OWSt#y7$R%ayCbDQ7oAH<-&`Wp2>)fn@T+)hdW? zvE+)d2_$+7ALBDazH-i|WSMsT%KI8p;uxa*y6SzABt(4(r{>`#y^}+@uNBzb65Cdz zz%0=Yndh4^T4e5FymIOP2e;OLU$IhxNx)$Py!MR08zX)l`2XVJ z^~^~xQbAU_TL8%u;DbF~QB3)XgcU}tLY7)W0SyEOdbQ!8*+P<|dL`kJ9q|#!JE2iF z2P|F)Gcm)p=B!P3ckkv1x081a-vK`zC7nzWwj4fZ4YttY{*0j83 z`PT;>OuT#X3hZf2Y|#0OO*KdOdF<`w8GXTMqD!jidZDjP_B-7vFClC@%wCpeyiVBR z-jHXmyT>GNns9^GS}Ruz7(N+Gs|YythV2@4+Vsb`i=eGpP)ZXpdFz-;FN8{;cCt`v zc+QT8%U1bDX*pG@Uj@NNt;c*Ds=wF$3*_JHS9k(r_YmL_=>d2n_*Y@vV3A``LM;>6=Nn|z zre+N07A%UrbNF+fy2fh#6N|1jjqmfH-t*^9**oh)QB;1kEqHS}+ypo@-}EWd{rd6h z%$flx&-P89`bb8uk&YOaJsvhT3Wg!wx(1MRS$J~<4L!=WM+XbG8e#Rw9dqM9!@ z+#_6QHns5>W898fQL8nHugDl&2EBr0Q&x_YDt@cktT5=HQP5iCd`p4gHB$_A!2NZi zfd&6%=r+PKcF zcD>}A2!}ZrljP{g7lSURAIQNm87b5}hmrWXJFAsVr&+soJYUbIW<3f`8Rn&64AN|n zSdEEN^c|s2!F}}qI+8?SVwkqY15P7FqL;E!ycf$J%{gv!1HO@T*!_;91hNgu4&Yv_ zLVv=T^B%)U-s|Imj%(pjRp^!<7P~u*P@4{oI(<@|8!tD9aMICh#2eS4$eGG3v%|!D z3A9hb5HtqpqehMMa#N!Ts_sj&kZ`-;{^vSa$2KvUzQTu(^Rn+6Ub!urJ5;1XyfGF+ zPk&ug5Jz{R?Xt?FQ>0Rd;JiS)`RxM2aDHoU{Tt$KM~`fJ4=u@MHp~=H1h{{0>(l^Z z)`#oM8@Fg94%5>@ozPzIKn4u?Z9^Kdq zb>z6+;*Il{_Z$%8;%)VaMOgBcyqA`}UcP78_o$yfdftM9!cK-_c98twa zHqXs$;lCQr75r$Jq!!*D1TBMN$&{KKiwJy76aO*8aAD0)##01^2jiQZ=S6PyL9z`dPCX(PcIvRFR%Q%oq&J*9@-?yiy6KV#!b`ri50d zRQ+HHJA+XuO_7QOd(_ieE+CfY<*sY!`#?Q6B zy5398or>DtM&>Pt;fqQzX%#y7TO~D@!Q8N`jsznSaHVV@QII_GY`mUV{igy`NP(A}J%X}?5&&wsZWPQiBz zc?)>svRp9m2Q!__B)myK^VmyYTJ!dL1hE0?7sFX%XPzI+HQT~=qMN2?g-TJ)yv&^o zP-?RkV&wTaPG0K7dqAKQ@lbwGb9HunYmN}@dk%i*Y6CgtG26<8lS=_zY90qI7DfB}ire6El{#mc z;nEwoLQ&~Dc`v!lIOL$!8Cqc^q1h(sj5ncZeba?%Dy69??%`Jp?ZZZ>TN*R4Ep}sI zw{?js2HG>`K26%gY%2}$aMg~J`MfG&2;w$5vc%2GLM?tmm92FD7>Lt&#@luqnUb7n zMTH2f?x*aH%6_dW3+wKB{N5x-bY8Q7_w;nlC+dFhl!&BN&Ff1*S?}lyRicHzJ65=f zO#y?AA+n$PMh7kEH#NpfC>Lnwc{{Z)Vlk`VfVXgIAuJw^YU76nsxsw4)XG69SOl3M zXsToc7Sjz)_Km2o@OS4l8Pk|X#8Bcodlqp{eX(rt5%t!Csf6D|iO(IUR*jxn8u2KO zQ2ElC42(){N+?>x3X&7oo+mgooiaS zIvzb95Qu_Akw-&VCsEKR{6ZwE1sQ^Dq&q8pmb6%CggTRbctH9@U2Nq8LLNW}pd=Wl z)2ye3h=#^9CL^`Tj0Z|w$>T;#V)NRoh|No=l@&1z-e+UkRuibQ&9wG2&Ky}hRs@pk z&{u^6Votln-4}O_cY$AM;?jnlE9nfz_he1h*m+5^E44Gg@Gffy)%TbyGEpeMe`{2) z5*7nD8Bstj#>{{T1EU_vd5^`35WIP5gh(GPDeFoGC)=FJWY{fZomyNDEx}y7*y@Q+ zE!*X`kfss8HWb@hx{mGnzB$zNE*{{roGJ) z74vfpFx-*xmyL|>aP{5|H_RRB2nK&RUyU)Q5Nyxk0h)N4isUHfG~i4EXs`76b>R{p zaTE$B^0yjYa0Dz4T!#L-BNMU4i_Hbr=KTo*#^mn;q#H-@)7~#Sw!WzJVyR2QRWHPVe)!r_j!+mZ)-gCwne;e2sekE2s#u zBB@|AlL)>RmIfI%!jyQ9yJ=36Y=kjt3Ss$!7>SBfYIXZ3iz10mkjP@voHl-|)^tIh z#IY2OH0SyP1y$O`Gex+}Lv)?dR?e$O)x$1IK~cET zQ>(H{FhP9X=x~9~8;=t1n2V;CyWI65+}B__iGq-W+!Er~oYCPvy%Po`*xl&OqhjBD zAY4Ky{Ib^XLF8{~54CQ6@9!S7KA#DyA;cCC4>(OU)A_lDLI*%?VKI zVF7!a^&(NWCGBf}7T177CBQTaEqJ;4=I>8sWt6@0_tP^XfDa+y^Fs#!aMb<(TLYk) zx#~9>06Tw+{0|I*1`1Fvhk^oP1X%b0y#E*V9xyumxR8KO1iyck6;%?Xmy{C&9Mu1N zvW7l2DgnShC<8udfX|;-p6~a!#s5ntD<~%^CaS3PLRRdr2;|R*0khqY3km3(U>e}N zwVm0c5a{ypIj35H*oP5cau-UI%12Jj*Mk^K9u z))ybJ{`#KRAIyIO{HY7|XQcJ#IqF>voJ9l7^EQBze{cRjuUcPVz+e9f@cF6^u)cF~ z6?Akk0mQyF)&CjT`8ng>v6_7`fMyBsA^DRIaIf`s2IS#4jFNwr;g6Th=XhX6ZYx@V zyea@v)Bg=m7ho&?4W782u7QQ2G9diCgteuijJ377qs{N3@iw)WdI2E!fL{82L-^0D z))&xce+LbS`D@{54>(sQW@=$5sIPBmZ!fEBrEC1B(!%q+kHG7QeUG4h2e9Y;J?{hn zQPbb#UG)!X4uGk{$kf;o5I!3aO8)nGSMbC)-2qeyHX!eee`XwTul2o0`YrVH_LKmK zMOgf|jOV*DHmd+K4g{#3?<2;aSFJBS#&6MOtd0L`EsWV6g`ordOsoK9{(da#&#TtA z6CeWen_Bpr?A`B+&$(K^f(v-Wjsc?p(Vu{Td#x`v;OB2J0fzz|bS*4?kG9e&6WRl) z%y)o+>F@1i2j~~SK@+mJcK9y4VI!++Y6Y;l{uJAI-UTFP8_1>rZA1zv>UYV6Kd)L} zU(Vk`|L6juE{6J!{}(;|Icfk-UP(0oRS1Ae^Cu+WUhA7G{9DvN9*Q5>-!uLDig>QM z`zLg*ZvsF><~J4bqgwyl@bg^b@F$)FU_k#3-rt)3zbPI*uZ`#Wc|TdaRDa9z&m+!r z*_@wnvv2-y^87IX|8@fXYyQ4(ZatU1`3Y$J_P>kZJV*JS>iZ-4{rWB&^T+jl9<$W_ zTPeSXuz8;Nxrof4$!mSne@*(7j@&*7g7gZzZ2H25WNe}Vn+a>?{-Z~R_w z&m}m1qM{o93)FuQ46!nEyV!!gHSIhx~u?BuD(h^XuU8ua5jb=X`!t`zNPZ^#A7k{c!c% zr}ii2dCvdF{Edh0^GrW?VEjq2llLzO{yIwiz68(R$9@tF6#hc+=PdDW48PAy^4#6y zCy{UIFGRm|*MEB4o^PT5L=LX_1^L&`^au3sH`JdO;`!F)Pb#&ybLsOPyPvR& zHU9+rW5D=_{k!J{cy8DK$wbij3)A!WhriU_|0vLNTk}tv^QK>D{sQ}>K!4o+VeETu zbo_}g(fTj&|GNqDd3`;%qx>XV1sDeYcrynq2!C%?c_j@FcnkclF2e+b1PDE++xh+1 F{{tUq7iIte literal 0 HcmV?d00001 diff --git a/samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..b7a36473955 --- /dev/null +++ b/samples/client/petstore/scala/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/samples/client/petstore/scala/gradlew b/samples/client/petstore/scala/gradlew new file mode 100755 index 00000000000..9d82f789151 --- /dev/null +++ b/samples/client/petstore/scala/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/client/petstore/scala/gradlew.bat b/samples/client/petstore/scala/gradlew.bat new file mode 100644 index 00000000000..72d362dafd8 --- /dev/null +++ b/samples/client/petstore/scala/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/scala/settings.gradle b/samples/client/petstore/scala/settings.gradle new file mode 100644 index 00000000000..5452c701c0e --- /dev/null +++ b/samples/client/petstore/scala/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "swagger-scala-client" \ No newline at end of file diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala index f7e82cd1b61..3208eb938d5 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -1,8 +1,8 @@ package io.swagger.client.api import io.swagger.client.model.Pet -import io.swagger.client.model.ApiResponse import java.io.File +import io.swagger.client.model.ApiResponse import io.swagger.client.ApiInvoker import io.swagger.client.ApiException From 92d4f5df226a841a9394a2f158170a4b174556e2 Mon Sep 17 00:00:00 2001 From: clasnake Date: Mon, 6 Jun 2016 22:11:16 +0800 Subject: [PATCH 21/67] Add build folder in the sample scala client into gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ac37b15529..5eba3895f59 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,7 @@ samples/client/petstore/java/retrofit/build/ samples/client/petstore/java/retrofit2/build/ samples/client/petstore/java/retrofit2rx/build/ samples/client/petstore/java/default/build/ +samples/client/petstore/scala/build/ #PHP samples/client/petstore/php/SwaggerClient-php/composer.lock From 5adb80bd1b448405a889af1d6f891e200a302a48 Mon Sep 17 00:00:00 2001 From: clasnake Date: Mon, 6 Jun 2016 22:22:07 +0800 Subject: [PATCH 22/67] Delete the build folder. --- .../reports/tests/classes/PetApiTest.html | 121 ----------- .../reports/tests/classes/StoreApiTest.html | 101 --------- .../reports/tests/classes/UserApiTest.html | 121 ----------- .../build/reports/tests/css/base-style.css | 179 ---------------- .../scala/build/reports/tests/css/style.css | 84 -------- .../scala/build/reports/tests/index.html | 150 -------------- .../scala/build/reports/tests/js/report.js | 194 ------------------ .../build/test-results/TEST-PetApiTest.xml | 11 - .../build/test-results/TEST-StoreApiTest.xml | 8 - .../build/test-results/TEST-UserApiTest.xml | 12 -- .../build/test-results/binary/test/output.bin | 1 - .../test-results/binary/test/output.bin.idx | Bin 36 -> 0 bytes .../test-results/binary/test/results.bin | Bin 605 -> 0 bytes .../test/jar_extract_2499683789472893630_tmp | 0 .../test/jar_extract_2588204703609432255_tmp | Bin 10545 -> 0 bytes .../test/jar_extract_5992752952754193465_tmp | Bin 596 -> 0 bytes .../test/jar_extract_6315988328729383060_tmp | Bin 2287 -> 0 bytes .../test/jar_extract_899015300961717389_tmp | Bin 572 -> 0 bytes 18 files changed, 982 deletions(-) delete mode 100644 samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html delete mode 100644 samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html delete mode 100644 samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html delete mode 100644 samples/client/petstore/scala/build/reports/tests/css/base-style.css delete mode 100644 samples/client/petstore/scala/build/reports/tests/css/style.css delete mode 100644 samples/client/petstore/scala/build/reports/tests/index.html delete mode 100644 samples/client/petstore/scala/build/reports/tests/js/report.js delete mode 100644 samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml delete mode 100644 samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml delete mode 100644 samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml delete mode 100644 samples/client/petstore/scala/build/test-results/binary/test/output.bin delete mode 100644 samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx delete mode 100644 samples/client/petstore/scala/build/test-results/binary/test/results.bin delete mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp delete mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp delete mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_5992752952754193465_tmp delete mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp delete mode 100644 samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp diff --git a/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html deleted file mode 100644 index 832cc577c49..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/classes/PetApiTest.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - -Test results - Class PetApiTest - - - - - -
-

Class PetApiTest

-
-
- - - - - -
-
- - - - - - - -
-
-
4
-

tests

-
-
-
-
0
-

failures

-
-
-
-
0
-

ignored

-
-
-
-
8.201s
-

duration

-
-
-
-
-
-
100%
-

successful

-
-
-
-
- -
-

Tests

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TestDurationResult
PetApi should add and fetch a pet2.414spassed
PetApi should find pets by status2.665spassed
PetApi should find pets by tag0.567spassed
PetApi should update a pet2.555spassed
-
-
-

Standard output

- -
finding by tags
-
-
-
-
- -
- - diff --git a/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html deleted file mode 100644 index 3de64cc1941..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/classes/StoreApiTest.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - -Test results - Class StoreApiTest - - - - - -
-

Class StoreApiTest

- -
- - - - - -
-
- - - - - - - -
-
-
2
-

tests

-
-
-
-
0
-

failures

-
-
-
-
0
-

ignored

-
-
-
-
3.613s
-

duration

-
-
-
-
-
-
100%
-

successful

-
-
-
-
- -
-

Tests

- - - - - - - - - - - - - - - - - - -
TestDurationResult
StoreApi should delete an order2.357spassed
StoreApi should place and fetch an order1.256spassed
-
-
- -
- - diff --git a/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html b/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html deleted file mode 100644 index 450651fcea9..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/classes/UserApiTest.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - -Test results - Class UserApiTest - - - - - -
-

Class UserApiTest

- -
- - - - - -
-
- - - - - - - -
-
-
6
-

tests

-
-
-
-
0
-

failures

-
-
-
-
0
-

ignored

-
-
-
-
10.898s
-

duration

-
-
-
-
-
-
100%
-

successful

-
-
-
-
- -
-

Tests

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TestDurationResult
UserApi should authenticate a user0.559spassed
UserApi should create 2 users1.912spassed
UserApi should create 3 users2.355spassed
UserApi should fetch a user0.594spassed
UserApi should log out a user2.130spassed
UserApi should update a user3.348spassed
-
-
- -
- - diff --git a/samples/client/petstore/scala/build/reports/tests/css/base-style.css b/samples/client/petstore/scala/build/reports/tests/css/base-style.css deleted file mode 100644 index 4afa73e3ddc..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/css/base-style.css +++ /dev/null @@ -1,179 +0,0 @@ - -body { - margin: 0; - padding: 0; - font-family: sans-serif; - font-size: 12pt; -} - -body, a, a:visited { - color: #303030; -} - -#content { - padding-left: 50px; - padding-right: 50px; - padding-top: 30px; - padding-bottom: 30px; -} - -#content h1 { - font-size: 160%; - margin-bottom: 10px; -} - -#footer { - margin-top: 100px; - font-size: 80%; - white-space: nowrap; -} - -#footer, #footer a { - color: #a0a0a0; -} - -#line-wrapping-toggle { - vertical-align: middle; -} - -#label-for-line-wrapping-toggle { - vertical-align: middle; -} - -ul { - margin-left: 0; -} - -h1, h2, h3 { - white-space: nowrap; -} - -h2 { - font-size: 120%; -} - -ul.tabLinks { - padding-left: 0; - padding-top: 10px; - padding-bottom: 10px; - overflow: auto; - min-width: 800px; - width: auto !important; - width: 800px; -} - -ul.tabLinks li { - float: left; - height: 100%; - list-style: none; - padding-left: 10px; - padding-right: 10px; - padding-top: 5px; - padding-bottom: 5px; - margin-bottom: 0; - -moz-border-radius: 7px; - border-radius: 7px; - margin-right: 25px; - border: solid 1px #d4d4d4; - background-color: #f0f0f0; -} - -ul.tabLinks li:hover { - background-color: #fafafa; -} - -ul.tabLinks li.selected { - background-color: #c5f0f5; - border-color: #c5f0f5; -} - -ul.tabLinks a { - font-size: 120%; - display: block; - outline: none; - text-decoration: none; - margin: 0; - padding: 0; -} - -ul.tabLinks li h2 { - margin: 0; - padding: 0; -} - -div.tab { -} - -div.selected { - display: block; -} - -div.deselected { - display: none; -} - -div.tab table { - min-width: 350px; - width: auto !important; - width: 350px; - border-collapse: collapse; -} - -div.tab th, div.tab table { - border-bottom: solid #d0d0d0 1px; -} - -div.tab th { - text-align: left; - white-space: nowrap; - padding-left: 6em; -} - -div.tab th:first-child { - padding-left: 0; -} - -div.tab td { - white-space: nowrap; - padding-left: 6em; - padding-top: 5px; - padding-bottom: 5px; -} - -div.tab td:first-child { - padding-left: 0; -} - -div.tab td.numeric, div.tab th.numeric { - text-align: right; -} - -span.code { - display: inline-block; - margin-top: 0em; - margin-bottom: 1em; -} - -span.code pre { - font-size: 11pt; - padding-top: 10px; - padding-bottom: 10px; - padding-left: 10px; - padding-right: 10px; - margin: 0; - background-color: #f7f7f7; - border: solid 1px #d0d0d0; - min-width: 700px; - width: auto !important; - width: 700px; -} - -span.wrapped pre { - word-wrap: break-word; - white-space: pre-wrap; - word-break: break-all; -} - -label.hidden { - display: none; -} \ No newline at end of file diff --git a/samples/client/petstore/scala/build/reports/tests/css/style.css b/samples/client/petstore/scala/build/reports/tests/css/style.css deleted file mode 100644 index 3dc4913e7a0..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/css/style.css +++ /dev/null @@ -1,84 +0,0 @@ - -#summary { - margin-top: 30px; - margin-bottom: 40px; -} - -#summary table { - border-collapse: collapse; -} - -#summary td { - vertical-align: top; -} - -.breadcrumbs, .breadcrumbs a { - color: #606060; -} - -.infoBox { - width: 110px; - padding-top: 15px; - padding-bottom: 15px; - text-align: center; -} - -.infoBox p { - margin: 0; -} - -.counter, .percent { - font-size: 120%; - font-weight: bold; - margin-bottom: 8px; -} - -#duration { - width: 125px; -} - -#successRate, .summaryGroup { - border: solid 2px #d0d0d0; - -moz-border-radius: 10px; - border-radius: 10px; -} - -#successRate { - width: 140px; - margin-left: 35px; -} - -#successRate .percent { - font-size: 180%; -} - -.success, .success a { - color: #008000; -} - -div.success, #successRate.success { - background-color: #bbd9bb; - border-color: #008000; -} - -.failures, .failures a { - color: #b60808; -} - -.skipped, .skipped a { - color: #c09853; -} - -div.failures, #successRate.failures { - background-color: #ecdada; - border-color: #b60808; -} - -ul.linkList { - padding-left: 0; -} - -ul.linkList li { - list-style: none; - margin-bottom: 5px; -} diff --git a/samples/client/petstore/scala/build/reports/tests/index.html b/samples/client/petstore/scala/build/reports/tests/index.html deleted file mode 100644 index 6393b771932..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - -Test results - Test Summary - - - - - -
-

Test Summary

-
- - - - - -
-
- - - - - - - -
-
-
12
-

tests

-
-
-
-
0
-

failures

-
-
-
-
0
-

ignored

-
-
-
-
22.712s
-

duration

-
-
-
-
-
-
100%
-

successful

-
-
-
-
- -
-

Packages

- - - - - - - - - - - - - - - - - - - - - -
PackageTestsFailuresIgnoredDurationSuccess rate
-default-package -120022.712s100%
-
-
-

Classes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClassTestsFailuresIgnoredDurationSuccess rate
-PetApiTest -4008.201s100%
-StoreApiTest -2003.613s100%
-UserApiTest -60010.898s100%
-
-
- -
- - diff --git a/samples/client/petstore/scala/build/reports/tests/js/report.js b/samples/client/petstore/scala/build/reports/tests/js/report.js deleted file mode 100644 index 83bab4a19f3..00000000000 --- a/samples/client/petstore/scala/build/reports/tests/js/report.js +++ /dev/null @@ -1,194 +0,0 @@ -(function (window, document) { - "use strict"; - - var tabs = {}; - - function changeElementClass(element, classValue) { - if (element.getAttribute("className")) { - element.setAttribute("className", classValue); - } else { - element.setAttribute("class", classValue); - } - } - - function getClassAttribute(element) { - if (element.getAttribute("className")) { - return element.getAttribute("className"); - } else { - return element.getAttribute("class"); - } - } - - function addClass(element, classValue) { - changeElementClass(element, getClassAttribute(element) + " " + classValue); - } - - function removeClass(element, classValue) { - changeElementClass(element, getClassAttribute(element).replace(classValue, "")); - } - - function initTabs() { - var container = document.getElementById("tabs"); - - tabs.tabs = findTabs(container); - tabs.titles = findTitles(tabs.tabs); - tabs.headers = findHeaders(container); - tabs.select = select; - tabs.deselectAll = deselectAll; - tabs.select(0); - - return true; - } - - function getCheckBox() { - return document.getElementById("line-wrapping-toggle"); - } - - function getLabelForCheckBox() { - return document.getElementById("label-for-line-wrapping-toggle"); - } - - function findCodeBlocks() { - var spans = document.getElementById("tabs").getElementsByTagName("span"); - var codeBlocks = []; - for (var i = 0; i < spans.length; ++i) { - if (spans[i].className.indexOf("code") >= 0) { - codeBlocks.push(spans[i]); - } - } - return codeBlocks; - } - - function forAllCodeBlocks(operation) { - var codeBlocks = findCodeBlocks(); - - for (var i = 0; i < codeBlocks.length; ++i) { - operation(codeBlocks[i], "wrapped"); - } - } - - function toggleLineWrapping() { - var checkBox = getCheckBox(); - - if (checkBox.checked) { - forAllCodeBlocks(addClass); - } else { - forAllCodeBlocks(removeClass); - } - } - - function initControls() { - if (findCodeBlocks().length > 0) { - var checkBox = getCheckBox(); - var label = getLabelForCheckBox(); - - checkBox.onclick = toggleLineWrapping; - checkBox.checked = false; - - removeClass(label, "hidden"); - } - } - - function switchTab() { - var id = this.id.substr(1); - - for (var i = 0; i < tabs.tabs.length; i++) { - if (tabs.tabs[i].id === id) { - tabs.select(i); - break; - } - } - - return false; - } - - function select(i) { - this.deselectAll(); - - changeElementClass(this.tabs[i], "tab selected"); - changeElementClass(this.headers[i], "selected"); - - while (this.headers[i].firstChild) { - this.headers[i].removeChild(this.headers[i].firstChild); - } - - var h2 = document.createElement("H2"); - - h2.appendChild(document.createTextNode(this.titles[i])); - this.headers[i].appendChild(h2); - } - - function deselectAll() { - for (var i = 0; i < this.tabs.length; i++) { - changeElementClass(this.tabs[i], "tab deselected"); - changeElementClass(this.headers[i], "deselected"); - - while (this.headers[i].firstChild) { - this.headers[i].removeChild(this.headers[i].firstChild); - } - - var a = document.createElement("A"); - - a.setAttribute("id", "ltab" + i); - a.setAttribute("href", "#tab" + i); - a.onclick = switchTab; - a.appendChild(document.createTextNode(this.titles[i])); - - this.headers[i].appendChild(a); - } - } - - function findTabs(container) { - return findChildElements(container, "DIV", "tab"); - } - - function findHeaders(container) { - var owner = findChildElements(container, "UL", "tabLinks"); - return findChildElements(owner[0], "LI", null); - } - - function findTitles(tabs) { - var titles = []; - - for (var i = 0; i < tabs.length; i++) { - var tab = tabs[i]; - var header = findChildElements(tab, "H2", null)[0]; - - header.parentNode.removeChild(header); - - if (header.innerText) { - titles.push(header.innerText); - } else { - titles.push(header.textContent); - } - } - - return titles; - } - - function findChildElements(container, name, targetClass) { - var elements = []; - var children = container.childNodes; - - for (var i = 0; i < children.length; i++) { - var child = children.item(i); - - if (child.nodeType === 1 && child.nodeName === name) { - if (targetClass && child.className.indexOf(targetClass) < 0) { - continue; - } - - elements.push(child); - } - } - - return elements; - } - - // Entry point. - - window.onload = function() { - initTabs(); - initControls(); - }; -} (window, window.document)); \ No newline at end of file diff --git a/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml deleted file mode 100644 index cc2e356f55e..00000000000 --- a/samples/client/petstore/scala/build/test-results/TEST-PetApiTest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - diff --git a/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml deleted file mode 100644 index 0944febda9b..00000000000 --- a/samples/client/petstore/scala/build/test-results/TEST-StoreApiTest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml b/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml deleted file mode 100644 index 4773a968d0e..00000000000 --- a/samples/client/petstore/scala/build/test-results/TEST-UserApiTest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/samples/client/petstore/scala/build/test-results/binary/test/output.bin b/samples/client/petstore/scala/build/test-results/binary/test/output.bin deleted file mode 100644 index 51c4ba6dd66..00000000000 --- a/samples/client/petstore/scala/build/test-results/binary/test/output.bin +++ /dev/null @@ -1 +0,0 @@ -finding by tags diff --git a/samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx b/samples/client/petstore/scala/build/test-results/binary/test/output.bin.idx deleted file mode 100644 index dfffe31d6255ce161034f51b7dfff3bcf73779a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36 QcmZQ%Vq|4N1OL$g0Eo>G`Tzg` diff --git a/samples/client/petstore/scala/build/test-results/binary/test/results.bin b/samples/client/petstore/scala/build/test-results/binary/test/results.bin deleted file mode 100644 index a2b463d4a3dbe53dbf45eb3df60789f20a0bd3d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 605 zcmZQ(X6g<|EpaT!3`s36VPIekRb#L{$-=k@BB)TDkzbmVqL7#Z#Ca(SX{ja2848IC z1*s(r?}Q-A-OU-8XQL`FEl5c$NrkHWEeuf?XvDyRW^7s}&`h9N#R^H43dJRfC8fm- zFGV2Aqh~X)&PO#CMR`eLI>UArh}zgo3|u{-#i>Oo{wUnS#yJNn3iAle1EoO4440tV zOV}8=7o#amEG@}M%`3@FhIj<5emzuunJEL$JT&z=`RNMzr6oW=LyQ)HxU8;&ffrqA za#1SCP$RI)Vul}l5T$Jl417408bg(Ch6Z`RF$4cxGzY-L9Bls-DTtwSycpPfgG=&@ zQc;2?_6ZZ)N|-P#YzlG`lYxu9VcAR8U;Q6mNyP IF^7o(0G=Maj{pDw diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_2499683789472893630_tmp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_2588204703609432255_tmp deleted file mode 100644 index 407a6ed065bd255fcc8bee40e43ab9e049919e09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10545 zcmcJV3wRt=701ur$!;>qY}(Cc+onlVHrYHjAx)FgHqC~#yV-7;Z9;95rfnqDO|osb zO*UzEQ(9g=@PQ9}q9}@@D2f&eC=x-dD2i556h%=KMNt$*Q4~c%&z-yJ%w)CX=n<(M)zGF_w+ZrpL0W zsdQT*5CXfq2HQG&4<(K!S|<|e1Fbto4<*O4p?<-!Zu@DyY=|?+uED{!&|rV4J49gV z+0a5LAh6^tM^V5lm=1<(uwTsOcFS*_=6=8q4Aal4guwuq-=#x-&7- zKDyUcMf@>`T9;gjVRM%H)tzlMQR4KfiEx+{L`L?P5B057oxV-P(Wp3MuXA#;q!~dV-LMvz!o@>Zu(iLDds(?o*ZK1gQxtTCsD)?@u@yr&Be(2huB5#h29m z;X*|zbY_+>Eh+GBxwcU?mAD{ z6(P=w?(8KkZl$ir*W_u4l&wwZ#p98%r_HOXQGZz3wzpf`)@thO50A7{eS=qRi~32y z)_p_e+tv&-K5;tAG9KMuM0OH~*XJfKhoi10;wdUx9dXwTY;D5vFFWp-y#U9*qRw-q z2*+>k?6vZH3YXO;kstM{{;imoo_*cpyIU$c+Eq{SKwZR`cP14#=d&*y_cfT;*Sx!B z%v+!J>C3 zrl%*42PVgcqk+scfr7?paF~GatlA8WO(ZgzLMTP4@$6C$p+y4?mKMVj@E{|5FqI+T zpD);j?mDbl$I&(dBx<>isCgZDSU6ZzgXK^`2U}?|#!O>u0b@*qDyXK$)fS^}8ubN? zx(0rzrN)587&nda1&nbG>YIHW-{v{2(3i*Y!XOH#~8l06f6T!XdH zPL1m@vKWao8IGD}ab#mbjO+&Jpyo{$W6U&)BO421WJ7R1HFjH!x@iRh|3u0vB&`XVd7UQs$stWbwELJ76a@_G4sm zLS|%5vpBLkjqEPiP0f2O#+YdoM^>ki9fpgjal~TOO`|xnI*sf;NKoUb#TYk@;>hYW zvg5Fy8V^{EL#9z2S)E2U1&66|!eShb=OPteHclgZ6}*8O-)J!o znMQGB<215Y!&|8Ftpp0krY5JSGD!jfdjkmCnlpj*_S0-<*?k&Z1Mi?iz7unTmEf^? z@D(O^Df7<{4X$OL_i~!i(>1t`Y47JWqit(&J<~qOX+~$(;0C6BnA42rtHF&-`zWUw z{Z)gTnD%i_Gg_zyH#6;%oMv=L4Q^rDr#a1Nf*PD)+O3>s^f?VqGVOLwGg_GjcQWm> zoMv<@4enyv=Q+)2NE*yB?F*b1rT3x+_cHB^oMyBX4Nfub%baF(4Gr#N+E+QvXbc+M z&$O>|nsM)I@Bq`k$!W&zt-)!geVfyww6ZmLkZIrLG~))<;31}cpVN$cP=kk=_CroH zZZi!YVcL&5&A5{^c$8^B#aktj9v?iIOl$BMJN9!tKX=Tm*~gjoOHRwx>=R7;HK*lj z_DQDwmeX=I`xMiD&uO`ueVS>1b6T!upJm!#IW1SS&oS-qoR+KE=b83T zPRrHo3rzbrr{!w)MW(&PX{=@m7#hJhNNYTex+DtI3OJ3`EO9ZdkkeSr5|wGioW^RF zXiRf+8mn2dglS7TjnynEW15%KSj`e2)0S}>t68#wX%(EtYL-+ot%}oF&5~-S;rpc} zF05vWpJ_Fm#%h)Xm{v!iC_6Qfok^v!<(4-FEelO{6knR_?EPGDo<GYeA!+q=S|CA4k8uEB7KE}FYTwug}+v9m!U=T8zlvPaDWr= zses!;z4)nt8~1(A!@qTcf`0&9O$~EUb^^aS$a?&}3>|nByiksx^qUWl5wgMfj!h65 zxMu?^M4ZZ#s4s?71*=4yb8cHC#}73kPTgYXRSyj!PSdT6yq;z_SHx+(W09P-&~}F7 zV3}#EorCl8&ucw;_^MVw>#^JV88hf77A zEAr>d&bbm^E#kaxvGckLUN7RjDSy7~*K;+zS;To;{(RXv*TCEH`NE!G^Zl@S4&HTp zp1%5Scn^+k$rssZoZW%Xv1`S=_sQ@!A@4dd?*p>D>&3he$?|Rx^FAWWyHU*hm@Mxm zG4B&HyiUx=&0^lCWOy{cw}^S4k>#Bb^KO&nofPx#kmcPe=6z0h~`<4uk=J&Li_Z=A?&F_O^-uGmA z4~cm{kmWrr=KV;P_lTJH6ItG)V&2bWcr?F{iFv<};f0X*xS01V86K{5;0ZDBH?q7Z z#k}9i@}3g&{vgYHTFm>CEbkdH?=LdE^D!UKig|yN;nDm)C+7V_miN4v_b*xA3u4}X zWO*-&dHVqUE*FCgaC%kXG^8%QJmrt9-o z?5=dT*x58knoS(tJjR1;d)c}uM;rbdO>S|&E@xJo?k24WSZD4NFo0?YjT{s4cJ zIEn40LCUf-%)B=<`*yy6KED8*W1rz9@p-`QI1QDY2>a4YRLp(VPeWhHC_J+!{_w_1 zo^>#Wk-LE1b;taL+W`+p_MJBtzH;VDuA*1*_z+6v^kz_DmcwwgV2}=tq4`HD)a$4c zSdem>(;2E=N%MOQ<6Hmm`Ol=@XAy;Wk zs4W62mB{brehGWz@eAj8oiP9a diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_6315988328729383060_tmp deleted file mode 100644 index 0539403de97cd71d5d0abbb3e9fede0e71f84f08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2287 zcma)-ZCBbz6vyu*nP4EO!Lo{0>|i3IRSLBAvF;{_71Vl^mR4I%PhhErDp(S_r@Q?~ z`}k`2?2G*X`=R#i4HV0<*|WUJ%-oy%yZ2`1&+zv@fBppkX*eV>V^_@!Gudi49P6@{ z)GM~rGONx`yHRzlX5*d@2!XB5)G^v{N7|H9SCwoE2Jtu8nbf(7szQ!iW+1%Zroj2dYQT`*5!EcRmM-l=~-r| z_Un=`Z|EV)mX65I-gxTlq_BNH8uL>v#&mA+y_vo{zKeODYlek%-7nkLT_?U+HdOkw)+S_Nk!0k;vlu`wrI|$O0zFS_svc4}UjHBWV$0YKM_&#XP z_;B=2n9uQPJxr7-s-TQz^Xls2gL+v#RqZPR{Cwh+K)9o>V;|BJ{Tr&YyPI5 zHxj2Z$S~@M5l{#S&beh1U_D{}*N+Ibd0iV%r(4_bE?~$IhHlIm1|GQ7!#=9iqe|XXNrqKecPTutA*We%T2|xCjZO63bX_k- zXddeLGERm^@U@%s8v^2{)v%l`84OtS0|h)wQFUFa47qM)+;Sn?{I*6QwBN-0tz@<= zvvN^;>JE5g?pux8llEn$*81d;t}j3W{$jJ;s@8TaH#BnGRb$DrEoAjZqv@FLm5zcP z>Rp`z0}dM@;KToe0M0T5aoj~Ki8H~OF8l$ZA92A!9!I(BgfX~++_{E1Ty@)?{RJ2Q-?j?cHT?OT=YJjuPQZc(yfj$b%bi{BZrJCx z(?1PVIRp1SDz6Myc@@??;LYC#s{9DHJYfCTfnd}=o{9U-8BF3Hm9+3XY@^B^->fcq isBEuOWDNx9u6Wq*c!uBrXIH`!K7JdQPtd_rfPVq7pOYy7 diff --git a/samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp b/samples/client/petstore/scala/build/tmp/test/jar_extract_899015300961717389_tmp deleted file mode 100644 index 74d2409d2e0ba550401e032be317d63ed5a7be59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 572 zcmah`!AiqG5Pj38iHXr_)mE(_LXg^n6+N~TROl&qY3+TRF1nB=CE0+#qNjOad5sFTdMOw{d=X#RrL{z-_;x_RPr=>TF$x7{Cs8**Ex_MaD%L`y7?n9~6EKhwSkM&2W_3 From 08f86ae0b67c4f589ad932bbfe593679f95bee34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Mon, 6 Jun 2016 20:30:44 +0200 Subject: [PATCH 23/67] instructions about how to paste YAML or JSON code Hopefully that will make issues easier to read. --- .github/ISSUE_TEMPLATE.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9f573cea189..9a56dca7f02 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -13,7 +13,19 @@ Also please indicate in the issue title which language/library is concerned. Eg: ##### Swagger declaration file content or url - + ##### Command line used for generation From 3c919974a7d622967b5657f418ff40717c8a9c49 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Tue, 7 Jun 2016 08:30:17 +0900 Subject: [PATCH 24/67] Fix 'isOauth' to 'isOAuth' in python template --- .../src/main/resources/python/configuration.mustache | 4 ++-- samples/client/petstore/python/README.md | 2 +- .../petstore/python/swagger_client/configuration.py | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index 2a26c651d7d..3d2e8db228b 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -219,7 +219,7 @@ class Configuration(object): 'key': 'Authorization', 'value': self.get_basic_auth_token() }, -{{/isBasic}}{{#isOauth}} +{{/isBasic}}{{#isOAuth}} '{{name}}': { 'type': 'oauth2', @@ -227,7 +227,7 @@ class Configuration(object): 'key': 'Authorization', 'value': 'Bearer ' + self.access_token }, -{{/isOauth}}{{/authMethods}} +{{/isOAuth}}{{/authMethods}} } def to_debug_report(self): diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 453d140f1f7..891785820de 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-05T23:15:10.095+09:00 +- Build date: 2016-06-07T08:27:42.099+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index 50b38c61d56..5fbb46a607f 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -221,6 +221,14 @@ class Configuration(object): :return: The Auth Settings information dict. """ return { + + 'petstore_auth': + { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, 'api_key': { 'type': 'api_key', From 483dba2aff3435385b9c694332e0b4f3256460d6 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Mon, 6 Jun 2016 21:24:08 -0400 Subject: [PATCH 25/67] [swagger-codegen-ignore] Skip file case test Windows There doesn't appear to be an excellent way to resolve a case sensitive test on Windows, so conditionally skipping the test on Windows. See #3047 --- .../codegen/ignore/CodegenIgnoreProcessorTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/ignore/CodegenIgnoreProcessorTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/ignore/CodegenIgnoreProcessorTest.java index 784fcfe8480..ef30ca48331 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/ignore/CodegenIgnoreProcessorTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/ignore/CodegenIgnoreProcessorTest.java @@ -1,6 +1,7 @@ package io.swagger.codegen.ignore; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.*; @@ -17,6 +18,7 @@ public class CodegenIgnoreProcessorTest { private static final Logger LOGGER = LoggerFactory.getLogger(CodegenIgnoreProcessorTest.class); private Boolean allowed; + private Boolean skip = false; private final String filename; private final String ignoreDefinition; private final String description; @@ -35,6 +37,11 @@ public class CodegenIgnoreProcessorTest { return this; } + CodegenIgnoreProcessorTest skipOnCondition(Boolean condition) { + this.skip = Boolean.TRUE.equals(condition); + return this; + } + CodegenIgnoreProcessorTest ignored() { this.allowed = false; return this; @@ -73,6 +80,10 @@ public class CodegenIgnoreProcessorTest { @Test public void evaluate() { + if(this.skip) { + return; + } + // Arrange try { // Lazily setup files to avoid conflicts and creation when these tests may not even run. @@ -97,7 +108,7 @@ public class CodegenIgnoreProcessorTest { // Matching filenames new CodegenIgnoreProcessorTest("build.sh", "build.sh", "A file when matching should ignore.").ignored(), new CodegenIgnoreProcessorTest("src/build.sh", "**/build.sh", "A file when matching nested files should ignore.").ignored(), - new CodegenIgnoreProcessorTest("Build.sh", "build.sh", "A file when non-matching should allow.").allowed(), + new CodegenIgnoreProcessorTest("Build.sh", "build.sh", "A file when non-matching should allow.").allowed().skipOnCondition(SystemUtils.IS_OS_WINDOWS), new CodegenIgnoreProcessorTest("build.sh", "/build.sh", "A rooted file when matching should ignore.").ignored(), new CodegenIgnoreProcessorTest("nested/build.sh", "/build.sh", "A rooted file definition when non-matching should allow.").allowed(), new CodegenIgnoreProcessorTest("src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "A file when matching exactly should ignore.").ignored(), From 3ae48b179a2308f19c40410f4b530c312997194b Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 7 Jun 2016 15:15:20 +0800 Subject: [PATCH 26/67] replaced global license file with default LICENSE --- .../io/swagger/codegen/DefaultCodegen.java | 6 ++- samples/server/petstore/rails5/LICENSE | 38 +++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) 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 39729dd14e1..8304849a14c 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 @@ -792,7 +792,11 @@ public class DefaultCodegen { importMapping.put("LocalDate", "org.joda.time.*"); importMapping.put("LocalTime", "org.joda.time.*"); - supportingFiles.add(new GlobalSupportingFile("LICENSE", "LICENSE")); + // we've used the .swagger-codegen-ignore approach as + // suppportingFiles can be cleared by code generator that extends + // the default codegen, leaving the commented code below for + // future reference + //supportingFiles.add(new GlobalSupportingFile("LICENSE", "LICENSE")); cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString())); diff --git a/samples/server/petstore/rails5/LICENSE b/samples/server/petstore/rails5/LICENSE index 309973afd74..8dada3edaf5 100644 --- a/samples/server/petstore/rails5/LICENSE +++ b/samples/server/petstore/rails5/LICENSE @@ -175,27 +175,27 @@ END OF TERMS AND CONDITIONS - APPENDIX: How to apply the Apache License to your work. + APPENDIX: How to apply the Apache License to your work. - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright {yyyy} {name of copyright owner} - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 012797adf160bb565ff7c9206a6dcd1b97fd596b Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 7 Jun 2016 23:53:41 +0800 Subject: [PATCH 27/67] add naming convention for vendor extension --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4cf901c2d3f..f94dfe8d93a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,11 +42,14 @@ Code change should conform to the programming style guide of the respective lang - Swift: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html - TypeScript: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines - For other languages, feel free to suggest. You may find the current code base not 100% conform to the coding style and we welcome contributions to fix those. +For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#vendorExtensions), please follow the naming convention below: +- For general vendor extension, use lower case and hyphen. e.g. `x-is-unique`, `x-content-type` +- For language-specified vendor extension, put it in the form of `x-{lang}-{extension-name}`. e.g. `x-objc-operation-id`, `x-java-feign-retry-limit` + ### Testing To add test cases (optional) covering the change in the code generator, please refer to [modules/swagger-codegen/src/test/java/io/swagger/codegen](https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/test/java/io/swagger/codegen) From 3ae39c95625bfd564c3db111b5b56cfcafbc5897 Mon Sep 17 00:00:00 2001 From: cbornet Date: Tue, 7 Jun 2016 22:39:34 +0200 Subject: [PATCH 28/67] support joda in feign and use it in sample --- bin/java-petstore-feign.sh | 2 +- .../Java/libraries/feign/ApiClient.mustache | 3 +++ .../Java/libraries/feign/pom.mustache | 14 +------------ samples/client/petstore/java/feign/pom.xml | 18 +++------------- .../java/io/swagger/client/ApiClient.java | 20 +++++++++--------- .../io/swagger/client/FormAwareEncoder.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 7 ++++--- .../java/io/swagger/client/api/PetApi.java | 2 +- .../java/io/swagger/client/api/StoreApi.java | 2 +- .../java/io/swagger/client/api/UserApi.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../java/io/swagger/client/model/Animal.java | 2 +- .../io/swagger/client/model/AnimalFarm.java | 2 +- .../io/swagger/client/model/ArrayTest.java | 2 +- .../java/io/swagger/client/model/Cat.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../java/io/swagger/client/model/Dog.java | 2 +- .../io/swagger/client/model/EnumTest.java | 2 +- .../io/swagger/client/model/FormatTest.java | 21 ++++++++++--------- ...ropertiesAndAdditionalPropertiesClass.java | 12 +++++------ .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../io/swagger/client/model/ModelReturn.java | 2 +- .../java/io/swagger/client/model/Name.java | 2 +- .../java/io/swagger/client/model/Order.java | 12 +++++------ .../java/io/swagger/client/model/Pet.java | 2 +- .../swagger/client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../io/swagger/client/api/FakeApiTest.java | 7 ++++--- .../swagger/petstore/test/StoreApiTest.java | 6 ++++-- 33 files changed, 75 insertions(+), 91 deletions(-) diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index 063b85f70a1..e28439842d9 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DdateLibrary=joda" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache index 61781ac9b70..be2e2d5e3ab 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -9,6 +9,7 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.joda.JodaModule; import feign.Feign; import feign.RequestInterceptor; @@ -129,6 +130,8 @@ public class ApiClient { objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.registerModule(new JodaModule()); return objectMapper; } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache index 03323a65a03..df5b965984e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache @@ -149,19 +149,7 @@ com.fasterxml.jackson.datatype jackson-datatype-joda - 2.1.5 - - - joda-time - joda-time - ${jodatime-version} - - - - - com.brsanthu - migbase64 - 2.2 + ${jackson-version} diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index 164399be4a6..6d055959b5e 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -100,8 +100,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 1.7 + 1.7 @@ -149,19 +149,7 @@ com.fasterxml.jackson.datatype jackson-datatype-joda - 2.1.5 - - - joda-time - joda-time - ${jodatime-version} - - - - - com.brsanthu - migbase64 - 2.2 + ${jackson-version} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java index 303927d064e..790e401a3d7 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java @@ -9,6 +9,7 @@ import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuil import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.joda.JodaModule; import feign.Feign; import feign.RequestInterceptor; @@ -18,11 +19,11 @@ import feign.slf4j.Slf4jLogger; import io.swagger.client.auth.*; import io.swagger.client.auth.OAuth.AccessTokenListener; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class ApiClient { public interface Api {} - private ObjectMapper objectMapper; + protected ObjectMapper objectMapper; private String basePath = "http://petstore.swagger.io/v2"; private Map apiAuthorizations; private Feign.Builder feignBuilder; @@ -42,16 +43,8 @@ public class ApiClient { RequestInterceptor auth; if (authName == "petstore_auth") { auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "test_api_client_id") { - auth = new ApiKeyAuth("header", "x-test_api_client_id"); - } else if (authName == "test_api_client_secret") { - auth = new ApiKeyAuth("header", "x-test_api_client_secret"); } else if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); - } else if (authName == "test_api_key_query") { - auth = new ApiKeyAuth("query", "test_api_key_query"); - } else if (authName == "test_api_key_header") { - auth = new ApiKeyAuth("header", "test_api_key_header"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } @@ -135,6 +128,13 @@ public class ApiClient { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.registerModule(new JodaModule()); + return objectMapper; + } + + public ObjectMapper getObjectMapper(){ return objectMapper; } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index fccefc933ce..082c11e0032 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index 4a4c14468b5..bc13cd205d5 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index 82ec4afc25f..c40f87ebdae 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -2,8 +2,9 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import java.util.ArrayList; import java.util.HashMap; @@ -11,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public interface FakeApi extends ApiClient.Api { @@ -37,5 +38,5 @@ public interface FakeApi extends ApiClient.Api { "Content-type: application/xml; charset=utf-8", "Accept: application/xml; charset=utf-8,application/json; charset=utf-8", }) - void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") Date date, @Param("dateTime") Date dateTime, @Param("password") String password); + void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") LocalDate date, @Param("dateTime") DateTime dateTime, @Param("password") String password); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index b568770101b..2f8c942bd74 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public interface PetApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 4ac08793f6c..98085dca230 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public interface StoreApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index 4ebcce8981c..f114d5f23c9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public interface UserApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index af4699c1cf5..c15373b66c8 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class AdditionalPropertiesClass { private Map mapProperty = new HashMap(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index 36a1e843312..c1c1a411607 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java index e5ba3d20af2..28a7b9c3be4 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -10,7 +10,7 @@ import java.util.List; /** * AnimalFarm */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class AnimalFarm extends ArrayList { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java index f5e4c25b5cf..455f93dc4f6 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java @@ -12,7 +12,7 @@ import java.util.List; /** * ArrayTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class ArrayTest { private List arrayOfString = new ArrayList(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index aea43d75c5e..f300be5fcad 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index 27adc7a820c..c299f04c7dd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index dcf82945e15..372d5bcb4f6 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index 5291f51c174..f038af89dda 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class EnumTest { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 3be249333df..06545402ab9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class FormatTest { private Integer integer = null; @@ -24,8 +25,8 @@ public class FormatTest { private String string = null; private byte[] _byte = null; private byte[] binary = null; - private Date date = null; - private Date dateTime = null; + private LocalDate date = null; + private DateTime dateTime = null; private String uuid = null; private String password = null; @@ -195,34 +196,34 @@ public class FormatTest { /** **/ - public FormatTest date(Date date) { + public FormatTest date(LocalDate date) { this.date = date; return this; } @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ - public FormatTest dateTime(Date dateTime) { + public FormatTest dateTime(DateTime dateTime) { this.dateTime = dateTime; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("dateTime") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 22d0e33388f..10af0257255 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -6,20 +6,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; - private Date dateTime = null; + private DateTime dateTime = null; private Map map = new HashMap(); @@ -42,17 +42,17 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ - public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) { this.dateTime = dateTime; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("dateTime") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index 226aa300ca8..fc398928514 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index 1dcd3c9b99b..408b2536a1b 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ModelApiResponse */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index d5bf9048c8a..e7b24a568e6 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index 4984f5e60b2..fae7beeef93 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 4a08d38f3b0..893d121daa2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -6,19 +6,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Order { private Long id = null; private Long petId = null; private Integer quantity = null; - private Date shipDate = null; + private DateTime shipDate = null; /** * Order Status @@ -98,17 +98,17 @@ public class Order { /** **/ - public Order shipDate(Date shipDate) { + public Order shipDate(DateTime shipDate) { this.shipDate = shipDate; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index 8e6e02a37d3..d426d6c216e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 02ded2afd7d..ddfa45b5dbd 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class ReadOnlyFirst { private String bar = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index 1bc8d287a76..b7dd8dc42ca 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 359f3c1d8fa..2bcfcc68c92 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index 3cb71c1a7fb..a6be090fd12 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T22:20:02.809+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") public class User { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java index 5a5df9a3ee6..504e027829f 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java @@ -1,8 +1,9 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import org.junit.Before; import org.junit.Test; @@ -40,8 +41,8 @@ public class FakeApiTest { Long int64 = null; Float _float = null; byte[] binary = null; - Date date = null; - Date dateTime = null; + LocalDate date = null; + DateTime dateTime = null; String password = null; // api.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java index ca14be28a80..92a3a951eb5 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/petstore/test/StoreApiTest.java @@ -4,13 +4,14 @@ import feign.FeignException; import io.swagger.TestUtils; -import io.swagger.client.*; +import io.swagger.client.ApiClient; import io.swagger.client.api.*; import io.swagger.client.model.*; import java.lang.reflect.Field; import java.util.Map; +import org.joda.time.DateTimeZone; import org.junit.*; import static org.junit.Assert.*; @@ -39,6 +40,7 @@ public class StoreApiTest { assertEquals(order.getId(), fetched.getId()); assertEquals(order.getPetId(), fetched.getPetId()); assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); } @Test @@ -63,7 +65,7 @@ public class StoreApiTest { Order order = new Order(); order.setPetId(new Long(200)); order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); + order.setShipDate(org.joda.time.DateTime.now()); order.setStatus(Order.StatusEnum.PLACED); order.setComplete(true); From 7916f5243d714ea38b07b4174f2e7721fb1b709f Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Tue, 7 Jun 2016 00:37:49 +0900 Subject: [PATCH 29/67] [Python] Fix bug of test files about packageName --- bin/python-petstore.sh | 2 +- .../main/resources/python/api_test.mustache | 8 +-- .../main/resources/python/model_test.mustache | 8 +-- samples/client/petstore/python/README.md | 2 +- .../client/petstore/python/docs/FakeApi.md | 8 +-- samples/client/petstore/python/docs/PetApi.md | 72 +++++++++---------- .../client/petstore/python/docs/StoreApi.md | 32 ++++----- .../client/petstore/python/docs/UserApi.md | 58 +++++++-------- .../__init__.py | 0 .../api_client.py | 0 .../apis/__init__.py | 0 .../apis/fake_api.py | 0 .../apis/pet_api.py | 0 .../apis/store_api.py | 0 .../apis/user_api.py | 0 .../configuration.py | 2 +- .../models/__init__.py | 0 .../models/additional_properties_class.py | 0 .../models/animal.py | 0 .../models/animal_farm.py | 0 .../models/api_response.py | 0 .../models/array_test.py | 0 .../models/cat.py | 0 .../models/category.py | 0 .../models/dog.py | 0 .../models/enum_class.py | 0 .../models/enum_test.py | 0 .../models/format_test.py | 0 ...perties_and_additional_properties_class.py | 0 .../models/model_200_response.py | 0 .../models/model_return.py | 0 .../models/name.py | 0 .../models/order.py | 0 .../models/pet.py | 0 .../models/read_only_first.py | 0 .../models/special_model_name.py | 0 .../models/tag.py | 0 .../models/user.py | 0 .../{swagger_client => petstore_api}/rest.py | 0 samples/client/petstore/python/setup.cfg | 2 +- samples/client/petstore/python/setup.py | 2 +- .../python/swagger_client.egg-info/PKG-INFO | 12 ---- .../dependency_links.txt | 1 - .../swagger_client.egg-info/requires.txt | 4 -- .../swagger_client.egg-info/top_level.txt | 3 - .../test/test_additional_properties_class.py | 8 +-- .../petstore/python/test/test_animal.py | 8 +-- .../petstore/python/test/test_animal_farm.py | 8 +-- .../petstore/python/test/test_api_response.py | 8 +-- .../petstore/python/test/test_array_test.py | 8 +-- .../client/petstore/python/test/test_cat.py | 8 +-- .../petstore/python/test/test_category.py | 8 +-- .../client/petstore/python/test/test_dog.py | 8 +-- .../petstore/python/test/test_enum_class.py | 8 +-- .../petstore/python/test/test_enum_test.py | 8 +-- .../petstore/python/test/test_fake_api.py | 8 +-- .../petstore/python/test/test_format_test.py | 8 +-- ...perties_and_additional_properties_class.py | 8 +-- .../python/test/test_model_200_response.py | 8 +-- .../petstore/python/test/test_model_return.py | 8 +-- .../client/petstore/python/test/test_name.py | 8 +-- .../client/petstore/python/test/test_order.py | 8 +-- .../client/petstore/python/test/test_pet.py | 8 +-- .../petstore/python/test/test_pet_api.py | 8 +-- .../python/test/test_read_only_first.py | 8 +-- .../python/test/test_special_model_name.py | 8 +-- .../petstore/python/test/test_store_api.py | 8 +-- .../client/petstore/python/test/test_tag.py | 8 +-- .../client/petstore/python/test/test_user.py | 8 +-- .../petstore/python/test/test_user_api.py | 8 +-- .../petstore/python/tests/test_api_client.py | 28 ++++---- .../python/tests/test_api_exception.py | 16 ++--- .../python/tests/test_deserialization.py | 12 ++-- .../petstore/python/tests/test_order_model.py | 6 +- .../petstore/python/tests/test_pet_api.py | 30 ++++---- .../petstore/python/tests/test_pet_model.py | 22 +++--- .../petstore/python/tests/test_store_api.py | 6 +- 77 files changed, 258 insertions(+), 278 deletions(-) rename samples/client/petstore/python/{swagger_client => petstore_api}/__init__.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/api_client.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/apis/__init__.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/apis/fake_api.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/apis/pet_api.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/apis/store_api.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/apis/user_api.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/configuration.py (99%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/__init__.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/additional_properties_class.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/animal.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/animal_farm.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/api_response.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/array_test.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/cat.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/category.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/dog.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/enum_class.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/enum_test.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/format_test.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/mixed_properties_and_additional_properties_class.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/model_200_response.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/model_return.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/name.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/order.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/pet.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/read_only_first.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/special_model_name.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/tag.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/models/user.py (100%) rename samples/client/petstore/python/{swagger_client => petstore_api}/rest.py (100%) delete mode 100644 samples/client/petstore/python/swagger_client.egg-info/PKG-INFO delete mode 100644 samples/client/petstore/python/swagger_client.egg-info/dependency_links.txt delete mode 100644 samples/client/petstore/python/swagger_client.egg-info/requires.txt delete mode 100644 samples/client/petstore/python/swagger_client.egg-info/top_level.txt diff --git a/bin/python-petstore.sh b/bin/python-petstore.sh index ef120089f45..0fe89ea39ed 100755 --- a/bin/python-petstore.sh +++ b/bin/python-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python -DpackageName=petstore_api" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/python/api_test.mustache b/modules/swagger-codegen/src/main/resources/python/api_test.mustache index a301d64722a..f0f07f7189e 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_test.mustache @@ -8,16 +8,16 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.apis.{{classVarName}} import {{classname}} +import {{packageName}} +from {{packageName}}.rest import ApiException +from {{packageName}}.apis.{{classVarName}} import {{classname}} class {{#operations}}Test{{classname}}(unittest.TestCase): """ {{classname}} unit test stubs """ def setUp(self): - self.api = swagger_client.apis.{{classVarName}}.{{classname}}() + self.api = {{packageName}}.apis.{{classVarName}}.{{classname}}() def tearDown(self): pass diff --git a/modules/swagger-codegen/src/main/resources/python/model_test.mustache b/modules/swagger-codegen/src/main/resources/python/model_test.mustache index 3533fa11063..9e1b72b14a0 100644 --- a/modules/swagger-codegen/src/main/resources/python/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model_test.mustache @@ -10,9 +10,9 @@ import unittest {{#models}} {{#model}} -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.{{classFilename}} import {{classname}} +import {{packageName}} +from {{packageName}}.rest import ApiException +from {{packageName}}.models.{{classFilename}} import {{classname}} class Test{{classname}}(unittest.TestCase): @@ -28,7 +28,7 @@ class Test{{classname}}(unittest.TestCase): """ Test {{classname}} """ - model = swagger_client.models.{{classFilename}}.{{classname}}() + model = {{packageName}}.models.{{classFilename}}.{{classname}}() {{/model}} {{/models}} diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 891785820de..7bf57caa2b8 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-07T08:27:42.099+09:00 +- Build date: 2016-06-07T00:29:52.148+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index 6853fa0bee9..16656613075 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -1,4 +1,4 @@ -# swagger_client.FakeApi +# petstore_api.FakeApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -17,12 +17,12 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.FakeApi() +api_instance = petstore_api.FakeApi() number = 3.4 # float | None double = 1.2 # float | None string = 'string_example' # str | None diff --git a/samples/client/petstore/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index fb69778f611..109b264942f 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -1,4 +1,4 @@ -# swagger_client.PetApi +# petstore_api.PetApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -24,16 +24,16 @@ Add a new pet to the store ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() -body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store +api_instance = petstore_api.PetApi() +body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store try: # Add a new pet to the store @@ -73,15 +73,15 @@ Deletes a pet ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() pet_id = 789 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -124,15 +124,15 @@ Multiple status values can be provided with comma separated strings ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() status = ['status_example'] # list[str] | Status values that need to be considered for filter try: @@ -174,15 +174,15 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() tags = ['tags_example'] # list[str] | Tags to filter by try: @@ -224,17 +224,17 @@ Returns a single pet ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure API key authorization: api_key -swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' +petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer' +# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() pet_id = 789 # int | ID of pet to return try: @@ -276,16 +276,16 @@ Update an existing pet ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() -body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store +api_instance = petstore_api.PetApi() +body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store try: # Update an existing pet @@ -325,15 +325,15 @@ Updates a pet in the store with form data ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() pet_id = 789 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -378,15 +378,15 @@ uploads an image ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' +petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi() +api_instance = petstore_api.PetApi() pet_id = 789 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) file = '/path/to/file.txt' # file | file to upload (optional) diff --git a/samples/client/petstore/python/docs/StoreApi.md b/samples/client/petstore/python/docs/StoreApi.md index 537009bde52..6b71a78659d 100644 --- a/samples/client/petstore/python/docs/StoreApi.md +++ b/samples/client/petstore/python/docs/StoreApi.md @@ -1,4 +1,4 @@ -# swagger_client.StoreApi +# petstore_api.StoreApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -20,12 +20,12 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.StoreApi() +api_instance = petstore_api.StoreApi() order_id = 'order_id_example' # str | ID of the order that needs to be deleted try: @@ -66,17 +66,17 @@ Returns a map of status codes to quantities ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # Configure API key authorization: api_key -swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' +petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer' +# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer' # create an instance of the API class -api_instance = swagger_client.StoreApi() +api_instance = petstore_api.StoreApi() try: # Returns pet inventories by status @@ -114,12 +114,12 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.StoreApi() +api_instance = petstore_api.StoreApi() order_id = 789 # int | ID of pet that needs to be fetched try: @@ -161,13 +161,13 @@ Place an order for a pet ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.StoreApi() -body = swagger_client.Order() # Order | order placed for purchasing the pet +api_instance = petstore_api.StoreApi() +body = petstore_api.Order() # Order | order placed for purchasing the pet try: # Place an order for a pet diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index 1975c1fe7f3..4009418b13c 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -1,4 +1,4 @@ -# swagger_client.UserApi +# petstore_api.UserApi All URIs are relative to *http://petstore.swagger.io/v2* @@ -24,13 +24,13 @@ This can only be done by the logged in user. ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = swagger_client.User() # User | Created user object +api_instance = petstore_api.UserApi() +body = petstore_api.User() # User | Created user object try: # Create user @@ -70,13 +70,13 @@ Creates list of users with given input array ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object +api_instance = petstore_api.UserApi() +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -116,13 +116,13 @@ Creates list of users with given input array ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object +api_instance = petstore_api.UserApi() +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -162,12 +162,12 @@ This can only be done by the logged in user. ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = petstore_api.UserApi() username = 'username_example' # str | The name that needs to be deleted try: @@ -208,12 +208,12 @@ Get user by user name ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = petstore_api.UserApi() username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. try: @@ -255,12 +255,12 @@ Logs user into the system ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = petstore_api.UserApi() username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -304,12 +304,12 @@ Logs out current logged in user session ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = petstore_api.UserApi() try: # Logs out current logged in user session @@ -346,14 +346,14 @@ This can only be done by the logged in user. ### Example ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.UserApi() +api_instance = petstore_api.UserApi() username = 'username_example' # str | name that need to be deleted -body = swagger_client.User() # User | Updated user object +body = petstore_api.User() # User | Updated user object try: # Updated user diff --git a/samples/client/petstore/python/swagger_client/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py similarity index 100% rename from samples/client/petstore/python/swagger_client/__init__.py rename to samples/client/petstore/python/petstore_api/__init__.py diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py similarity index 100% rename from samples/client/petstore/python/swagger_client/api_client.py rename to samples/client/petstore/python/petstore_api/api_client.py diff --git a/samples/client/petstore/python/swagger_client/apis/__init__.py b/samples/client/petstore/python/petstore_api/apis/__init__.py similarity index 100% rename from samples/client/petstore/python/swagger_client/apis/__init__.py rename to samples/client/petstore/python/petstore_api/apis/__init__.py diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/petstore_api/apis/fake_api.py similarity index 100% rename from samples/client/petstore/python/swagger_client/apis/fake_api.py rename to samples/client/petstore/python/petstore_api/apis/fake_api.py diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/petstore_api/apis/pet_api.py similarity index 100% rename from samples/client/petstore/python/swagger_client/apis/pet_api.py rename to samples/client/petstore/python/petstore_api/apis/pet_api.py diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/petstore_api/apis/store_api.py similarity index 100% rename from samples/client/petstore/python/swagger_client/apis/store_api.py rename to samples/client/petstore/python/petstore_api/apis/store_api.py diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/petstore_api/apis/user_api.py similarity index 100% rename from samples/client/petstore/python/swagger_client/apis/user_api.py rename to samples/client/petstore/python/petstore_api/apis/user_api.py diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py similarity index 99% rename from samples/client/petstore/python/swagger_client/configuration.py rename to samples/client/petstore/python/petstore_api/configuration.py index 5fbb46a607f..76f1f57c784 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -82,7 +82,7 @@ class Configuration(object): # Logging Settings self.logger = {} - self.logger["package_logger"] = logging.getLogger("swagger_client") + self.logger["package_logger"] = logging.getLogger("petstore_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' diff --git a/samples/client/petstore/python/swagger_client/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/__init__.py rename to samples/client/petstore/python/petstore_api/models/__init__.py diff --git a/samples/client/petstore/python/swagger_client/models/additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/additional_properties_class.py rename to samples/client/petstore/python/petstore_api/models/additional_properties_class.py diff --git a/samples/client/petstore/python/swagger_client/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/animal.py rename to samples/client/petstore/python/petstore_api/models/animal.py diff --git a/samples/client/petstore/python/swagger_client/models/animal_farm.py b/samples/client/petstore/python/petstore_api/models/animal_farm.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/animal_farm.py rename to samples/client/petstore/python/petstore_api/models/animal_farm.py diff --git a/samples/client/petstore/python/swagger_client/models/api_response.py b/samples/client/petstore/python/petstore_api/models/api_response.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/api_response.py rename to samples/client/petstore/python/petstore_api/models/api_response.py diff --git a/samples/client/petstore/python/swagger_client/models/array_test.py b/samples/client/petstore/python/petstore_api/models/array_test.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/array_test.py rename to samples/client/petstore/python/petstore_api/models/array_test.py diff --git a/samples/client/petstore/python/swagger_client/models/cat.py b/samples/client/petstore/python/petstore_api/models/cat.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/cat.py rename to samples/client/petstore/python/petstore_api/models/cat.py diff --git a/samples/client/petstore/python/swagger_client/models/category.py b/samples/client/petstore/python/petstore_api/models/category.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/category.py rename to samples/client/petstore/python/petstore_api/models/category.py diff --git a/samples/client/petstore/python/swagger_client/models/dog.py b/samples/client/petstore/python/petstore_api/models/dog.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/dog.py rename to samples/client/petstore/python/petstore_api/models/dog.py diff --git a/samples/client/petstore/python/swagger_client/models/enum_class.py b/samples/client/petstore/python/petstore_api/models/enum_class.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/enum_class.py rename to samples/client/petstore/python/petstore_api/models/enum_class.py diff --git a/samples/client/petstore/python/swagger_client/models/enum_test.py b/samples/client/petstore/python/petstore_api/models/enum_test.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/enum_test.py rename to samples/client/petstore/python/petstore_api/models/enum_test.py diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/petstore_api/models/format_test.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/format_test.py rename to samples/client/petstore/python/petstore_api/models/format_test.py diff --git a/samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/mixed_properties_and_additional_properties_class.py rename to samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/client/petstore/python/swagger_client/models/model_200_response.py b/samples/client/petstore/python/petstore_api/models/model_200_response.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/model_200_response.py rename to samples/client/petstore/python/petstore_api/models/model_200_response.py diff --git a/samples/client/petstore/python/swagger_client/models/model_return.py b/samples/client/petstore/python/petstore_api/models/model_return.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/model_return.py rename to samples/client/petstore/python/petstore_api/models/model_return.py diff --git a/samples/client/petstore/python/swagger_client/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/name.py rename to samples/client/petstore/python/petstore_api/models/name.py diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/petstore_api/models/order.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/order.py rename to samples/client/petstore/python/petstore_api/models/order.py diff --git a/samples/client/petstore/python/swagger_client/models/pet.py b/samples/client/petstore/python/petstore_api/models/pet.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/pet.py rename to samples/client/petstore/python/petstore_api/models/pet.py diff --git a/samples/client/petstore/python/swagger_client/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/read_only_first.py rename to samples/client/petstore/python/petstore_api/models/read_only_first.py diff --git a/samples/client/petstore/python/swagger_client/models/special_model_name.py b/samples/client/petstore/python/petstore_api/models/special_model_name.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/special_model_name.py rename to samples/client/petstore/python/petstore_api/models/special_model_name.py diff --git a/samples/client/petstore/python/swagger_client/models/tag.py b/samples/client/petstore/python/petstore_api/models/tag.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/tag.py rename to samples/client/petstore/python/petstore_api/models/tag.py diff --git a/samples/client/petstore/python/swagger_client/models/user.py b/samples/client/petstore/python/petstore_api/models/user.py similarity index 100% rename from samples/client/petstore/python/swagger_client/models/user.py rename to samples/client/petstore/python/petstore_api/models/user.py diff --git a/samples/client/petstore/python/swagger_client/rest.py b/samples/client/petstore/python/petstore_api/rest.py similarity index 100% rename from samples/client/petstore/python/swagger_client/rest.py rename to samples/client/petstore/python/petstore_api/rest.py diff --git a/samples/client/petstore/python/setup.cfg b/samples/client/petstore/python/setup.cfg index c9eef8726d6..26b7a359d58 100644 --- a/samples/client/petstore/python/setup.cfg +++ b/samples/client/petstore/python/setup.cfg @@ -4,7 +4,7 @@ verbosity=2 randomize=true exe=true with-coverage=true -cover-package=swagger_client +cover-package=petstore_api cover-erase=true [flake8] diff --git a/samples/client/petstore/python/setup.py b/samples/client/petstore/python/setup.py index 2029c83372c..b15651ff2b5 100644 --- a/samples/client/petstore/python/setup.py +++ b/samples/client/petstore/python/setup.py @@ -25,7 +25,7 @@ import sys from setuptools import setup, find_packages -NAME = "swagger_client" +NAME = "petstore_api" VERSION = "1.0.0" # To install the library, run the following diff --git a/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO b/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO deleted file mode 100644 index 494a1526640..00000000000 --- a/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO +++ /dev/null @@ -1,12 +0,0 @@ -Metadata-Version: 1.0 -Name: swagger-client -Version: 1.0.0 -Summary: Swagger Petstore -Home-page: UNKNOWN -Author: UNKNOWN -Author-email: apiteam@swagger.io -License: UNKNOWN -Description: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \ - -Keywords: Swagger,Swagger Petstore -Platform: UNKNOWN diff --git a/samples/client/petstore/python/swagger_client.egg-info/dependency_links.txt b/samples/client/petstore/python/swagger_client.egg-info/dependency_links.txt deleted file mode 100644 index 8b137891791..00000000000 --- a/samples/client/petstore/python/swagger_client.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/samples/client/petstore/python/swagger_client.egg-info/requires.txt b/samples/client/petstore/python/swagger_client.egg-info/requires.txt deleted file mode 100644 index 86355123cff..00000000000 --- a/samples/client/petstore/python/swagger_client.egg-info/requires.txt +++ /dev/null @@ -1,4 +0,0 @@ -urllib3 >= 1.15 -six >= 1.10 -certifi -python-dateutil diff --git a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt deleted file mode 100644 index 01f6691e7ca..00000000000 --- a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt +++ /dev/null @@ -1,3 +0,0 @@ -swagger_client -test -tests diff --git a/samples/client/petstore/python/test/test_additional_properties_class.py b/samples/client/petstore/python/test/test_additional_properties_class.py index f2370e4ea21..de3d2bcd8b6 100644 --- a/samples/client/petstore/python/test/test_additional_properties_class.py +++ b/samples/client/petstore/python/test/test_additional_properties_class.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.additional_properties_class import AdditionalPropertiesClass +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): @@ -46,7 +46,7 @@ class TestAdditionalPropertiesClass(unittest.TestCase): """ Test AdditionalPropertiesClass """ - model = swagger_client.models.additional_properties_class.AdditionalPropertiesClass() + model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_animal.py b/samples/client/petstore/python/test/test_animal.py index 83c8f872250..7db98a10170 100644 --- a/samples/client/petstore/python/test/test_animal.py +++ b/samples/client/petstore/python/test/test_animal.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.animal import Animal +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal import Animal class TestAnimal(unittest.TestCase): @@ -46,7 +46,7 @@ class TestAnimal(unittest.TestCase): """ Test Animal """ - model = swagger_client.models.animal.Animal() + model = petstore_api.models.animal.Animal() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_animal_farm.py b/samples/client/petstore/python/test/test_animal_farm.py index 637d259b1e8..e4ecbf50478 100644 --- a/samples/client/petstore/python/test/test_animal_farm.py +++ b/samples/client/petstore/python/test/test_animal_farm.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.animal_farm import AnimalFarm +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal_farm import AnimalFarm class TestAnimalFarm(unittest.TestCase): @@ -46,7 +46,7 @@ class TestAnimalFarm(unittest.TestCase): """ Test AnimalFarm """ - model = swagger_client.models.animal_farm.AnimalFarm() + model = petstore_api.models.animal_farm.AnimalFarm() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_api_response.py b/samples/client/petstore/python/test/test_api_response.py index 6ee0ef03ae9..9c62f641cd7 100644 --- a/samples/client/petstore/python/test/test_api_response.py +++ b/samples/client/petstore/python/test/test_api_response.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.api_response import ApiResponse +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.api_response import ApiResponse class TestApiResponse(unittest.TestCase): @@ -46,7 +46,7 @@ class TestApiResponse(unittest.TestCase): """ Test ApiResponse """ - model = swagger_client.models.api_response.ApiResponse() + model = petstore_api.models.api_response.ApiResponse() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_array_test.py b/samples/client/petstore/python/test/test_array_test.py index 7d2e9ff9fe9..a5509779cc5 100644 --- a/samples/client/petstore/python/test/test_array_test.py +++ b/samples/client/petstore/python/test/test_array_test.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.array_test import ArrayTest +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_test import ArrayTest class TestArrayTest(unittest.TestCase): @@ -46,7 +46,7 @@ class TestArrayTest(unittest.TestCase): """ Test ArrayTest """ - model = swagger_client.models.array_test.ArrayTest() + model = petstore_api.models.array_test.ArrayTest() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_cat.py b/samples/client/petstore/python/test/test_cat.py index 8baccfa294d..3a9f7f1b75d 100644 --- a/samples/client/petstore/python/test/test_cat.py +++ b/samples/client/petstore/python/test/test_cat.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.cat import Cat +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.cat import Cat class TestCat(unittest.TestCase): @@ -46,7 +46,7 @@ class TestCat(unittest.TestCase): """ Test Cat """ - model = swagger_client.models.cat.Cat() + model = petstore_api.models.cat.Cat() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_category.py b/samples/client/petstore/python/test/test_category.py index ff57ffb1f7d..f4f43796675 100644 --- a/samples/client/petstore/python/test/test_category.py +++ b/samples/client/petstore/python/test/test_category.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.category import Category +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.category import Category class TestCategory(unittest.TestCase): @@ -46,7 +46,7 @@ class TestCategory(unittest.TestCase): """ Test Category """ - model = swagger_client.models.category.Category() + model = petstore_api.models.category.Category() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_dog.py b/samples/client/petstore/python/test/test_dog.py index cb44931140e..6bac6d65c30 100644 --- a/samples/client/petstore/python/test/test_dog.py +++ b/samples/client/petstore/python/test/test_dog.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.dog import Dog +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.dog import Dog class TestDog(unittest.TestCase): @@ -46,7 +46,7 @@ class TestDog(unittest.TestCase): """ Test Dog """ - model = swagger_client.models.dog.Dog() + model = petstore_api.models.dog.Dog() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_enum_class.py b/samples/client/petstore/python/test/test_enum_class.py index 488e8306c8f..6d9c50255df 100644 --- a/samples/client/petstore/python/test/test_enum_class.py +++ b/samples/client/petstore/python/test/test_enum_class.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.enum_class import EnumClass +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_class import EnumClass class TestEnumClass(unittest.TestCase): @@ -46,7 +46,7 @@ class TestEnumClass(unittest.TestCase): """ Test EnumClass """ - model = swagger_client.models.enum_class.EnumClass() + model = petstore_api.models.enum_class.EnumClass() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_enum_test.py b/samples/client/petstore/python/test/test_enum_test.py index bbe985aeeaf..aa8d86a6d78 100644 --- a/samples/client/petstore/python/test/test_enum_test.py +++ b/samples/client/petstore/python/test/test_enum_test.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.enum_test import EnumTest +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_test import EnumTest class TestEnumTest(unittest.TestCase): @@ -46,7 +46,7 @@ class TestEnumTest(unittest.TestCase): """ Test EnumTest """ - model = swagger_client.models.enum_test.EnumTest() + model = petstore_api.models.enum_test.EnumTest() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py index fb480485829..cddf28289ba 100644 --- a/samples/client/petstore/python/test/test_fake_api.py +++ b/samples/client/petstore/python/test/test_fake_api.py @@ -28,16 +28,16 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.apis.fake_api import FakeApi +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_api import FakeApi class TestFakeApi(unittest.TestCase): """ FakeApi unit test stubs """ def setUp(self): - self.api = swagger_client.apis.fake_api.FakeApi() + self.api = petstore_api.apis.fake_api.FakeApi() def tearDown(self): pass diff --git a/samples/client/petstore/python/test/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py index 966a0887f0a..2c3d0039dce 100644 --- a/samples/client/petstore/python/test/test_format_test.py +++ b/samples/client/petstore/python/test/test_format_test.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.format_test import FormatTest +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.format_test import FormatTest class TestFormatTest(unittest.TestCase): @@ -46,7 +46,7 @@ class TestFormatTest(unittest.TestCase): """ Test FormatTest """ - model = swagger_client.models.format_test.FormatTest() + model = petstore_api.models.format_test.FormatTest() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py index f19e0211af7..90f13e029e2 100644 --- a/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): @@ -46,7 +46,7 @@ class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): """ Test MixedPropertiesAndAdditionalPropertiesClass """ - model = swagger_client.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() + model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_model_200_response.py b/samples/client/petstore/python/test/test_model_200_response.py index 74519b4bac5..0b30fa81c89 100644 --- a/samples/client/petstore/python/test/test_model_200_response.py +++ b/samples/client/petstore/python/test/test_model_200_response.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.model_200_response import Model200Response +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_200_response import Model200Response class TestModel200Response(unittest.TestCase): @@ -46,7 +46,7 @@ class TestModel200Response(unittest.TestCase): """ Test Model200Response """ - model = swagger_client.models.model_200_response.Model200Response() + model = petstore_api.models.model_200_response.Model200Response() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_model_return.py b/samples/client/petstore/python/test/test_model_return.py index 54c9422545d..149d658c7cf 100644 --- a/samples/client/petstore/python/test/test_model_return.py +++ b/samples/client/petstore/python/test/test_model_return.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.model_return import ModelReturn +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_return import ModelReturn class TestModelReturn(unittest.TestCase): @@ -46,7 +46,7 @@ class TestModelReturn(unittest.TestCase): """ Test ModelReturn """ - model = swagger_client.models.model_return.ModelReturn() + model = petstore_api.models.model_return.ModelReturn() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_name.py b/samples/client/petstore/python/test/test_name.py index be10b1ddd78..ae3b6106d62 100644 --- a/samples/client/petstore/python/test/test_name.py +++ b/samples/client/petstore/python/test/test_name.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.name import Name +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.name import Name class TestName(unittest.TestCase): @@ -46,7 +46,7 @@ class TestName(unittest.TestCase): """ Test Name """ - model = swagger_client.models.name.Name() + model = petstore_api.models.name.Name() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_order.py b/samples/client/petstore/python/test/test_order.py index 21c2b4830d9..e2a1290ffc7 100644 --- a/samples/client/petstore/python/test/test_order.py +++ b/samples/client/petstore/python/test/test_order.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.order import Order +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.order import Order class TestOrder(unittest.TestCase): @@ -46,7 +46,7 @@ class TestOrder(unittest.TestCase): """ Test Order """ - model = swagger_client.models.order.Order() + model = petstore_api.models.order.Order() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_pet.py b/samples/client/petstore/python/test/test_pet.py index fc0ce0a727c..9148c0ac119 100644 --- a/samples/client/petstore/python/test/test_pet.py +++ b/samples/client/petstore/python/test/test_pet.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.pet import Pet +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.pet import Pet class TestPet(unittest.TestCase): @@ -46,7 +46,7 @@ class TestPet(unittest.TestCase): """ Test Pet """ - model = swagger_client.models.pet.Pet() + model = petstore_api.models.pet.Pet() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_pet_api.py b/samples/client/petstore/python/test/test_pet_api.py index 8ea0c9c0acd..c9ef2d87c45 100644 --- a/samples/client/petstore/python/test/test_pet_api.py +++ b/samples/client/petstore/python/test/test_pet_api.py @@ -28,16 +28,16 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.apis.pet_api import PetApi +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.pet_api import PetApi class TestPetApi(unittest.TestCase): """ PetApi unit test stubs """ def setUp(self): - self.api = swagger_client.apis.pet_api.PetApi() + self.api = petstore_api.apis.pet_api.PetApi() def tearDown(self): pass diff --git a/samples/client/petstore/python/test/test_read_only_first.py b/samples/client/petstore/python/test/test_read_only_first.py index ea7a0ad76e8..3579ebefb48 100644 --- a/samples/client/petstore/python/test/test_read_only_first.py +++ b/samples/client/petstore/python/test/test_read_only_first.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.read_only_first import ReadOnlyFirst +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): @@ -46,7 +46,7 @@ class TestReadOnlyFirst(unittest.TestCase): """ Test ReadOnlyFirst """ - model = swagger_client.models.read_only_first.ReadOnlyFirst() + model = petstore_api.models.read_only_first.ReadOnlyFirst() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_special_model_name.py b/samples/client/petstore/python/test/test_special_model_name.py index e76bc9bbf9b..1991883e3c1 100644 --- a/samples/client/petstore/python/test/test_special_model_name.py +++ b/samples/client/petstore/python/test/test_special_model_name.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.special_model_name import SpecialModelName +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): @@ -46,7 +46,7 @@ class TestSpecialModelName(unittest.TestCase): """ Test SpecialModelName """ - model = swagger_client.models.special_model_name.SpecialModelName() + model = petstore_api.models.special_model_name.SpecialModelName() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_store_api.py b/samples/client/petstore/python/test/test_store_api.py index ecce38463b5..0278685372b 100644 --- a/samples/client/petstore/python/test/test_store_api.py +++ b/samples/client/petstore/python/test/test_store_api.py @@ -28,16 +28,16 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.apis.store_api import StoreApi +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.store_api import StoreApi class TestStoreApi(unittest.TestCase): """ StoreApi unit test stubs """ def setUp(self): - self.api = swagger_client.apis.store_api.StoreApi() + self.api = petstore_api.apis.store_api.StoreApi() def tearDown(self): pass diff --git a/samples/client/petstore/python/test/test_tag.py b/samples/client/petstore/python/test/test_tag.py index db35da374ae..c86dcbb1d5f 100644 --- a/samples/client/petstore/python/test/test_tag.py +++ b/samples/client/petstore/python/test/test_tag.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.tag import Tag +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.tag import Tag class TestTag(unittest.TestCase): @@ -46,7 +46,7 @@ class TestTag(unittest.TestCase): """ Test Tag """ - model = swagger_client.models.tag.Tag() + model = petstore_api.models.tag.Tag() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_user.py b/samples/client/petstore/python/test/test_user.py index e57b3600f0e..328c07baa88 100644 --- a/samples/client/petstore/python/test/test_user.py +++ b/samples/client/petstore/python/test/test_user.py @@ -28,9 +28,9 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.models.user import User +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.user import User class TestUser(unittest.TestCase): @@ -46,7 +46,7 @@ class TestUser(unittest.TestCase): """ Test User """ - model = swagger_client.models.user.User() + model = petstore_api.models.user.User() if __name__ == '__main__': diff --git a/samples/client/petstore/python/test/test_user_api.py b/samples/client/petstore/python/test/test_user_api.py index 88c2f862983..032d00af315 100644 --- a/samples/client/petstore/python/test/test_user_api.py +++ b/samples/client/petstore/python/test/test_user_api.py @@ -28,16 +28,16 @@ import os import sys import unittest -import swagger_client -from swagger_client.rest import ApiException -from swagger_client.apis.user_api import UserApi +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.user_api import UserApi class TestUserApi(unittest.TestCase): """ UserApi unit test stubs """ def setUp(self): - self.api = swagger_client.apis.user_api.UserApi() + self.api = petstore_api.apis.user_api.UserApi() def tearDown(self): pass diff --git a/samples/client/petstore/python/tests/test_api_client.py b/samples/client/petstore/python/tests/test_api_client.py index 61c57cb7e46..972175835f3 100644 --- a/samples/client/petstore/python/tests/test_api_client.py +++ b/samples/client/petstore/python/tests/test_api_client.py @@ -12,8 +12,8 @@ import time import unittest from dateutil.parser import parse -import swagger_client -import swagger_client.configuration +import petstore_api +import petstore_api.configuration HOST = 'http://petstore.swagger.io/v2' @@ -21,20 +21,20 @@ HOST = 'http://petstore.swagger.io/v2' class ApiClientTests(unittest.TestCase): def setUp(self): - self.api_client = swagger_client.ApiClient(HOST) + self.api_client = petstore_api.ApiClient(HOST) def test_configuration(self): - swagger_client.configuration.api_key['api_key'] = '123456' - swagger_client.configuration.api_key_prefix['api_key'] = 'PREFIX' - swagger_client.configuration.username = 'test_username' - swagger_client.configuration.password = 'test_password' + petstore_api.configuration.api_key['api_key'] = '123456' + petstore_api.configuration.api_key_prefix['api_key'] = 'PREFIX' + petstore_api.configuration.username = 'test_username' + petstore_api.configuration.password = 'test_password' header_params = {'test1': 'value1'} query_params = {'test2': 'value2'} auth_settings = ['api_key', 'unknown'] # test prefix - self.assertEqual('PREFIX', swagger_client.configuration.api_key_prefix['api_key']) + self.assertEqual('PREFIX', petstore_api.configuration.api_key_prefix['api_key']) # update parameters based on auth setting self.api_client.update_params_for_auth(header_params, query_params, auth_settings) @@ -45,8 +45,8 @@ class ApiClientTests(unittest.TestCase): self.assertEqual(query_params['test2'], 'value2') # test basic auth - self.assertEqual('test_username', swagger_client.configuration.username) - self.assertEqual('test_password', swagger_client.configuration.password) + self.assertEqual('test_username', petstore_api.configuration.username) + self.assertEqual('test_password', petstore_api.configuration.password) def test_select_header_accept(self): accepts = ['APPLICATION/JSON', 'APPLICATION/XML'] @@ -139,17 +139,17 @@ class ApiClientTests(unittest.TestCase): "status": "available", "photoUrls": ["http://foo.bar.com/3", "http://foo.bar.com/4"]} - pet = swagger_client.Pet() + pet = petstore_api.Pet() pet.id = pet_dict["id"] pet.name = pet_dict["name"] - cate = swagger_client.Category() + cate = petstore_api.Category() cate.id = pet_dict["category"]["id"] cate.name = pet_dict["category"]["name"] pet.category = cate - tag1 = swagger_client.Tag() + tag1 = petstore_api.Tag() tag1.id = pet_dict["tags"][0]["id"] tag1.name = pet_dict["tags"][0]["name"] - tag2 = swagger_client.Tag() + tag2 = petstore_api.Tag() tag2.id = pet_dict["tags"][1]["id"] tag2.name = pet_dict["tags"][1]["name"] pet.tags = [tag1, tag2] diff --git a/samples/client/petstore/python/tests/test_api_exception.py b/samples/client/petstore/python/tests/test_api_exception.py index 96ca4e7bfbc..8df2b681f01 100644 --- a/samples/client/petstore/python/tests/test_api_exception.py +++ b/samples/client/petstore/python/tests/test_api_exception.py @@ -3,7 +3,7 @@ """ Run the tests. $ pip install nose (optional) -$ cd swagger_client-python +$ cd petstore_api-python $ nosetests -v """ @@ -12,25 +12,25 @@ import sys import time import unittest -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException class ApiExceptionTests(unittest.TestCase): def setUp(self): - self.api_client = swagger_client.ApiClient() - self.pet_api = swagger_client.PetApi(self.api_client) + self.api_client = petstore_api.ApiClient() + self.pet_api = petstore_api.PetApi(self.api_client) self.setUpModels() def setUpModels(self): - self.category = swagger_client.Category() + self.category = petstore_api.Category() self.category.id = int(time.time()) self.category.name = "dog" - self.tag = swagger_client.Tag() + self.tag = petstore_api.Tag() self.tag.id = int(time.time()) self.tag.name = "blank" - self.pet = swagger_client.Pet() + self.pet = petstore_api.Pet() self.pet.id = int(time.time()) self.pet.name = "hello kity" self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"] diff --git a/samples/client/petstore/python/tests/test_deserialization.py b/samples/client/petstore/python/tests/test_deserialization.py index e1d7e250b4b..143f22b64bd 100644 --- a/samples/client/petstore/python/tests/test_deserialization.py +++ b/samples/client/petstore/python/tests/test_deserialization.py @@ -11,13 +11,13 @@ import time import unittest import datetime -import swagger_client +import petstore_api class DeserializationTests(unittest.TestCase): def setUp(self): - self.api_client = swagger_client.ApiClient() + self.api_client = petstore_api.ApiClient() self.deserialize = self.api_client._ApiClient__deserialize def test_deserialize_dict_str_pet(self): @@ -45,7 +45,7 @@ class DeserializationTests(unittest.TestCase): deserialized = self.deserialize(data, 'dict(str, Pet)') self.assertTrue(isinstance(deserialized, dict)) - self.assertTrue(isinstance(deserialized['pet'], swagger_client.Pet)) + self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet)) def test_deserialize_dict_str_int(self): """ deserialize dict(str, int) """ @@ -96,10 +96,10 @@ class DeserializationTests(unittest.TestCase): "status": "available" } deserialized = self.deserialize(data, "Pet") - self.assertTrue(isinstance(deserialized, swagger_client.Pet)) + self.assertTrue(isinstance(deserialized, petstore_api.Pet)) self.assertEqual(deserialized.id, 0) self.assertEqual(deserialized.name, "doggie") - self.assertTrue(isinstance(deserialized.category, swagger_client.Category)) + self.assertTrue(isinstance(deserialized.category, petstore_api.Category)) self.assertEqual(deserialized.category.name, "string") self.assertTrue(isinstance(deserialized.tags, list)) self.assertEqual(deserialized.tags[0].name, "string") @@ -145,7 +145,7 @@ class DeserializationTests(unittest.TestCase): }] deserialized = self.deserialize(data, "list[Pet]") self.assertTrue(isinstance(deserialized, list)) - self.assertTrue(isinstance(deserialized[0], swagger_client.Pet)) + self.assertTrue(isinstance(deserialized[0], petstore_api.Pet)) self.assertEqual(deserialized[0].id, 0) self.assertEqual(deserialized[1].id, 1) self.assertEqual(deserialized[0].name, "doggie0") diff --git a/samples/client/petstore/python/tests/test_order_model.py b/samples/client/petstore/python/tests/test_order_model.py index e411ca0103d..710f3c175a9 100644 --- a/samples/client/petstore/python/tests/test_order_model.py +++ b/samples/client/petstore/python/tests/test_order_model.py @@ -3,7 +3,7 @@ """ Run the tests. $ pip install nose (optional) -$ cd swagger_client-python +$ cd petstore_api-python $ nosetests -v """ @@ -11,13 +11,13 @@ import os import time import unittest -import swagger_client +import petstore_api class OrderModelTests(unittest.TestCase): def test_status(self): - order = swagger_client.Order() + order = petstore_api.Order() order.status = "placed" self.assertEqual("placed", order.status) diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 300a7bee783..4b749fc044a 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -3,7 +3,7 @@ """ Run the tests. $ pip install nose (optional) -$ cd swagger_client-python +$ cd petstore_api-python $ nosetests -v """ @@ -11,8 +11,8 @@ import os import time import unittest -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException HOST = 'http://petstore.swagger.io/v2' @@ -20,8 +20,8 @@ HOST = 'http://petstore.swagger.io/v2' class PetApiTests(unittest.TestCase): def setUp(self): - self.api_client = swagger_client.ApiClient(HOST) - self.pet_api = swagger_client.PetApi(self.api_client) + self.api_client = petstore_api.ApiClient(HOST) + self.pet_api = petstore_api.PetApi(self.api_client) self.setUpModels() self.setUpFiles() @@ -30,13 +30,13 @@ class PetApiTests(unittest.TestCase): time.sleep(1) def setUpModels(self): - self.category = swagger_client.Category() + self.category = petstore_api.Category() self.category.id = int(time.time()) self.category.name = "dog" - self.tag = swagger_client.Tag() + self.tag = petstore_api.Tag() self.tag.id = int(time.time()) self.tag.name = "swagger-codegen-python-pet-tag" - self.pet = swagger_client.Pet() + self.pet = petstore_api.Pet() self.pet.id = int(time.time()) self.pet.name = "hello kity" self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"] @@ -50,22 +50,22 @@ class PetApiTests(unittest.TestCase): self.foo = os.path.join(self.test_file_dir, "foo.png") def test_create_api_instance(self): - pet_api = swagger_client.PetApi() - pet_api2 = swagger_client.PetApi() - api_client3 = swagger_client.ApiClient() + pet_api = petstore_api.PetApi() + pet_api2 = petstore_api.PetApi() + api_client3 = petstore_api.ApiClient() api_client3.user_agent = 'api client 3' - api_client4 = swagger_client.ApiClient() + api_client4 = petstore_api.ApiClient() api_client4.user_agent = 'api client 4' - pet_api3 = swagger_client.PetApi(api_client3) + pet_api3 = petstore_api.PetApi(api_client3) # same default api client self.assertEqual(pet_api.api_client, pet_api2.api_client) # confirm using the default api client in the config module - self.assertEqual(pet_api.api_client, swagger_client.configuration.api_client) + self.assertEqual(pet_api.api_client, petstore_api.configuration.api_client) # 2 different api clients are not the same self.assertNotEqual(api_client3, api_client4) # customized pet api not using the default api client - self.assertNotEqual(pet_api3.api_client, swagger_client.configuration.api_client) + self.assertNotEqual(pet_api3.api_client, petstore_api.configuration.api_client) # customized pet api not using the old pet api's api client self.assertNotEqual(pet_api3.api_client, pet_api2.api_client) diff --git a/samples/client/petstore/python/tests/test_pet_model.py b/samples/client/petstore/python/tests/test_pet_model.py index d2bd3c9ca3d..52cb55061da 100644 --- a/samples/client/petstore/python/tests/test_pet_model.py +++ b/samples/client/petstore/python/tests/test_pet_model.py @@ -3,7 +3,7 @@ """ Run the tests. $ pip install nose (optional) -$ cd swagger_client-python +$ cd petstore_api-python $ nosetests -v """ @@ -11,22 +11,22 @@ import os import time import unittest -import swagger_client +import petstore_api class PetModelTests(unittest.TestCase): def setUp(self): - self.pet = swagger_client.Pet() + self.pet = petstore_api.Pet() self.pet.name = "test name" self.pet.id = 1 self.pet.photo_urls = ["string"] self.pet.status = "available" - cate = swagger_client.Category() + cate = petstore_api.Category() cate.id = 1 cate.name = "dog" self.pet.category = cate - tag = swagger_client.Tag() + tag = petstore_api.Tag() tag.id = 1 self.pet.tags = [tag] @@ -40,29 +40,29 @@ class PetModelTests(unittest.TestCase): self.assertEqual(data, self.pet.to_str()) def test_equal(self): - self.pet1 = swagger_client.Pet() + self.pet1 = petstore_api.Pet() self.pet1.name = "test name" self.pet1.id = 1 self.pet1.photo_urls = ["string"] self.pet1.status = "available" - cate1 = swagger_client.Category() + cate1 = petstore_api.Category() cate1.id = 1 cate1.name = "dog" self.pet.category = cate1 - tag1 = swagger_client.Tag() + tag1 = petstore_api.Tag() tag1.id = 1 self.pet1.tags = [tag1] - self.pet2 = swagger_client.Pet() + self.pet2 = petstore_api.Pet() self.pet2.name = "test name" self.pet2.id = 1 self.pet2.photo_urls = ["string"] self.pet2.status = "available" - cate2 = swagger_client.Category() + cate2 = petstore_api.Category() cate2.id = 1 cate2.name = "dog" self.pet.category = cate2 - tag2 = swagger_client.Tag() + tag2 = petstore_api.Tag() tag2.id = 1 self.pet2.tags = [tag2] diff --git a/samples/client/petstore/python/tests/test_store_api.py b/samples/client/petstore/python/tests/test_store_api.py index 42b92d0879c..b7e80281707 100644 --- a/samples/client/petstore/python/tests/test_store_api.py +++ b/samples/client/petstore/python/tests/test_store_api.py @@ -11,14 +11,14 @@ import os import time import unittest -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException class StoreApiTests(unittest.TestCase): def setUp(self): - self.store_api = swagger_client.StoreApi() + self.store_api = petstore_api.StoreApi() def tearDown(self): # sleep 1 sec between two every 2 tests From df11034c46f9407f3136a6a639353179bf02111e Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Wed, 8 Jun 2016 09:25:35 +0900 Subject: [PATCH 30/67] Add venv and .python-version to .gitignore --- samples/client/petstore/python/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index 1dbc687de01..a655050c263 100644 --- a/samples/client/petstore/python/.gitignore +++ b/samples/client/petstore/python/.gitignore @@ -44,6 +44,8 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +venv/ +.python-version # Translations *.mo From fccc30eb1190b78667f3b4268d056e126d575755 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 8 Jun 2016 21:20:03 +0800 Subject: [PATCH 31/67] add info about pulling latest master --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f94dfe8d93a..2e76422c0dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,7 @@ ## Before submitting an issue + - If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/swagger-api/swagger-codegen#getting-started) - Search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) and [closed issue](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before. - The issue should contain details on how to repeat the issue, e.g. - the OpenAPI Spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the OpenAPI Spec cannot be shared publicly, it will be hard for the community to help From baed578010332a020d3d722dce6cb5f62b862d98 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 8 Jun 2016 21:21:39 +0800 Subject: [PATCH 32/67] file an issue ticket --- CONTRIBUTING.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e76422c0dd..a40a96f7b38 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,11 +4,8 @@ - If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/swagger-api/swagger-codegen#getting-started) - Search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) and [closed issue](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before. - - The issue should contain details on how to repeat the issue, e.g. - - the OpenAPI Spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the OpenAPI Spec cannot be shared publicly, it will be hard for the community to help - - version of Swagger Codegen - - language (`-l` in the command line, e.g. java, csharp, php) - - You can also make a suggestion or ask a question by opening an "issue" + - File an [issue ticket](https://github.com/swagger-api/swagger-codegen/issues/new) by providing all the required information. + - You can also make a suggestion or ask a question by opening an "issue". ## Before submitting a PR From 691aa53d5af958a6613139ca77bbc6038eeea6ca Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 9 Jun 2016 00:47:49 +0800 Subject: [PATCH 33/67] [Java][okhttp-gson] fix java doc for okhttp-gson (#3077) * fix java doc for okhttp-gson * add ci test for javadoc * fix return type for java doc * fix warning/error with javadoc * fix error/warning in javadoc * fix 2 warnings related to docstring * remove trailing space for okhttp tmeplate --- .../codegen/languages/JavaClientCodegen.java | 2 +- .../resources/Java/Configuration.mustache | 34 +- .../main/resources/Java/apiException.mustache | 107 +- .../Java/auth/Authentication.mustache | 9 +- .../okhttp-gson/ApiCallback.mustache | 64 +- .../libraries/okhttp-gson/ApiClient.mustache | 2177 +++++++++-------- .../okhttp-gson/ApiResponse.mustache | 58 +- .../Java/libraries/okhttp-gson/JSON.mustache | 144 +- .../okhttp-gson/ProgressRequestBody.mustache | 8 +- .../Java/libraries/okhttp-gson/api.mustache | 256 +- .../okhttp-gson/auth/HttpBasicAuth.mustache | 52 +- .../libraries/okhttp-gson/modelEnum.mustache | 22 +- .../okhttp-gson/modelInnerEnum.mustache | 32 +- .../Java/libraries/okhttp-gson/pojo.mustache | 144 +- .../Java/libraries/okhttp-gson/pom.mustache | 17 +- .../client/petstore/java/okhttp-gson/pom.xml | 17 +- .../java/io/swagger/client/ApiCallback.java | 64 +- .../java/io/swagger/client/ApiClient.java | 2175 ++++++++-------- .../java/io/swagger/client/ApiException.java | 109 +- .../java/io/swagger/client/ApiResponse.java | 58 +- .../java/io/swagger/client/Configuration.java | 36 +- .../src/main/java/io/swagger/client/JSON.java | 144 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../swagger/client/ProgressRequestBody.java | 8 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 364 +-- .../java/io/swagger/client/api/PetApi.java | 1668 ++++++------- .../java/io/swagger/client/api/StoreApi.java | 816 +++--- .../java/io/swagger/client/api/UserApi.java | 1540 ++++++------ .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../swagger/client/auth/Authentication.java | 9 +- .../io/swagger/client/auth/HttpBasicAuth.java | 52 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../model/AdditionalPropertiesClass.java | 140 +- .../java/io/swagger/client/model/Animal.java | 140 +- .../io/swagger/client/model/AnimalFarm.java | 66 +- .../io/swagger/client/model/ArrayTest.java | 175 +- .../java/io/swagger/client/model/Cat.java | 175 +- .../io/swagger/client/model/Category.java | 140 +- .../java/io/swagger/client/model/Dog.java | 175 +- .../io/swagger/client/model/EnumClass.java | 28 +- .../io/swagger/client/model/EnumTest.java | 178 +- .../io/swagger/client/model/FormatTest.java | 545 +++-- ...ropertiesAndAdditionalPropertiesClass.java | 175 +- .../client/model/Model200Response.java | 101 +- .../client/model/ModelApiResponse.java | 175 +- .../io/swagger/client/model/ModelReturn.java | 101 +- .../java/io/swagger/client/model/Name.java | 186 +- .../java/io/swagger/client/model/Order.java | 282 ++- .../java/io/swagger/client/model/Pet.java | 282 ++- .../swagger/client/model/ReadOnlyFirst.java | 128 +- .../client/model/SpecialModelName.java | 101 +- .../java/io/swagger/client/model/Tag.java | 140 +- .../java/io/swagger/client/model/User.java | 351 +-- samples/client/petstore/python/.gitignore | 2 - samples/client/petstore/python/README.md | 14 +- .../python/petstore_api/configuration.py | 14 +- 57 files changed, 7494 insertions(+), 6514 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 73930a83878..16c9f9ae12b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -261,7 +261,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { writeOptional(outputFolder, new SupportingFile("settings.gradle.mustache", "", "settings.gradle")); writeOptional(outputFolder, new SupportingFile("gradle.properties.mustache", "", "gradle.properties")); writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); - writeOptional(outputFolder, new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java")); + supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java")); supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java")); final String authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); diff --git a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache index 4629c4e17be..ea6cccb7d85 100644 --- a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache @@ -2,21 +2,25 @@ package {{invokerPackage}}; {{>generatedAnnotation}} public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache index b9a62a6b231..740ed4143ab 100644 --- a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache @@ -5,65 +5,74 @@ import java.util.List; {{>generatedAnnotation}} public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; - public ApiException() {} + public ApiException() {} - public ApiException(Throwable throwable) { - super(throwable); - } + public ApiException(Throwable throwable) { + super(throwable); + } - public ApiException(String message) { - super(message); - } + public ApiException(String message) { + super(message); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(int code, String message) { - super(message); - this.code = code; - } + public ApiException(int code, String message) { + super(message); + this.code = code; + } - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public int getCode() { - return code; - } + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } - /** - * Get the HTTP response headers. - */ - public Map> getResponseHeaders() { - return responseHeaders; - } + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } - /** - * Get the HTTP response body. - */ - public String getResponseBody() { - return responseBody; - } + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache index 265c74cb76f..592b55c2552 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache @@ -6,6 +6,11 @@ import java.util.Map; import java.util.List; public interface Authentication { - /** Apply authentication settings to header and query params. */ - void applyToParams(List queryParams, Map headerParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache index bfc1aedbc11..3b554fefeff 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache @@ -11,39 +11,39 @@ import java.util.List; * @param The return type */ public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); - /** - * This is called when the API downlond processing. - * - * @param bytesRead bytes Read - * @param contentLength content lenngth of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); + /** + * This is called when the API downlond processing. + * + * @param bytesRead bytes Read + * @param contentLength content lenngth of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 4c8e304ed97..ac140471567 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -67,1073 +67,1234 @@ import {{invokerPackage}}.auth.ApiKeyAuth; import {{invokerPackage}}.auth.OAuth; public class ApiClient { - public static final double JAVA_VERSION; - public static final boolean IS_ANDROID; - public static final int ANDROID_SDK_VERSION; + public static final double JAVA_VERSION; + public static final boolean IS_ANDROID; + public static final int ANDROID_SDK_VERSION; - static { - JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version")); - boolean isAndroid; - try { - Class.forName("android.app.Activity"); - isAndroid = true; - } catch (ClassNotFoundException e) { - isAndroid = false; - } - IS_ANDROID = isAndroid; - int sdkVersion = 0; - if (IS_ANDROID) { - try { - sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null); - } catch (Exception e) { + static { + JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version")); + boolean isAndroid; try { - sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null)); - } catch (Exception e2) { } - } + Class.forName("android.app.Activity"); + isAndroid = true; + } catch (ClassNotFoundException e) { + isAndroid = false; + } + IS_ANDROID = isAndroid; + int sdkVersion = 0; + if (IS_ANDROID) { + try { + sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null); + } catch (Exception e) { + try { + sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null)); + } catch (Exception e2) { } + } + } + ANDROID_SDK_VERSION = sdkVersion; } - ANDROID_SDK_VERSION = sdkVersion; - } - /** - * The datetime format to be used when lenientDatetimeFormat is enabled. - */ - public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + /** + * The datetime format to be used when lenientDatetimeFormat is enabled. + */ + public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - private String basePath = "{{basePath}}"; - private boolean lenientOnJson = false; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private String tempFolderPath = null; + private String basePath = "{{basePath}}"; + private boolean lenientOnJson = false; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private String tempFolderPath = null; - private Map authentications; + private Map authentications; - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; - private InputStream sslCaCert; - private boolean verifyingSsl; + private InputStream sslCaCert; + private boolean verifyingSsl; - private OkHttpClient httpClient; - private JSON json; + private OkHttpClient httpClient; + private JSON json; - private HttpLoggingInterceptor loggingInterceptor; - - public ApiClient() { - httpClient = new OkHttpClient(); - - verifyingSsl = true; - - json = new JSON(this); + private HttpLoggingInterceptor loggingInterceptor; /* - * Use RFC3339 format for date and datetime. - * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + * Constructor for ApiClient */ - this.dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - // Always use UTC as the default time zone when dealing with date (without time). - this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - initDatetimeFormat(); + public ApiClient() { + httpClient = new OkHttpClient(); - // Be lenient on datetime formats when parsing datetime from string. - // See parseDatetime. - this.lenientDatetimeFormat = true; + verifyingSsl = true; - // Set default User-Agent. - setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + json = new JSON(this); - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap();{{#authMethods}}{{#isBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } + /* + * Use RFC3339 format for date and datetime. + * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + */ + this.dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + // Always use UTC as the default time zone when dealing with date (without time). + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + initDatetimeFormat(); - public String getBasePath() { - return basePath; - } + // Be lenient on datetime formats when parsing datetime from string. + // See parseDatetime. + this.lenientDatetimeFormat = true; - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } + // Set default User-Agent. + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - public OkHttpClient getHttpClient() { - return httpClient; - } - - public ApiClient setHttpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public JSON getJSON() { - return json; - } - - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - this.dateLength = this.dateFormat.format(new Date()).length(); - return this; - } - - public DateFormat getDatetimeFormat() { - return datetimeFormat; - } - - public ApiClient setDatetimeFormat(DateFormat datetimeFormat) { - this.datetimeFormat = datetimeFormat; - return this; - } - - /** - * Whether to allow various ISO 8601 datetime formats when parsing a datetime string. - * @see #parseDatetime(String) - */ - public boolean isLenientDatetimeFormat() { - return lenientDatetimeFormat; - } - - public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) { - this.lenientDatetimeFormat = lenientDatetimeFormat; - return this; - } - - /** - * Parse the given date string into Date object. - * The default dateFormat supports these ISO 8601 date formats: - * 2015-08-16 - * 2015-8-16 - */ - public Date parseDate(String str) { - if (str == null) - return null; - try { - return dateFormat.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Parse the given datetime string into Date object. - * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported: - * 2015-08-16T08:20:05Z - * 2015-8-16T8:20:05Z - * 2015-08-16T08:20:05+00:00 - * 2015-08-16T08:20:05+0000 - * 2015-08-16T08:20:05.376Z - * 2015-08-16T08:20:05.376+00:00 - * 2015-08-16T08:20:05.376+00 - * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of - * these formats: - * Z (same with +0000) - * +08:00 (same with +0800) - * -02 (same with -0200) - * -0200 - * @see https://en.wikipedia.org/wiki/ISO_8601 - */ - public Date parseDatetime(String str) { - if (str == null) - return null; - - DateFormat format; - if (lenientDatetimeFormat) { - /* - * When lenientDatetimeFormat is enabled, normalize the date string - * into LENIENT_DATETIME_FORMAT to support various formats - * defined by ISO 8601. - */ - // normalize time zone - // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000 - str = str.replaceAll("[zZ]\\z", "+0000"); - // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2"); - // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2})\\z", "$100"); - // add milliseconds when missing - // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000 - str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2"); - format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT); - } else { - format = this.datetimeFormat; + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap();{{#authMethods}}{{#isBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); } - try { - return format.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public Date parseDateOrDatetime(String str) { - if (str == null) - return null; - else if (str.length() <= dateLength) - return parseDate(str); - else - return parseDatetime(str); - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given Date object into string. - */ - public String formatDatetime(Date date) { - return datetimeFormat.format(date); - } - - /** - * Get authentications (key: authentication name, value: authentication). - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * @see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - */ - public boolean isLenientOnJson() { - return lenientOnJson; - } - - public ApiClient setLenientOnJson(boolean lenient) { - this.lenientOnJson = lenient; - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); - } else { - httpClient.interceptors().remove(loggingInterceptor); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Connect timeout (in milliseconds). - */ - public int getConnectTimeout() { - return httpClient.getConnectTimeout(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); - return this; - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDatetime((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - Format to {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection = null; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; + /** + * Get base path + * + * @return Baes path + */ + public String getBasePath() { + return basePath; } - if (valueCollection.isEmpty()){ - return params; + /** + * Set base path + * + * @param basePath Base path of the URL (e.g {{basePath}}) + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; } - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv - - // create the params based on the collection format - if (collectionFormat.equals("multi")) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; } - String delimiter = ","; - - if (collectionFormat.equals("csv")) { - delimiter = ","; - } else if (collectionFormat.equals("ssv")) { - delimiter = " "; - } else if (collectionFormat.equals("tsv")) { - delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { - delimiter = "|"; + /** + * Set HTTP client + * + * @param httpClient An instance of OkHttpClient + * @return Api Client + */ + public ApiClient setHttpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; } - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; } - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - */ - public boolean isJsonMime(String mime) { - return mime != null && mime.matches("(?i)application\\/json(;.*)?"); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; } - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; } - if (respBody == null || "".equals(respBody)) { - return null; + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; } - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create(MediaType.parse(contentType), (File) obj); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(MediaType.parse(contentType), content); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; } - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + public DateFormat getDateFormat() { + return dateFormat; } - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * @see #execute(Call, Type) - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + this.dateLength = this.dateFormat.format(new Date()).length(); + return this; } - } - /** - * #see executeAsync(Call, Type, ApiCallback) - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } + public DateFormat getDatetimeFormat() { + return datetimeFormat; + } - /** - * Execute HTTP call asynchronously. - * - * @see #execute(Call, Type) - * @param The callback to be executed when the API call finishes - */ - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Request request, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } + public ApiClient setDatetimeFormat(DateFormat datetimeFormat) { + this.datetimeFormat = datetimeFormat; + return this; + } - @Override - public void onResponse(Response response) throws IOException { - T result; + /** + * Whether to allow various ISO 8601 datetime formats when parsing a datetime string. + * @see #parseDatetime(String) + * @return True if lenientDatetimeFormat flag is set to true + */ + public boolean isLenientDatetimeFormat() { + return lenientDatetimeFormat; + } + + public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) { + this.lenientDatetimeFormat = lenientDatetimeFormat; + return this; + } + + /** + * Parse the given date string into Date object. + * The default dateFormat supports these ISO 8601 date formats: + * 2015-08-16 + * 2015-8-16 + * @param str String to be parsed + * @return Date + */ + public Date parseDate(String str) { + if (str == null) + return null; try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; + return dateFormat.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Parse the given datetime string into Date object. + * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported: + * 2015-08-16T08:20:05Z + * 2015-8-16T8:20:05Z + * 2015-08-16T08:20:05+00:00 + * 2015-08-16T08:20:05+0000 + * 2015-08-16T08:20:05.376Z + * 2015-08-16T08:20:05.376+00:00 + * 2015-08-16T08:20:05.376+00 + * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of + * these formats: + * Z (same with +0000) + * +08:00 (same with +0800) + * -02 (same with -0200) + * -0200 + * @see ISO 8601 + * @param str Date time string to be parsed + * @return Date representation of the string + */ + public Date parseDatetime(String str) { + if (str == null) + return null; + + DateFormat format; + if (lenientDatetimeFormat) { + /* + * When lenientDatetimeFormat is enabled, normalize the date string + * into LENIENT_DATETIME_FORMAT to support various formats + * defined by ISO 8601. + */ + // normalize time zone + // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000 + str = str.replaceAll("[zZ]\\z", "+0000"); + // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000 + str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2"); + // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000 + str = str.replaceAll("([+-]\\d{2})\\z", "$100"); + // add milliseconds when missing + // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000 + str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2"); + format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT); + } else { + format = this.datetimeFormat; } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @throws ApiException If the response has a unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { try { - respBody = response.body().string(); + return format.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /* + * Parse date or date time in string format into Date object. + * + * @param str Date time string to be parsed + * @return Date representation of the string + */ + public Date parseDateOrDatetime(String str) { + if (str == null) + return null; + else if (str.length() <= dateLength) + return parseDate(str); + else + return parseDatetime(str); + } + + /** + * Format the given Date object into string (Date format). + * + * @param date Date object + * @return Formatted date in string representation + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given Date object into string (Datetime format). + * + * @param date Date object + * @return Formatted datetime in string representation + */ + public String formatDatetime(Date date) { + return datetimeFormat.format(date); + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * @see setLenient + * + * @return True if lenientOnJson is enabled, false otherwise. + */ + public boolean isLenientOnJson() { + return lenientOnJson; + } + + /** + * Set LenientOnJson + * + * @param lenient True to enable lenientOnJson + * @return ApiClient + */ + public ApiClient setLenientOnJson(boolean lenient) { + this.lenientOnJson = lenient; + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient.interceptors().add(loggingInterceptor); + } else { + httpClient.interceptors().remove(loggingInterceptor); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the tempoaray folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.getConnectTimeout(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDatetime((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection)param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Format to {@code Pair} objects. + * + * @param collectionFormat collection format (e.g. csv, tsv) + * @param name Name + * @param value Value + * @return A list of Pair objects + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + + // create the params based on the collection format + if (collectionFormat.equals("multi")) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if (collectionFormat.equals("csv")) { + delimiter = ","; + } else if (collectionFormat.equals("ssv")) { + delimiter = " "; + } else if (collectionFormat.equals("tsv")) { + delimiter = "\t"; + } else if (collectionFormat.equals("pipes")) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + return mime != null && mime.matches("(?i)application\\/json(;.*)?"); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + throw new ApiException(e); } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - final String url = buildUrl(path, queryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create(MediaType.parse(contentType), ""); - } - } else { - reqBody = serialize(body, contentType); - } - - Request request = null; - - if(progressRequestListener != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return httpClient.newCall(request); - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + if (respBody == null || "".equals(respBody)) { + return null; } - } - } - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The Content-Type guessed - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android. - */ - private void initDatetimeFormat() { - String formatWithTimeZone = null; - if (IS_ANDROID) { - if (ANDROID_SDK_VERSION >= 18) { - // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18) - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; - } - } else if (JAVA_VERSION >= 1.7) { - // The time zone format "XXX" is available since Java 1.7 - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; - } - if (formatWithTimeZone != null) { - this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone); - // NOTE: Use the system's default time zone (mainly for datetime formatting). - } else { - // Use a common format that works across all systems. - this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - // Always use the UTC time zone as we are using a constant trailing "Z" here. - this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - } - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - KeyManager[] keyManagers = null; - TrustManager[] trustManagers = null; - HostnameVerifier hostnameVerifier = null; - if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } - }; - SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { return true; } - }; - } else if (sslCaCert != null) { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); } - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManagerFactory.init(caKeyStore); - trustManagers = trustManagerFactory.getTrustManagers(); - } - - if (keyManagers != null || trustManagers != null) { - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); - } else { - httpClient.setSslSocketFactory(null); - } - httpClient.setHostnameVerifier(hostnameVerifier); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); } - } - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create(MediaType.parse(contentType), (File) obj); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(MediaType.parse(contentType), content); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @throws IOException If fail to prepare file for download + * @return Prepared file for the download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @throws ApiException If fail to execute the call + * @return ApiResponse<T> + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @see #execute(Call, Type) + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + */ + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Request request, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @throws ApiException If the response has a unsuccessful status code or + * fail to deserialize the response body + * @return Type + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + final String url = buildUrl(path, queryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create(MediaType.parse(contentType), ""); + } + } else { + reqBody = serialize(body, contentType); + } + + Request request = null; + + if(progressRequestListener != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return httpClient.newCall(request); + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the ofrm of Map + * @param reqBuilder Reqeust.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android. + */ + private void initDatetimeFormat() { + String formatWithTimeZone = null; + if (IS_ANDROID) { + if (ANDROID_SDK_VERSION >= 18) { + // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18) + formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; + } + } else if (JAVA_VERSION >= 1.7) { + // The time zone format "XXX" is available since Java 1.7 + formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; + } + if (formatWithTimeZone != null) { + this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone); + // NOTE: Use the system's default time zone (mainly for datetime formatting). + } else { + // Use a common format that works across all systems. + this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + // Always use the UTC time zone as we are using a constant trailing "Z" here. + this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + } + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + KeyManager[] keyManagers = null; + TrustManager[] trustManagers = null; + HostnameVerifier hostnameVerifier = null; + if (!verifyingSsl) { + TrustManager trustAll = new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public X509Certificate[] getAcceptedIssuers() { return null; } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + trustManagers = new TrustManager[]{ trustAll }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { return true; } + }; + } else if (sslCaCert != null) { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(caKeyStore); + trustManagers = trustManagerFactory.getTrustManagers(); + } + + if (keyManagers != null || trustManagers != null) { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + } else { + httpClient.setSslSocketFactory(null); + } + httpClient.setHostnameVerifier(hostnameVerifier); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } } - } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache index 452f4e1e982..88dcc43af4b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache @@ -9,38 +9,38 @@ import java.util.Map; * @param T The type of data that is deserialized from response body */ public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; + final private int statusCode; + final private Map> headers; + final private T data; - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } - public int getStatusCode() { - return statusCode; - } + public int getStatusCode() { + return statusCode; + } - public Map> getHeaders() { - return headers; - } + public Map> getHeaders() { + return headers; + } - public T getData() { - return data; - } + public T getData() { + return data; + } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache index 9cc1324acb6..c7dd1d8e62f 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache @@ -17,69 +17,101 @@ import java.lang.reflect.Type; import java.util.Date; public class JSON { - private ApiClient apiClient; - private Gson gson; + private ApiClient apiClient; + private Gson gson; - public JSON(ApiClient apiClient) { - this.apiClient = apiClient; - gson = new GsonBuilder() - .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) - .create(); - } - - public Gson getGson() { - return gson; - } - - public void setGson(Gson gson) { - this.gson = gson; - } - - /** - * Serialize the given Java object into JSON string. - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param body The JSON string - * @param returnType The type to deserialize inot - * @return The deserialized Java object - */ - public T deserialize(String body, Type returnType) { - try { - if (apiClient.isLenientOnJson()) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - // parse response body into date or datetime for the Date return type. - if (returnType.equals(String.class)) - return (T) body; - else if (returnType.equals(Date.class)) - return (T) apiClient.parseDateOrDatetime(body); - else throw(e); + /** + * JSON constructor. + * + * @param apiClient An instance of ApiClient + */ + public JSON(ApiClient apiClient) { + this.apiClient = apiClient; + gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public void setGson(Gson gson) { + this.gson = gson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize inot + * @return The deserialized Java object + */ + public T deserialize(String body, Type returnType) { + try { + if (apiClient.isLenientOnJson()) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + // parse response body into date or datetime for the Date return type. + if (returnType.equals(String.class)) + return (T) body; + else if (returnType.equals(Date.class)) + return (T) apiClient.parseDateOrDatetime(body); + else throw(e); + } } - } } class DateAdapter implements JsonSerializer, JsonDeserializer { private final ApiClient apiClient; + /** + * Constructor for DateAdapter + * + * @param apiClient Api client + */ public DateAdapter(ApiClient apiClient) { super(); this.apiClient = apiClient; } + /** + * Serialize + * + * @param src Date + * @param typeOfSrc Type + * @param context Json Serialization Context + * @return Json Element + */ @Override public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { if (src == null) { @@ -89,6 +121,16 @@ class DateAdapter implements JsonSerializer, JsonDeserializer { } } + /** + * Deserialize + * + * @param json Json element + * @param date Type + * @param typeOfSrc Type + * @param context Json Serialization Context + * @return Date + * @throw JsonParseException if fail to parse + */ @Override public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException { String str = json.getAsJsonPrimitive().getAsString(); diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache index 57931ef4cfc..a1c300b9f30 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -18,9 +18,9 @@ public class ProgressRequestBody extends RequestBody { } private final RequestBody requestBody; - + private final ProgressRequestListener progressListener; - + private BufferedSink bufferedSink; public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { @@ -43,7 +43,7 @@ public class ProgressRequestBody extends RequestBody { if (bufferedSink == null) { bufferedSink = Okio.buffer(sink(sink)); } - + requestBody.writeTo(bufferedSink); bufferedSink.flush(); @@ -51,7 +51,7 @@ public class ProgressRequestBody extends RequestBody { private Sink sink(Sink sink) { return new ForwardingSink(sink) { - + long bytesWritten = 0L; long contentLength = 0L; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index dd9141bd3dc..13c813e58af 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -30,138 +30,138 @@ import java.util.Map; {{#operations}} public class {{classname}} { - private ApiClient {{localVariablePrefix}}apiClient; + private ApiClient {{localVariablePrefix}}apiClient; - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - - public {{classname}}(ApiClient apiClient) { - this.{{localVariablePrefix}}apiClient = apiClient; - } - - public ApiClient getApiClient() { - return {{localVariablePrefix}}apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.{{localVariablePrefix}}apiClient = apiClient; - } - - {{#operation}} - /* Build call for {{operationId}} */ - private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); - } - {{/required}}{{/allParams}} - - // create path and map variables - String {{localVariablePrefix}}localVarPath = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; - - {{javaUtilPrefix}}List {{localVariablePrefix}}localVarQueryParams = new {{javaUtilPrefix}}ArrayList();{{#queryParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}localVarQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));{{/queryParams}} - - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarHeaderParams = new {{javaUtilPrefix}}HashMap();{{#headerParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}localVarHeaderParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));{{/headerParams}} - - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarFormParams = new {{javaUtilPrefix}}HashMap();{{#formParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}localVarFormParams.put("{{baseName}}", {{paramName}});{{/formParams}} - - final String[] {{localVariablePrefix}}localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} - }; - final String {{localVariablePrefix}}localVarAccept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}localVarAccepts); - if ({{localVariablePrefix}}localVarAccept != null) {{localVariablePrefix}}localVarHeaderParams.put("Accept", {{localVariablePrefix}}localVarAccept); - - final String[] {{localVariablePrefix}}localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} - }; - final String {{localVariablePrefix}}localVarContentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}localVarContentTypes); - {{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + public {{classname}}() { + this(Configuration.getDefaultApiClient()); } - String[] {{localVariablePrefix}}localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; - return {{localVariablePrefix}}apiClient.buildCall({{localVariablePrefix}}localVarPath, "{{httpMethod}}", {{localVariablePrefix}}localVarQueryParams, {{localVariablePrefix}}localVarPostBody, {{localVariablePrefix}}localVarHeaderParams, {{localVariablePrefix}}localVarFormParams, {{localVariablePrefix}}localVarAuthNames, progressRequestListener); - } - - /** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} - * @return {{{returnType}}}{{/returnType}} - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - {{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} - return {{localVariablePrefix}}resp.getData();{{/returnType}} - } - - /** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - * @return ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null); - {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} - } - - /** - * {{summary}} (asynchronously) - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + public {{classname}}(ApiClient apiClient) { + this.{{localVariablePrefix}}apiClient = apiClient; } - Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); - {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - {{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType, {{localVariablePrefix}}callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}callback);{{/returnType}} - return {{localVariablePrefix}}call; - } - {{/operation}} + public ApiClient getApiClient() { + return {{localVariablePrefix}}apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.{{localVariablePrefix}}apiClient = apiClient; + } + + {{#operation}} + /* Build call for {{operationId}} */ + private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); + } + {{/required}}{{/allParams}} + + // create path and map variables + String {{localVariablePrefix}}localVarPath = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + + {{javaUtilPrefix}}List {{localVariablePrefix}}localVarQueryParams = new {{javaUtilPrefix}}ArrayList();{{#queryParams}} + if ({{paramName}} != null) + {{localVariablePrefix}}localVarQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));{{/queryParams}} + + {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarHeaderParams = new {{javaUtilPrefix}}HashMap();{{#headerParams}} + if ({{paramName}} != null) + {{localVariablePrefix}}localVarHeaderParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));{{/headerParams}} + + {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarFormParams = new {{javaUtilPrefix}}HashMap();{{#formParams}} + if ({{paramName}} != null) + {{localVariablePrefix}}localVarFormParams.put("{{baseName}}", {{paramName}});{{/formParams}} + + final String[] {{localVariablePrefix}}localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + }; + final String {{localVariablePrefix}}localVarAccept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}localVarAccepts); + if ({{localVariablePrefix}}localVarAccept != null) {{localVariablePrefix}}localVarHeaderParams.put("Accept", {{localVariablePrefix}}localVarAccept); + + final String[] {{localVariablePrefix}}localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + }; + final String {{localVariablePrefix}}localVarContentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}localVarContentTypes); + {{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] {{localVariablePrefix}}localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + return {{localVariablePrefix}}apiClient.buildCall({{localVariablePrefix}}localVarPath, "{{httpMethod}}", {{localVariablePrefix}}localVarQueryParams, {{localVariablePrefix}}localVarPostBody, {{localVariablePrefix}}localVarHeaderParams, {{localVariablePrefix}}localVarFormParams, {{localVariablePrefix}}localVarAuthNames, progressRequestListener); + } + + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} + * @return {{returnType}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + return {{localVariablePrefix}}resp.getData();{{/returnType}} + } + + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} + * @return ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null); + {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} + } + + /** + * {{summary}} (asynchronously) + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); + {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + {{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType, {{localVariablePrefix}}callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}callback);{{/returnType}} + return {{localVariablePrefix}}call; + } + {{/operation}} } {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache index f3ed85d980b..636691a2f21 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache @@ -10,32 +10,32 @@ import java.util.List; import java.io.UnsupportedEncodingException; public class HttpBasicAuth implements Authentication { - private String username; - private String password; + private String username; + private String password; - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (username == null && password == null) { - return; + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache index f7af4c89f2f..213acb31568 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache @@ -2,19 +2,19 @@ * {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}} */ public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { - {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) - {{{name}}}({{{value}}}){{^-last}}, + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - private {{dataType}} value; + private {{dataType}} value; - {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) { - this.value = value; - } + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + @Override + public String toString() { + return String.valueOf(value); + } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache index 30ebf3febb6..bb69f71d24b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache @@ -1,20 +1,20 @@ - /** - * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} - */ - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { - {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) - {{{name}}}({{{value}}}){{^-last}}, + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, - {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} - private {{datatype}} value; + private {{datatype}} value; - {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { - this.value = value; + {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } } - - @Override - public String toString() { - return String.valueOf(value); - } - } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index b20499078a2..f2aad04d54b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -3,69 +3,93 @@ */{{#description}} @ApiModel(description = "{{{description}}}"){{/description}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { - {{#vars}}{{#isEnum}} + {{#vars}} + {{#isEnum}} +{{>libraries/common/modelInnerEnum}} + {{/isEnum}} + {{#items.isEnum}} + {{#items}} +{{>libraries/common/modelInnerEnum}} + {{/items}} + {{/items.isEnum}} + @SerializedName("{{baseName}}") + private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + {{/vars}} -{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}} - -{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}} - @SerializedName("{{baseName}}") - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; - {{/vars}} - - {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") - public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - }{{^isReadOnly}} - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - }{{/isReadOnly}} - - {{/vars}} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + {{#vars}} + /** + {{#description}} + * {{{description}}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ + @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + + {{^isReadOnly}} + /** + * Set {{name}} + * + * @param {{name}} {{name}} + */ + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + + {{/isReadOnly}} + {{/vars}} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && {{/hasMore}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); - {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); - {{/vars}}sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index cfe169c5eca..241f1b308e6 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -105,7 +105,7 @@ 1.7 - + org.codehaus.mojo exec-maven-plugin @@ -137,6 +137,19 @@ + + mvn-javadoc-test + integration-test + + exec + + + mvn + + javadoc:javadoc + + + @@ -172,7 +185,7 @@
- 1.5.8 + 1.5.9 2.7.5 2.6.2 1.0.0 diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 638e1b9345e..0b84de7935e 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -105,7 +105,7 @@ 1.7 - + org.codehaus.mojo exec-maven-plugin @@ -137,6 +137,19 @@ + + mvn-javadoc-test + integration-test + + exec + + + mvn + + javadoc:javadoc + + + @@ -172,7 +185,7 @@ - 1.5.8 + 1.5.9 2.7.5 2.6.2 1.0.0 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java index fcf2d289fbf..9a1188c92e5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java @@ -11,39 +11,39 @@ import java.util.List; * @param The return type */ public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); - /** - * This is called when the API downlond processing. - * - * @param bytesRead bytes Read - * @param contentLength content lenngth of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); + /** + * This is called when the API downlond processing. + * + * @param bytesRead bytes Read + * @param contentLength content lenngth of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index 9328cb74d84..a035a3175df 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -67,1072 +67,1233 @@ import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; public class ApiClient { - public static final double JAVA_VERSION; - public static final boolean IS_ANDROID; - public static final int ANDROID_SDK_VERSION; + public static final double JAVA_VERSION; + public static final boolean IS_ANDROID; + public static final int ANDROID_SDK_VERSION; - static { - JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version")); - boolean isAndroid; - try { - Class.forName("android.app.Activity"); - isAndroid = true; - } catch (ClassNotFoundException e) { - isAndroid = false; - } - IS_ANDROID = isAndroid; - int sdkVersion = 0; - if (IS_ANDROID) { - try { - sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null); - } catch (Exception e) { + static { + JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version")); + boolean isAndroid; try { - sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null)); - } catch (Exception e2) { } - } + Class.forName("android.app.Activity"); + isAndroid = true; + } catch (ClassNotFoundException e) { + isAndroid = false; + } + IS_ANDROID = isAndroid; + int sdkVersion = 0; + if (IS_ANDROID) { + try { + sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null); + } catch (Exception e) { + try { + sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null)); + } catch (Exception e2) { } + } + } + ANDROID_SDK_VERSION = sdkVersion; } - ANDROID_SDK_VERSION = sdkVersion; - } - /** - * The datetime format to be used when lenientDatetimeFormat is enabled. - */ - public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + /** + * The datetime format to be used when lenientDatetimeFormat is enabled. + */ + public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - private String basePath = "http://petstore.swagger.io/v2"; - private boolean lenientOnJson = false; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private String tempFolderPath = null; + private String basePath = "http://petstore.swagger.io/v2"; + private boolean lenientOnJson = false; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private String tempFolderPath = null; - private Map authentications; + private Map authentications; - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; - private InputStream sslCaCert; - private boolean verifyingSsl; + private InputStream sslCaCert; + private boolean verifyingSsl; - private OkHttpClient httpClient; - private JSON json; + private OkHttpClient httpClient; + private JSON json; - private HttpLoggingInterceptor loggingInterceptor; - - public ApiClient() { - httpClient = new OkHttpClient(); - - verifyingSsl = true; - - json = new JSON(this); + private HttpLoggingInterceptor loggingInterceptor; /* - * Use RFC3339 format for date and datetime. - * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + * Constructor for ApiClient */ - this.dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - // Always use UTC as the default time zone when dealing with date (without time). - this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - initDatetimeFormat(); + public ApiClient() { + httpClient = new OkHttpClient(); - // Be lenient on datetime formats when parsing datetime from string. - // See parseDatetime. - this.lenientDatetimeFormat = true; + verifyingSsl = true; - // Set default User-Agent. - setUserAgent("Swagger-Codegen/1.0.0/java"); + json = new JSON(this); - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("petstore_auth", new OAuth()); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } + /* + * Use RFC3339 format for date and datetime. + * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + */ + this.dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + // Always use UTC as the default time zone when dealing with date (without time). + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + initDatetimeFormat(); - public String getBasePath() { - return basePath; - } + // Be lenient on datetime formats when parsing datetime from string. + // See parseDatetime. + this.lenientDatetimeFormat = true; - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } + // Set default User-Agent. + setUserAgent("Swagger-Codegen/1.0.0/java"); - public OkHttpClient getHttpClient() { - return httpClient; - } - - public ApiClient setHttpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public JSON getJSON() { - return json; - } - - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - this.dateLength = this.dateFormat.format(new Date()).length(); - return this; - } - - public DateFormat getDatetimeFormat() { - return datetimeFormat; - } - - public ApiClient setDatetimeFormat(DateFormat datetimeFormat) { - this.datetimeFormat = datetimeFormat; - return this; - } - - /** - * Whether to allow various ISO 8601 datetime formats when parsing a datetime string. - * @see #parseDatetime(String) - */ - public boolean isLenientDatetimeFormat() { - return lenientDatetimeFormat; - } - - public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) { - this.lenientDatetimeFormat = lenientDatetimeFormat; - return this; - } - - /** - * Parse the given date string into Date object. - * The default dateFormat supports these ISO 8601 date formats: - * 2015-08-16 - * 2015-8-16 - */ - public Date parseDate(String str) { - if (str == null) - return null; - try { - return dateFormat.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Parse the given datetime string into Date object. - * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported: - * 2015-08-16T08:20:05Z - * 2015-8-16T8:20:05Z - * 2015-08-16T08:20:05+00:00 - * 2015-08-16T08:20:05+0000 - * 2015-08-16T08:20:05.376Z - * 2015-08-16T08:20:05.376+00:00 - * 2015-08-16T08:20:05.376+00 - * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of - * these formats: - * Z (same with +0000) - * +08:00 (same with +0800) - * -02 (same with -0200) - * -0200 - * @see https://en.wikipedia.org/wiki/ISO_8601 - */ - public Date parseDatetime(String str) { - if (str == null) - return null; - - DateFormat format; - if (lenientDatetimeFormat) { - /* - * When lenientDatetimeFormat is enabled, normalize the date string - * into LENIENT_DATETIME_FORMAT to support various formats - * defined by ISO 8601. - */ - // normalize time zone - // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000 - str = str.replaceAll("[zZ]\\z", "+0000"); - // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2"); - // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2})\\z", "$100"); - // add milliseconds when missing - // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000 - str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2"); - format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT); - } else { - format = this.datetimeFormat; + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); } - try { - return format.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - public Date parseDateOrDatetime(String str) { - if (str == null) - return null; - else if (str.length() <= dateLength) - return parseDate(str); - else - return parseDatetime(str); - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given Date object into string. - */ - public String formatDatetime(Date date) { - return datetimeFormat.format(date); - } - - /** - * Get authentications (key: authentication name, value: authentication). - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * @see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - */ - public boolean isLenientOnJson() { - return lenientOnJson; - } - - public ApiClient setLenientOnJson(boolean lenient) { - this.lenientOnJson = lenient; - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); - } else { - httpClient.interceptors().remove(loggingInterceptor); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Connect timeout (in milliseconds). - */ - public int getConnectTimeout() { - return httpClient.getConnectTimeout(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); - return this; - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDatetime((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - Format to {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection = null; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; + /** + * Get base path + * + * @return Baes path + */ + public String getBasePath() { + return basePath; } - if (valueCollection.isEmpty()){ - return params; + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; } - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv - - // create the params based on the collection format - if (collectionFormat.equals("multi")) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; } - String delimiter = ","; - - if (collectionFormat.equals("csv")) { - delimiter = ","; - } else if (collectionFormat.equals("ssv")) { - delimiter = " "; - } else if (collectionFormat.equals("tsv")) { - delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { - delimiter = "|"; + /** + * Set HTTP client + * + * @param httpClient An instance of OkHttpClient + * @return Api Client + */ + public ApiClient setHttpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; } - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; } - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - */ - public boolean isJsonMime(String mime) { - return mime != null && mime.matches("(?i)application\\/json(;.*)?"); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; } - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; } - if (respBody == null || "".equals(respBody)) { - return null; + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; } - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create(MediaType.parse(contentType), (File) obj); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(MediaType.parse(contentType), content); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * @throws ApiException If fail to read file content from response and write to disk - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; } - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + public DateFormat getDateFormat() { + return dateFormat; } - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * @see #execute(Call, Type) - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + this.dateLength = this.dateFormat.format(new Date()).length(); + return this; } - } - /** - * #see executeAsync(Call, Type, ApiCallback) - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } + public DateFormat getDatetimeFormat() { + return datetimeFormat; + } - /** - * Execute HTTP call asynchronously. - * - * @see #execute(Call, Type) - * @param The callback to be executed when the API call finishes - */ - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Request request, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } + public ApiClient setDatetimeFormat(DateFormat datetimeFormat) { + this.datetimeFormat = datetimeFormat; + return this; + } - @Override - public void onResponse(Response response) throws IOException { - T result; + /** + * Whether to allow various ISO 8601 datetime formats when parsing a datetime string. + * @see #parseDatetime(String) + * @return True if lenientDatetimeFormat flag is set to true + */ + public boolean isLenientDatetimeFormat() { + return lenientDatetimeFormat; + } + + public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) { + this.lenientDatetimeFormat = lenientDatetimeFormat; + return this; + } + + /** + * Parse the given date string into Date object. + * The default dateFormat supports these ISO 8601 date formats: + * 2015-08-16 + * 2015-8-16 + * @param str String to be parsed + * @return Date + */ + public Date parseDate(String str) { + if (str == null) + return null; try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; + return dateFormat.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Parse the given datetime string into Date object. + * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported: + * 2015-08-16T08:20:05Z + * 2015-8-16T8:20:05Z + * 2015-08-16T08:20:05+00:00 + * 2015-08-16T08:20:05+0000 + * 2015-08-16T08:20:05.376Z + * 2015-08-16T08:20:05.376+00:00 + * 2015-08-16T08:20:05.376+00 + * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of + * these formats: + * Z (same with +0000) + * +08:00 (same with +0800) + * -02 (same with -0200) + * -0200 + * @see ISO 8601 + * @param str Date time string to be parsed + * @return Date representation of the string + */ + public Date parseDatetime(String str) { + if (str == null) + return null; + + DateFormat format; + if (lenientDatetimeFormat) { + /* + * When lenientDatetimeFormat is enabled, normalize the date string + * into LENIENT_DATETIME_FORMAT to support various formats + * defined by ISO 8601. + */ + // normalize time zone + // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000 + str = str.replaceAll("[zZ]\\z", "+0000"); + // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000 + str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2"); + // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000 + str = str.replaceAll("([+-]\\d{2})\\z", "$100"); + // add milliseconds when missing + // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000 + str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2"); + format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT); + } else { + format = this.datetimeFormat; } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @throws ApiException If the response has a unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { try { - respBody = response.body().string(); + return format.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /* + * Parse date or date time in string format into Date object. + * + * @param str Date time string to be parsed + * @return Date representation of the string + */ + public Date parseDateOrDatetime(String str) { + if (str == null) + return null; + else if (str.length() <= dateLength) + return parseDate(str); + else + return parseDatetime(str); + } + + /** + * Format the given Date object into string (Date format). + * + * @param date Date object + * @return Formatted date in string representation + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given Date object into string (Datetime format). + * + * @param date Date object + * @return Formatted datetime in string representation + */ + public String formatDatetime(Date date) { + return datetimeFormat.format(date); + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * @see setLenient + * + * @return True if lenientOnJson is enabled, false otherwise. + */ + public boolean isLenientOnJson() { + return lenientOnJson; + } + + /** + * Set LenientOnJson + * + * @param lenient True to enable lenientOnJson + * @return ApiClient + */ + public ApiClient setLenientOnJson(boolean lenient) { + this.lenientOnJson = lenient; + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient.interceptors().add(loggingInterceptor); + } else { + httpClient.interceptors().remove(loggingInterceptor); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the tempoaray folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.getConnectTimeout(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDatetime((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection)param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Format to {@code Pair} objects. + * + * @param collectionFormat collection format (e.g. csv, tsv) + * @param name Name + * @param value Value + * @return A list of Pair objects + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + + // create the params based on the collection format + if (collectionFormat.equals("multi")) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if (collectionFormat.equals("csv")) { + delimiter = ","; + } else if (collectionFormat.equals("ssv")) { + delimiter = " "; + } else if (collectionFormat.equals("tsv")) { + delimiter = "\t"; + } else if (collectionFormat.equals("pipes")) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + return mime != null && mime.matches("(?i)application\\/json(;.*)?"); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + throw new ApiException(e); } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - final String url = buildUrl(path, queryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create(MediaType.parse(contentType), ""); - } - } else { - reqBody = serialize(body, contentType); - } - - Request request = null; - - if(progressRequestListener != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return httpClient.newCall(request); - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + if (respBody == null || "".equals(respBody)) { + return null; } - } - } - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The Content-Type guessed - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android. - */ - private void initDatetimeFormat() { - String formatWithTimeZone = null; - if (IS_ANDROID) { - if (ANDROID_SDK_VERSION >= 18) { - // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18) - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; - } - } else if (JAVA_VERSION >= 1.7) { - // The time zone format "XXX" is available since Java 1.7 - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; - } - if (formatWithTimeZone != null) { - this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone); - // NOTE: Use the system's default time zone (mainly for datetime formatting). - } else { - // Use a common format that works across all systems. - this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - // Always use the UTC time zone as we are using a constant trailing "Z" here. - this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - } - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - KeyManager[] keyManagers = null; - TrustManager[] trustManagers = null; - HostnameVerifier hostnameVerifier = null; - if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } - }; - SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { return true; } - }; - } else if (sslCaCert != null) { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); } - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManagerFactory.init(caKeyStore); - trustManagers = trustManagerFactory.getTrustManagers(); - } - - if (keyManagers != null || trustManagers != null) { - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); - } else { - httpClient.setSslSocketFactory(null); - } - httpClient.setHostnameVerifier(hostnameVerifier); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); } - } - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create(MediaType.parse(contentType), (File) obj); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(MediaType.parse(contentType), content); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @throws IOException If fail to prepare file for download + * @return Prepared file for the download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @throws ApiException If fail to execute the call + * @return ApiResponse<T> + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @see #execute(Call, Type) + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + */ + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Request request, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @throws ApiException If the response has a unsuccessful status code or + * fail to deserialize the response body + * @return Type + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + final String url = buildUrl(path, queryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create(MediaType.parse(contentType), ""); + } + } else { + reqBody = serialize(body, contentType); + } + + Request request = null; + + if(progressRequestListener != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return httpClient.newCall(request); + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the ofrm of Map + * @param reqBuilder Reqeust.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android. + */ + private void initDatetimeFormat() { + String formatWithTimeZone = null; + if (IS_ANDROID) { + if (ANDROID_SDK_VERSION >= 18) { + // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18) + formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; + } + } else if (JAVA_VERSION >= 1.7) { + // The time zone format "XXX" is available since Java 1.7 + formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; + } + if (formatWithTimeZone != null) { + this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone); + // NOTE: Use the system's default time zone (mainly for datetime formatting). + } else { + // Use a common format that works across all systems. + this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + // Always use the UTC time zone as we are using a constant trailing "Z" here. + this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + } + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + KeyManager[] keyManagers = null; + TrustManager[] trustManagers = null; + HostnameVerifier hostnameVerifier = null; + if (!verifyingSsl) { + TrustManager trustAll = new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public X509Certificate[] getAcceptedIssuers() { return null; } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + trustManagers = new TrustManager[]{ trustAll }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { return true; } + }; + } else if (sslCaCert != null) { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(caKeyStore); + trustManagers = trustManagerFactory.getTrustManagers(); + } + + if (keyManagers != null || trustManagers != null) { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + } else { + httpClient.setSslSocketFactory(null); + } + httpClient.setHostnameVerifier(hostnameVerifier); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } } - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 73836815f56..325f124c2d5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,67 +3,76 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; - public ApiException() {} + public ApiException() {} - public ApiException(Throwable throwable) { - super(throwable); - } + public ApiException(Throwable throwable) { + super(throwable); + } - public ApiException(String message) { - super(message); - } + public ApiException(String message) { + super(message); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(int code, String message) { - super(message); - this.code = code; - } + public ApiException(int code, String message) { + super(message); + this.code = code; + } - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public int getCode() { - return code; - } + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } - /** - * Get the HTTP response headers. - */ - public Map> getResponseHeaders() { - return responseHeaders; - } + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } - /** - * Get the HTTP response body. - */ - public String getResponseBody() { - return responseBody; - } + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java index 0a33f09e64e..b611649f494 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java @@ -9,38 +9,38 @@ import java.util.Map; * @param T The type of data that is deserialized from response body */ public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; + final private int statusCode; + final private Map> headers; + final private T data; - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } - public int getStatusCode() { - return statusCode; - } + public int getStatusCode() { + return statusCode; + } - public Map> getHeaders() { - return headers; - } + public Map> getHeaders() { + return headers; + } - public T getData() { - return data; - } + public T getData() { + return data; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index db5ca8245e1..0131c5123a5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,22 +1,26 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java index d9d0881a153..61120482629 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java @@ -17,69 +17,101 @@ import java.lang.reflect.Type; import java.util.Date; public class JSON { - private ApiClient apiClient; - private Gson gson; + private ApiClient apiClient; + private Gson gson; - public JSON(ApiClient apiClient) { - this.apiClient = apiClient; - gson = new GsonBuilder() - .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) - .create(); - } - - public Gson getGson() { - return gson; - } - - public void setGson(Gson gson) { - this.gson = gson; - } - - /** - * Serialize the given Java object into JSON string. - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param body The JSON string - * @param returnType The type to deserialize inot - * @return The deserialized Java object - */ - public T deserialize(String body, Type returnType) { - try { - if (apiClient.isLenientOnJson()) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - // parse response body into date or datetime for the Date return type. - if (returnType.equals(String.class)) - return (T) body; - else if (returnType.equals(Date.class)) - return (T) apiClient.parseDateOrDatetime(body); - else throw(e); + /** + * JSON constructor. + * + * @param apiClient An instance of ApiClient + */ + public JSON(ApiClient apiClient) { + this.apiClient = apiClient; + gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public void setGson(Gson gson) { + this.gson = gson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize inot + * @return The deserialized Java object + */ + public T deserialize(String body, Type returnType) { + try { + if (apiClient.isLenientOnJson()) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + // parse response body into date or datetime for the Date return type. + if (returnType.equals(String.class)) + return (T) body; + else if (returnType.equals(Date.class)) + return (T) apiClient.parseDateOrDatetime(body); + else throw(e); + } } - } } class DateAdapter implements JsonSerializer, JsonDeserializer { private final ApiClient apiClient; + /** + * Constructor for DateAdapter + * + * @param apiClient Api client + */ public DateAdapter(ApiClient apiClient) { super(); this.apiClient = apiClient; } + /** + * Serialize + * + * @param src Date + * @param typeOfSrc Type + * @param context Json Serialization Context + * @return Json Element + */ @Override public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { if (src == null) { @@ -89,6 +121,16 @@ class DateAdapter implements JsonSerializer, JsonDeserializer { } } + /** + * Deserialize + * + * @param json Json element + * @param date Type + * @param typeOfSrc Type + * @param context Json Serialization Context + * @return Date + * @throw JsonParseException if fail to parse + */ @Override public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException { String str = json.getAsJsonPrimitive().getAsString(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index e49c7eb9146..886d6130e96 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java index 71f34ed1140..d20991c6780 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java @@ -18,9 +18,9 @@ public class ProgressRequestBody extends RequestBody { } private final RequestBody requestBody; - + private final ProgressRequestListener progressListener; - + private BufferedSink bufferedSink; public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { @@ -43,7 +43,7 @@ public class ProgressRequestBody extends RequestBody { if (bufferedSink == null) { bufferedSink = Okio.buffer(sink(sink)); } - + requestBody.writeTo(bufferedSink); bufferedSink.flush(); @@ -51,7 +51,7 @@ public class ProgressRequestBody extends RequestBody { private Sink sink(Sink sink) { return new ForwardingSink(sink) { - + long bytesWritten = 0L; long contentLength = 0L; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index b4a8d21f750..605a18984b2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index d4b464235bf..313707926bf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -17,8 +17,8 @@ import com.squareup.okhttp.Response; import java.io.IOException; -import java.math.BigDecimal; import java.util.Date; +import java.math.BigDecimal; import java.lang.reflect.Type; import java.util.ArrayList; @@ -27,196 +27,196 @@ import java.util.List; import java.util.Map; public class FakeApi { - private ApiClient apiClient; + private ApiClient apiClient; - public FakeApi() { - this(Configuration.getDefaultApiClient()); - } - - public FakeApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /* Build call for testEndpointParameters */ - private Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'number' is set - if (number == null) { - throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + public FakeApi() { + this(Configuration.getDefaultApiClient()); } - - // verify the required parameter '_double' is set - if (_double == null) { - throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; } - - // verify the required parameter 'string' is set - if (string == null) { - throw new ApiException("Missing the required parameter 'string' when calling testEndpointParameters(Async)"); + + public ApiClient getApiClient() { + return apiClient; } - - // verify the required parameter '_byte' is set - if (_byte == null) { - throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; } - - // create path and map variables - String localVarPath = "/fake".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (integer != null) - localVarFormParams.put("integer", integer); - if (int32 != null) - localVarFormParams.put("int32", int32); - if (int64 != null) - localVarFormParams.put("int64", int64); - if (number != null) - localVarFormParams.put("number", number); - if (_float != null) - localVarFormParams.put("float", _float); - if (_double != null) - localVarFormParams.put("double", _double); - if (string != null) - localVarFormParams.put("string", string); - if (_byte != null) - localVarFormParams.put("byte", _byte); - if (binary != null) - localVarFormParams.put("binary", binary); - if (date != null) - localVarFormParams.put("date", date); - if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); - if (password != null) - localVarFormParams.put("password", password); - - final String[] localVarAccepts = { - "application/xml; charset=utf-8", "application/json; charset=utf-8" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/xml; charset=utf-8", "application/json; charset=utf-8" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for testEndpointParameters */ + private Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); } - }); + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'string' is set + if (string == null) { + throw new ApiException("Missing the required parameter 'string' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + + // create path and map variables + String localVarPath = "/fake".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + if (integer != null) + localVarFormParams.put("integer", integer); + if (int32 != null) + localVarFormParams.put("int32", int32); + if (int64 != null) + localVarFormParams.put("int64", int64); + if (number != null) + localVarFormParams.put("number", number); + if (_float != null) + localVarFormParams.put("float", _float); + if (_double != null) + localVarFormParams.put("double", _double); + if (string != null) + localVarFormParams.put("string", string); + if (_byte != null) + localVarFormParams.put("byte", _byte); + if (binary != null) + localVarFormParams.put("binary", binary); + if (date != null) + localVarFormParams.put("date", date); + if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); + if (password != null) + localVarFormParams.put("password", password); + + final String[] localVarAccepts = { + "application/xml; charset=utf-8", "application/json; charset=utf-8" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/xml; charset=utf-8", "application/json; charset=utf-8" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param string None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { - testEndpointParametersWithHttpInfo(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); - } - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param string None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { - Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); - return apiClient.execute(call); - } - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * @param number None (required) - * @param _double None (required) - * @param string None (required) - * @param _byte None (required) - * @param integer None (optional) - * @param int32 None (optional) - * @param int64 None (optional) - * @param _float None (optional) - * @param binary None (optional) - * @param date None (optional) - * @param dateTime None (optional) - * @param password None (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } - Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); + return apiClient.execute(call); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param string None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index ac7ad688c56..c3090d83e1e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -18,8 +18,8 @@ import com.squareup.okhttp.Response; import java.io.IOException; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.lang.reflect.Type; import java.util.ArrayList; @@ -28,887 +28,887 @@ import java.util.List; import java.util.Map; public class PetApi { - private ApiClient apiClient; + private ApiClient apiClient; - public PetApi() { - this(Configuration.getDefaultApiClient()); - } - - public PetApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /* Build call for addPet */ - private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling addPet(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + public PetApi() { + this(Configuration.getDefaultApiClient()); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void addPet(Pet body) throws ApiException { - addPetWithHttpInfo(body); - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - Call call = addPetCall(body, null, null); - return apiClient.execute(call); - } - - /** - * Add a new pet to the store (asynchronously) - * - * @param body Pet object that needs to be added to the store (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; } - Call call = addPetCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for deletePet */ - private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + public ApiClient getApiClient() { + return apiClient; } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deletePet(Long petId, String apiKey) throws ApiException { - deletePetWithHttpInfo(petId, apiKey); - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Call call = deletePetCall(petId, apiKey, null, null); - return apiClient.execute(call); - } - - /** - * Deletes a pet (asynchronously) - * - * @param petId Pet id to delete (required) - * @param apiKey (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; } - Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for findPetsByStatus */ - private Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'status' is set - if (status == null) { - throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - if (status != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for addPet */ + private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling addPet(Async)"); } - }); + + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @return List - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public List findPetsByStatus(List status) throws ApiException { - ApiResponse> resp = findPetsByStatusWithHttpInfo(status); - return resp.getData(); - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @return ApiResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Call call = findPetsByStatusCall(status, null, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Finds Pets by status (asynchronously) - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void addPet(Pet body) throws ApiException { + addPetWithHttpInfo(body); } - Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken>(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for findPetsByTags */ - private Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'tags' is set - if (tags == null) { - throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - if (tags != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { + Call call = addPetCall(body, null, null); + return apiClient.execute(call); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + /** + * Add a new pet to the store (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @return List - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public List findPetsByTags(List tags) throws ApiException { - ApiResponse> resp = findPetsByTagsWithHttpInfo(tags); - return resp.getData(); - } + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @return ApiResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Call call = findPetsByTagsCall(tags, null, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - /** - * Finds Pets by tags (asynchronously) - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + Call call = addPetCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for deletePet */ + private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); } - }; + + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken>(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for getPetById */ - private Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); } - String[] localVarAuthNames = new String[] { "api_key" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) - * @return Pet - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Pet getPetById(Long petId) throws ApiException { - ApiResponse resp = getPetByIdWithHttpInfo(petId); - return resp.getData(); - } - - /** - * Find pet by ID - * Returns a single pet - * @param petId ID of pet to return (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Call call = getPetByIdCall(petId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Find pet by ID (asynchronously) - * Returns a single pet - * @param petId ID of pet to return (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + Call call = deletePetCall(petId, apiKey, null, null); + return apiClient.execute(call); } - Call call = getPetByIdCall(petId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for updatePet */ - private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling updatePet(Async)"); - } - + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { - // create path and map variables - String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - List localVarQueryParams = new ArrayList(); + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }); + + Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for findPetsByStatus */ + private Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/findByStatus".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + if (status != null) + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void updatePet(Pet body) throws ApiException { - updatePetWithHttpInfo(body); - } - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - Call call = updatePetCall(body, null, null); - return apiClient.execute(call); - } - - /** - * Update an existing pet (asynchronously) - * - * @param body Pet object that needs to be added to the store (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List findPetsByStatus(List status) throws ApiException { + ApiResponse> resp = findPetsByStatusWithHttpInfo(status); + return resp.getData(); } - Call call = updatePetCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for updatePetWithForm */ - private Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (name != null) - localVarFormParams.put("name", name); - if (status != null) - localVarFormParams.put("status", status); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { + Call call = findPetsByStatusCall(status, null, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return apiClient.execute(call, localVarReturnType); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void updatePetWithForm(Long petId, String name, String status) throws ApiException { - updatePetWithFormWithHttpInfo(petId, name, status); - } + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Call call = updatePetWithFormCall(petId, name, status, null, null); - return apiClient.execute(call); - } + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - /** - * Updates a pet in the store with form data (asynchronously) - * - * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional) - * @param status Updated status of the pet (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken>(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for findPetsByTags */ + private Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); } - }; + + + // create path and map variables + String localVarPath = "/pet/findByTags".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + if (tags != null) + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for uploadFile */ - private Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); - } - - - // create path and map variables - String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); - if (file != null) - localVarFormParams.put("file", file); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List findPetsByTags(List tags) throws ApiException { + ApiResponse> resp = findPetsByTagsWithHttpInfo(tags); + return resp.getData(); } - String[] localVarAuthNames = new String[] { "petstore_auth" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ModelApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { - ApiResponse resp = uploadFileWithHttpInfo(petId, additionalMetadata, file); - return resp.getData(); - } - - /** - * uploads an image - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Call call = uploadFileCall(petId, additionalMetadata, file, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * uploads an image (asynchronously) - * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional) - * @param file file to upload (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { + Call call = findPetsByTagsCall(tags, null, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return apiClient.execute(call, localVarReturnType); } - Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken>(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for getPetById */ + private Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Pet getPetById(Long petId) throws ApiException { + ApiResponse resp = getPetByIdWithHttpInfo(petId); + return resp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { + Call call = getPetByIdCall(petId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getPetByIdCall(petId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for updatePet */ + private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updatePet(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void updatePet(Pet body) throws ApiException { + updatePetWithHttpInfo(body); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { + Call call = updatePetCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Update an existing pet (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = updatePetCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for updatePetWithForm */ + private Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + if (name != null) + localVarFormParams.put("name", name); + if (status != null) + localVarFormParams.put("status", status); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { + Call call = updatePetWithFormCall(petId, name, status, null, null); + return apiClient.execute(call); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for uploadFile */ + private Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); + if (file != null) + localVarFormParams.put("file", file); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + ApiResponse resp = uploadFileWithHttpInfo(petId, additionalMetadata, file); + return resp.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { + Call call = uploadFileCall(petId, additionalMetadata, file, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index 5d960d0b104..a17475df5b2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -26,436 +26,436 @@ import java.util.List; import java.util.Map; public class StoreApi { - private ApiClient apiClient; + private ApiClient apiClient; - public StoreApi() { - this(Configuration.getDefaultApiClient()); - } - - public StoreApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /* Build call for deleteOrder */ - private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); - } - - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + public StoreApi() { + this(Configuration.getDefaultApiClient()); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteOrder(String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Call call = deleteOrderCall(orderId, null, null); - return apiClient.execute(call); - } - - /** - * Delete purchase order by ID (asynchronously) - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; } - Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for getInventory */ - private Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + public ApiClient getApiClient() { + return apiClient; } - String[] localVarAuthNames = new String[] { "api_key" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return Map - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Map getInventory() throws ApiException { - ApiResponse> resp = getInventoryWithHttpInfo(); - return resp.getData(); - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return ApiResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Call call = getInventoryCall(null, null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Returns pet inventories by status (asynchronously) - * Returns a map of status codes to quantities - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getInventoryAsync(final ApiCallback> callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; } - Call call = getInventoryCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken>(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for getOrderById */ - private Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); - } - - - // create path and map variables - String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for deleteOrder */ + private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); } - }); + + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return Order - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Order getOrderById(Long orderId) throws ApiException { - ApiResponse resp = getOrderByIdWithHttpInfo(orderId); - return resp.getData(); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Call call = getOrderByIdCall(orderId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Find purchase order by ID (asynchronously) - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteOrder(String orderId) throws ApiException { + deleteOrderWithHttpInfo(orderId); } - Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for placeOrder */ - private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling placeOrder(Async)"); - } - - - // create path and map variables - String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { + Call call = deleteOrderCall(orderId, null, null); + return apiClient.execute(call); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + /** + * Delete purchase order by ID (asynchronously) + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return Order - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public Order placeOrder(Order body) throws ApiException { - ApiResponse resp = placeOrderWithHttpInfo(body); - return resp.getData(); - } + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - Call call = placeOrderCall(body, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - /** - * Place an order for a pet (asynchronously) - * - * @param body order placed for purchasing the pet (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for getInventory */ + private Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + + // create path and map variables + String localVarPath = "/store/inventory".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - Call call = placeOrderCall(body, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Map getInventory() throws ApiException { + ApiResponse> resp = getInventoryWithHttpInfo(); + return resp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + Call call = getInventoryCall(null, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getInventoryAsync(final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getInventoryCall(progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken>(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for getOrderById */ + private Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + + // create path and map variables + String localVarPath = "/store/order/{orderId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Order getOrderById(Long orderId) throws ApiException { + ApiResponse resp = getOrderByIdWithHttpInfo(orderId); + return resp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { + Call call = getOrderByIdCall(orderId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for placeOrder */ + private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling placeOrder(Async)"); + } + + + // create path and map variables + String localVarPath = "/store/order".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Order placeOrder(Order body) throws ApiException { + ApiResponse resp = placeOrderWithHttpInfo(body); + return resp.getData(); + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { + Call call = placeOrderCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param body order placed for purchasing the pet (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = placeOrderCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index be0269ef28f..da664e27c4b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -26,861 +26,861 @@ import java.util.List; import java.util.Map; public class UserApi { - private ApiClient apiClient; + private ApiClient apiClient; - public UserApi() { - this(Configuration.getDefaultApiClient()); - } - - public UserApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /* Build call for createUser */ - private Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)"); + public UserApi() { + this(Configuration.getDefaultApiClient()); } - - // create path and map variables - String localVarPath = "/user".replaceAll("\\{format\\}","json"); + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } - List localVarQueryParams = new ArrayList(); + public ApiClient getApiClient() { + return apiClient; + } - Map localVarHeaderParams = new HashMap(); + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for createUser */ + private Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)"); } - }); - } + - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + // create path and map variables + String localVarPath = "/user".replaceAll("\\{format\\}","json"); - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void createUser(User body) throws ApiException { - createUserWithHttpInfo(body); - } + List localVarQueryParams = new ArrayList(); - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - Call call = createUserCall(body, null, null); - return apiClient.execute(call); - } + Map localVarHeaderParams = new HashMap(); - /** - * Create user (asynchronously) - * This can only be done by the logged in user. - * @param body Created user object (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call createUserAsync(User body, final ApiCallback callback) throws ApiException { + Map localVarFormParams = new HashMap(); - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void createUser(User body) throws ApiException { + createUserWithHttpInfo(body); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createUserWithHttpInfo(User body) throws ApiException { + Call call = createUserCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param body Created user object (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call createUserAsync(User body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; + + Call call = createUserCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; } - - Call call = createUserCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for createUsersWithArrayInput */ - private Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling createUsersWithArrayInput(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for createUsersWithArrayInput */ + private Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithArrayInput(Async)"); } - }); - } + - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + // create path and map variables + String localVarPath = "/user/createWithArray".replaceAll("\\{format\\}","json"); - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void createUsersWithArrayInput(List body) throws ApiException { - createUsersWithArrayInputWithHttpInfo(body); - } + List localVarQueryParams = new ArrayList(); - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - Call call = createUsersWithArrayInputCall(body, null, null); - return apiClient.execute(call); - } + Map localVarHeaderParams = new HashMap(); - /** - * Creates list of users with given input array (asynchronously) - * - * @param body List of user object (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { + Map localVarFormParams = new HashMap(); - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void createUsersWithArrayInput(List body) throws ApiException { + createUsersWithArrayInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { + Call call = createUsersWithArrayInputCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; + + Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; } - - Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for createUsersWithListInput */ - private Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling createUsersWithListInput(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for createUsersWithListInput */ + private Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithListInput(Async)"); } - }); - } + - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + // create path and map variables + String localVarPath = "/user/createWithList".replaceAll("\\{format\\}","json"); - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void createUsersWithListInput(List body) throws ApiException { - createUsersWithListInputWithHttpInfo(body); - } + List localVarQueryParams = new ArrayList(); - /** - * Creates list of users with given input array - * - * @param body List of user object (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - Call call = createUsersWithListInputCall(body, null, null); - return apiClient.execute(call); - } + Map localVarHeaderParams = new HashMap(); - /** - * Creates list of users with given input array (asynchronously) - * - * @param body List of user object (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { + Map localVarFormParams = new HashMap(); - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void createUsersWithListInput(List body) throws ApiException { + createUsersWithListInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { + Call call = createUsersWithListInputCall(body, null, null); + return apiClient.execute(call); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; + + Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; } - - Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for deleteUser */ - private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for deleteUser */ + private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); } - }); - } + - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteUser(String username) throws ApiException { - deleteUserWithHttpInfo(username); - } + List localVarQueryParams = new ArrayList(); - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Call call = deleteUserCall(username, null, null); - return apiClient.execute(call); - } + Map localVarHeaderParams = new HashMap(); - /** - * Delete user (asynchronously) - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + Map localVarFormParams = new HashMap(); - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { + Call call = deleteUserCall(username, null, null); + return apiClient.execute(call); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; + + Call call = deleteUserCall(username, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; } - - Call call = deleteUserCall(username, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for getUserByName */ - private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for getUserByName */ + private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); } - }); - } + - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public User getUserByName(String username) throws ApiException { - ApiResponse resp = getUserByNameWithHttpInfo(username); - return resp.getData(); - } + List localVarQueryParams = new ArrayList(); - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Call call = getUserByNameCall(username, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } + Map localVarHeaderParams = new HashMap(); - /** - * Get user by user name (asynchronously) - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + Map localVarFormParams = new HashMap(); - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public User getUserByName(String username) throws ApiException { + ApiResponse resp = getUserByNameWithHttpInfo(username); + return resp.getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { + Call call = getUserByNameCall(username, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; + + Call call = getUserByNameCall(username, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; } - - Call call = getUserByNameCall(username, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for loginUser */ - private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); - } - - // verify the required parameter 'password' is set - if (password == null) { - throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); - } - - - // create path and map variables - String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - if (username != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); - if (password != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + /* Build call for loginUser */ + private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); } - }); + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + + // create path and map variables + String localVarPath = "/user/login".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + if (username != null) + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + if (password != null) + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return String - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public String loginUser(String username, String password) throws ApiException { - ApiResponse resp = loginUserWithHttpInfo(username, password); - return resp.getData(); - } - - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Call call = loginUserCall(username, password, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * Logs user into the system (asynchronously) - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public String loginUser(String username, String password) throws ApiException { + ApiResponse resp = loginUserWithHttpInfo(username, password); + return resp.getData(); } - Call call = loginUserCall(username, password, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /* Build call for logoutUser */ - private Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - - // create path and map variables - String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { + Call call = loginUserCall(username, password, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { - /** - * Logs out current logged in user session - * - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void logoutUser() throws ApiException { - logoutUserWithHttpInfo(); - } + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - /** - * Logs out current logged in user session - * - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Call call = logoutUserCall(null, null); - return apiClient.execute(call); - } + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - /** - * Logs out current logged in user session (asynchronously) - * - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call logoutUserAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }; - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); + Call call = loginUserCall(username, password, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /* Build call for logoutUser */ + private Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + + // create path and map variables + String localVarPath = "/user/logout".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); } - }; + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - Call call = logoutUserCall(progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /* Build call for updateUser */ - private Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void logoutUser() throws ApiException { + logoutUserWithHttpInfo(); } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)"); + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + Call call = logoutUserCall(null, null); + return apiClient.execute(call); } - - // create path and map variables - String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + /** + * Logs out current logged in user session (asynchronously) + * + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call logoutUserAsync(final ApiCallback callback) throws ApiException { - List localVarQueryParams = new ArrayList(); + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - Map localVarHeaderParams = new HashMap(); + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; } - }); + + Call call = logoutUserCall(progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } + /* Build call for updateUser */ + private Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)"); + } + + + // create path and map variables + String localVarPath = "/user/{username}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - String[] localVarAuthNames = new String[] { }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void updateUser(String username, User body) throws ApiException { - updateUserWithHttpInfo(username, body); - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @return ApiResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - Call call = updateUserCall(username, body, null, null); - return apiClient.execute(call); - } - - /** - * Updated user (asynchronously) - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param body Updated user object (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public void updateUser(String username, User body) throws ApiException { + updateUserWithHttpInfo(username, body); } - Call call = updateUserCall(username, body, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { + Call call = updateUserCall(username, body, null, null); + return apiClient.execute(call); + } + + /** + * Updated user (asynchronously) + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + Call call = updateUserCall(username, body, progressListener, progressRequestListener); + apiClient.executeAsync(call, callback); + return call; + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 468c1ad8410..25c57b9e7d9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java index 98b1a6900b9..c5527df3b33 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java @@ -6,6 +6,11 @@ import java.util.Map; import java.util.List; public interface Authentication { - /** Apply authentication settings to header and query params. */ - void applyToParams(List queryParams, Map headerParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 6ed16d1db30..45477136538 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -10,32 +10,32 @@ import java.util.List; import java.io.UnsupportedEncodingException; public class HttpBasicAuth implements Authentication { - private String username; - private String password; + private String username; + private String password; - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (username == null && password == null) { - return; + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index 0b85d10068e..354330e0013 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:49.229+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index ab464f65259..eae1fc450de 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -14,72 +14,88 @@ import com.google.gson.annotations.SerializedName; * AdditionalPropertiesClass */ public class AdditionalPropertiesClass { - - @SerializedName("map_property") - private Map mapProperty = new HashMap(); + @SerializedName("map_property") + private Map mapProperty = new HashMap(); + @SerializedName("map_of_map_property") + private Map> mapOfMapProperty = new HashMap>(); - @SerializedName("map_of_map_property") - private Map> mapOfMapProperty = new HashMap>(); - - /** - **/ - @ApiModelProperty(value = "") - public Map getMapProperty() { - return mapProperty; - } - public void setMapProperty(Map mapProperty) { - this.mapProperty = mapProperty; - } - - /** - **/ - @ApiModelProperty(value = "") - public Map> getMapOfMapProperty() { - return mapOfMapProperty; - } - public void setMapOfMapProperty(Map> mapOfMapProperty) { - this.mapOfMapProperty = mapOfMapProperty; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get mapProperty + * @return mapProperty + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set mapProperty + * + * @param mapProperty mapProperty + */ + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; } - AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + /** + * Set mapOfMapProperty + * + * @param mapOfMapProperty mapOfMapProperty + */ + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); - } - - @Override - public int hashCode() { - return Objects.hash(mapProperty, mapOfMapProperty); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesClass {\n"); - - sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); - sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java index b83bc63db0e..1dc78139c73 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java @@ -11,72 +11,88 @@ import com.google.gson.annotations.SerializedName; * Animal */ public class Animal { - - @SerializedName("className") - private String className = null; + @SerializedName("className") + private String className = null; + @SerializedName("color") + private String color = "red"; - @SerializedName("color") - private String color = "red"; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getColor() { - return color; - } - public void setColor(String color) { - this.color = color; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set className + * + * @param className className + */ + public void setClassName(String className) { + this.className = className; } - Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + /** + * Set color + * + * @param color color + */ + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && Objects.equals(this.color, animal.color); - } - - @Override - public int hashCode() { - return Objects.hash(className, color); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Animal {\n"); - - sb.append(" className: ").append(toIndentedString(className)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java index 8be2f1ecd0d..ccbebe839f1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -12,42 +12,44 @@ import com.google.gson.annotations.SerializedName; * AnimalFarm */ public class AnimalFarm extends ArrayList { - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); } - return true; - } - @Override - public int hashCode() { - return Objects.hash(super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AnimalFarm {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java index 19ad5d37499..6a0f8f790fa 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java @@ -13,87 +13,110 @@ import com.google.gson.annotations.SerializedName; * ArrayTest */ public class ArrayTest { - - @SerializedName("array_of_string") - private List arrayOfString = new ArrayList(); + @SerializedName("array_of_string") + private List arrayOfString = new ArrayList(); + @SerializedName("array_array_of_integer") + private List> arrayArrayOfInteger = new ArrayList>(); + @SerializedName("array_array_of_model") + private List> arrayArrayOfModel = new ArrayList>(); - @SerializedName("array_array_of_integer") - private List> arrayArrayOfInteger = new ArrayList>(); - - @SerializedName("array_array_of_model") - private List> arrayArrayOfModel = new ArrayList>(); - - /** - **/ - @ApiModelProperty(value = "") - public List getArrayOfString() { - return arrayOfString; - } - public void setArrayOfString(List arrayOfString) { - this.arrayOfString = arrayOfString; - } - - /** - **/ - @ApiModelProperty(value = "") - public List> getArrayArrayOfInteger() { - return arrayArrayOfInteger; - } - public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { - this.arrayArrayOfInteger = arrayArrayOfInteger; - } - - /** - **/ - @ApiModelProperty(value = "") - public List> getArrayArrayOfModel() { - return arrayArrayOfModel; - } - public void setArrayArrayOfModel(List> arrayArrayOfModel) { - this.arrayArrayOfModel = arrayArrayOfModel; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get arrayOfString + * @return arrayOfString + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set arrayOfString + * + * @param arrayOfString arrayOfString + */ + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; } - ArrayTest arrayTest = (ArrayTest) o; - return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + /** + * Set arrayArrayOfInteger + * + * @param arrayArrayOfInteger arrayArrayOfInteger + */ + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + /** + * Set arrayArrayOfModel + * + * @param arrayArrayOfModel arrayArrayOfModel + */ + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); - } - - @Override - public int hashCode() { - return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ArrayTest {\n"); - - sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); - sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); - sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java index 7d190d48425..c7655665883 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java @@ -12,88 +12,111 @@ import com.google.gson.annotations.SerializedName; * Cat */ public class Cat extends Animal { - - @SerializedName("className") - private String className = null; + @SerializedName("className") + private String className = null; + @SerializedName("color") + private String color = "red"; + @SerializedName("declawed") + private Boolean declawed = null; - @SerializedName("color") - private String color = "red"; - - @SerializedName("declawed") - private Boolean declawed = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getColor() { - return color; - } - public void setColor(String color) { - this.color = color; - } - - /** - **/ - @ApiModelProperty(value = "") - public Boolean getDeclawed() { - return declawed; - } - public void setDeclawed(Boolean declawed) { - this.declawed = declawed; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set className + * + * @param className className + */ + public void setClassName(String className) { + this.className = className; } - Cat cat = (Cat) o; - return Objects.equals(this.className, cat.className) && + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + /** + * Set color + * + * @param color color + */ + public void setColor(String color) { + this.color = color; + } + + /** + * Get declawed + * @return declawed + **/ + @ApiModelProperty(value = "") + public Boolean getDeclawed() { + return declawed; + } + + /** + * Set declawed + * + * @param declawed declawed + */ + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.className, cat.className) && Objects.equals(this.color, cat.color) && Objects.equals(this.declawed, cat.declawed) && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(className, color, declawed, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Cat {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(className, color, declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java index f72d42a5746..c156ce3a330 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java @@ -11,72 +11,88 @@ import com.google.gson.annotations.SerializedName; * Category */ public class Category { - - @SerializedName("id") - private Long id = null; + @SerializedName("id") + private Long id = null; + @SerializedName("name") + private String name = null; - @SerializedName("name") - private String name = null; - - /** - **/ - @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set id + * + * @param id id + */ + public void setId(Long id) { + this.id = id; } - Category category = (Category) o; - return Objects.equals(this.id, category.id) && + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + /** + * Set name + * + * @param name name + */ + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && Objects.equals(this.name, category.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java index ba9f5ac5858..e2823490c0d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java @@ -12,88 +12,111 @@ import com.google.gson.annotations.SerializedName; * Dog */ public class Dog extends Animal { - - @SerializedName("className") - private String className = null; + @SerializedName("className") + private String className = null; + @SerializedName("color") + private String color = "red"; + @SerializedName("breed") + private String breed = null; - @SerializedName("color") - private String color = "red"; - - @SerializedName("breed") - private String breed = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getClassName() { - return className; - } - public void setClassName(String className) { - this.className = className; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getColor() { - return color; - } - public void setColor(String color) { - this.color = color; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getBreed() { - return breed; - } - public void setBreed(String breed) { - this.breed = breed; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set className + * + * @param className className + */ + public void setClassName(String className) { + this.className = className; } - Dog dog = (Dog) o; - return Objects.equals(this.className, dog.className) && + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + /** + * Set color + * + * @param color color + */ + public void setColor(String color) { + this.color = color; + } + + /** + * Get breed + * @return breed + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + + /** + * Set breed + * + * @param breed breed + */ + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.className, dog.className) && Objects.equals(this.color, dog.color) && Objects.equals(this.breed, dog.breed) && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(className, color, breed, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Dog {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" className: ").append(toIndentedString(className)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(className, color, breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java index 6426f26867c..7008dd7ba4b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java @@ -9,24 +9,24 @@ import com.google.gson.annotations.SerializedName; * Gets or Sets EnumClass */ public enum EnumClass { - @SerializedName("_abc") - _ABC("_abc"), + @SerializedName("_abc") + _ABC("_abc"), - @SerializedName("-efg") - _EFG("-efg"), + @SerializedName("-efg") + _EFG("-efg"), - @SerializedName("(xyz)") - _XYZ_("(xyz)"); + @SerializedName("(xyz)") + _XYZ_("(xyz)"); - private String value; + private String value; - EnumClass(String value) { - this.value = value; - } + EnumClass(String value) { + this.value = value; + } - @Override - public String toString() { - return String.valueOf(value); - } + @Override + public String toString() { + return String.valueOf(value); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java index 9b3103c16d7..3da7e768f66 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,8 +11,6 @@ import com.google.gson.annotations.SerializedName; * EnumTest */ public class EnumTest { - - /** * Gets or Sets enumString */ @@ -35,10 +33,8 @@ public class EnumTest { } } - @SerializedName("enum_string") - private EnumStringEnum enumString = null; - - + @SerializedName("enum_string") + private EnumStringEnum enumString = null; /** * Gets or Sets enumInteger */ @@ -61,10 +57,8 @@ public class EnumTest { } } - @SerializedName("enum_integer") - private EnumIntegerEnum enumInteger = null; - - + @SerializedName("enum_integer") + private EnumIntegerEnum enumInteger = null; /** * Gets or Sets enumNumber */ @@ -87,80 +81,106 @@ public class EnumTest { } } - @SerializedName("enum_number") - private EnumNumberEnum enumNumber = null; + @SerializedName("enum_number") + private EnumNumberEnum enumNumber = null; - /** - **/ - @ApiModelProperty(value = "") - public EnumStringEnum getEnumString() { - return enumString; - } - public void setEnumString(EnumStringEnum enumString) { - this.enumString = enumString; - } - - /** - **/ - @ApiModelProperty(value = "") - public EnumIntegerEnum getEnumInteger() { - return enumInteger; - } - public void setEnumInteger(EnumIntegerEnum enumInteger) { - this.enumInteger = enumInteger; - } - - /** - **/ - @ApiModelProperty(value = "") - public EnumNumberEnum getEnumNumber() { - return enumNumber; - } - public void setEnumNumber(EnumNumberEnum enumNumber) { - this.enumNumber = enumNumber; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get enumString + * @return enumString + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set enumString + * + * @param enumString enumString + */ + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; } - EnumTest enumTest = (EnumTest) o; - return Objects.equals(this.enumString, enumTest.enumString) && + + /** + * Get enumInteger + * @return enumInteger + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + /** + * Set enumInteger + * + * @param enumInteger enumInteger + */ + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + /** + * Set enumNumber + * + * @param enumNumber enumNumber + */ + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber); - } - - @Override - public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EnumTest {\n"); - - sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); - sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); - sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index af3fec2a2ea..37c3412ee08 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -13,197 +13,288 @@ import com.google.gson.annotations.SerializedName; * FormatTest */ public class FormatTest { - - @SerializedName("integer") - private Integer integer = null; + @SerializedName("integer") + private Integer integer = null; + @SerializedName("int32") + private Integer int32 = null; + @SerializedName("int64") + private Long int64 = null; + @SerializedName("number") + private BigDecimal number = null; + @SerializedName("float") + private Float _float = null; + @SerializedName("double") + private Double _double = null; + @SerializedName("string") + private String string = null; + @SerializedName("byte") + private byte[] _byte = null; + @SerializedName("binary") + private byte[] binary = null; + @SerializedName("date") + private Date date = null; + @SerializedName("dateTime") + private Date dateTime = null; + @SerializedName("uuid") + private String uuid = null; + @SerializedName("password") + private String password = null; - @SerializedName("int32") - private Integer int32 = null; - - @SerializedName("int64") - private Long int64 = null; - - @SerializedName("number") - private BigDecimal number = null; - - @SerializedName("float") - private Float _float = null; - - @SerializedName("double") - private Double _double = null; - - @SerializedName("string") - private String string = null; - - @SerializedName("byte") - private byte[] _byte = null; - - @SerializedName("binary") - private byte[] binary = null; - - @SerializedName("date") - private Date date = null; - - @SerializedName("dateTime") - private Date dateTime = null; - - @SerializedName("uuid") - private String uuid = null; - - @SerializedName("password") - private String password = null; - - /** - * minimum: 10.0 - * maximum: 100.0 - **/ - @ApiModelProperty(value = "") - public Integer getInteger() { - return integer; - } - public void setInteger(Integer integer) { - this.integer = integer; - } - - /** - * minimum: 20.0 - * maximum: 200.0 - **/ - @ApiModelProperty(value = "") - public Integer getInt32() { - return int32; - } - public void setInt32(Integer int32) { - this.int32 = int32; - } - - /** - **/ - @ApiModelProperty(value = "") - public Long getInt64() { - return int64; - } - public void setInt64(Long int64) { - this.int64 = int64; - } - - /** - * minimum: 32.1 - * maximum: 543.2 - **/ - @ApiModelProperty(required = true, value = "") - public BigDecimal getNumber() { - return number; - } - public void setNumber(BigDecimal number) { - this.number = number; - } - - /** - * minimum: 54.3 - * maximum: 987.6 - **/ - @ApiModelProperty(value = "") - public Float getFloat() { - return _float; - } - public void setFloat(Float _float) { - this._float = _float; - } - - /** - * minimum: 67.8 - * maximum: 123.4 - **/ - @ApiModelProperty(value = "") - public Double getDouble() { - return _double; - } - public void setDouble(Double _double) { - this._double = _double; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getString() { - return string; - } - public void setString(String string) { - this.string = string; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public byte[] getByte() { - return _byte; - } - public void setByte(byte[] _byte) { - this._byte = _byte; - } - - /** - **/ - @ApiModelProperty(value = "") - public byte[] getBinary() { - return binary; - } - public void setBinary(byte[] binary) { - this.binary = binary; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Date getDate() { - return date; - } - public void setDate(Date date) { - this.date = date; - } - - /** - **/ - @ApiModelProperty(value = "") - public Date getDateTime() { - return dateTime; - } - public void setDateTime(Date dateTime) { - this.dateTime = dateTime; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getUuid() { - return uuid; - } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get integer + * minimum: 10.0 + * maximum: 100.0 + * @return integer + **/ + @ApiModelProperty(value = "") + public Integer getInteger() { + return integer; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set integer + * + * @param integer integer + */ + public void setInteger(Integer integer) { + this.integer = integer; } - FormatTest formatTest = (FormatTest) o; - return Objects.equals(this.integer, formatTest.integer) && + + /** + * Get int32 + * minimum: 20.0 + * maximum: 200.0 + * @return int32 + **/ + @ApiModelProperty(value = "") + public Integer getInt32() { + return int32; + } + + /** + * Set int32 + * + * @param int32 int32 + */ + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + * Get int64 + * @return int64 + **/ + @ApiModelProperty(value = "") + public Long getInt64() { + return int64; + } + + /** + * Set int64 + * + * @param int64 int64 + */ + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + public BigDecimal getNumber() { + return number; + } + + /** + * Set number + * + * @param number number + */ + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @ApiModelProperty(value = "") + public Float getFloat() { + return _float; + } + + /** + * Set _float + * + * @param _float _float + */ + public void setFloat(Float _float) { + this._float = _float; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(value = "") + public Double getDouble() { + return _double; + } + + /** + * Set _double + * + * @param _double _double + */ + public void setDouble(Double _double) { + this._double = _double; + } + + /** + * Get string + * @return string + **/ + @ApiModelProperty(value = "") + public String getString() { + return string; + } + + /** + * Set string + * + * @param string string + */ + public void setString(String string) { + this.string = string; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + public byte[] getByte() { + return _byte; + } + + /** + * Set _byte + * + * @param _byte _byte + */ + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + * Get binary + * @return binary + **/ + @ApiModelProperty(value = "") + public byte[] getBinary() { + return binary; + } + + /** + * Set binary + * + * @param binary binary + */ + public void setBinary(byte[] binary) { + this.binary = binary; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + public Date getDate() { + return date; + } + + /** + * Set date + * + * @param date date + */ + public void setDate(Date date) { + this.date = date; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + + /** + * Set dateTime + * + * @param dateTime dateTime + */ + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + + /** + * Set uuid + * + * @param uuid uuid + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + public String getPassword() { + return password; + } + + /** + * Set password + * + * @param password password + */ + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && Objects.equals(this.int32, formatTest.int32) && Objects.equals(this.int64, formatTest.int64) && Objects.equals(this.number, formatTest.number) && @@ -216,44 +307,46 @@ public class FormatTest { Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password); - } - - @Override - public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FormatTest {\n"); - - sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); - sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); - sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); - sb.append(" number: ").append(toIndentedString(number)).append("\n"); - sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); - sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); - sb.append(" string: ").append(toIndentedString(string)).append("\n"); - sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); - sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); - sb.append(" date: ").append(toIndentedString(date)).append("\n"); - sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); - sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 5748d6731cf..124515dad27 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -16,87 +16,110 @@ import com.google.gson.annotations.SerializedName; * MixedPropertiesAndAdditionalPropertiesClass */ public class MixedPropertiesAndAdditionalPropertiesClass { - - @SerializedName("uuid") - private String uuid = null; + @SerializedName("uuid") + private String uuid = null; + @SerializedName("dateTime") + private Date dateTime = null; + @SerializedName("map") + private Map map = new HashMap(); - @SerializedName("dateTime") - private Date dateTime = null; - - @SerializedName("map") - private Map map = new HashMap(); - - /** - **/ - @ApiModelProperty(value = "") - public String getUuid() { - return uuid; - } - public void setUuid(String uuid) { - this.uuid = uuid; - } - - /** - **/ - @ApiModelProperty(value = "") - public Date getDateTime() { - return dateTime; - } - public void setDateTime(Date dateTime) { - this.dateTime = dateTime; - } - - /** - **/ - @ApiModelProperty(value = "") - public Map getMap() { - return map; - } - public void setMap(Map map) { - this.map = map; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set uuid + * + * @param uuid uuid + */ + public void setUuid(String uuid) { + this.uuid = uuid; } - MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; - return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + + /** + * Set dateTime + * + * @param dateTime dateTime + */ + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + * Get map + * @return map + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + + /** + * Set map + * + * @param map map + */ + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); - } - - @Override - public int hashCode() { - return Objects.hash(uuid, dateTime, map); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); - - sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); - sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); - sb.append(" map: ").append(toIndentedString(map)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index 0ca445cb545..6a14bc15a22 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -12,57 +12,66 @@ import com.google.gson.annotations.SerializedName; */ @ApiModel(description = "Model for testing model name starting with number") public class Model200Response { - - @SerializedName("name") - private Integer name = null; + @SerializedName("name") + private Integer name = null; - /** - **/ - @ApiModelProperty(value = "") - public Integer getName() { - return name; - } - public void setName(Integer name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set name + * + * @param name name + */ + public void setName(Integer name) { + this.name = name; } - Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name); - } - @Override - public int hashCode() { - return Objects.hash(name); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Model200Response {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(this.name, _200Response.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java index da52eda160d..1c13fce28b8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -11,87 +11,110 @@ import com.google.gson.annotations.SerializedName; * ModelApiResponse */ public class ModelApiResponse { - - @SerializedName("code") - private Integer code = null; + @SerializedName("code") + private Integer code = null; + @SerializedName("type") + private String type = null; + @SerializedName("message") + private String message = null; - @SerializedName("type") - private String type = null; - - @SerializedName("message") - private String message = null; - - /** - **/ - @ApiModelProperty(value = "") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set code + * + * @param code code + */ + public void setCode(Integer code) { + this.code = code; } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + + /** + * Set type + * + * @param type type + */ + public void setType(String type) { + this.type = type; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + /** + * Set message + * + * @param message message + */ + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && Objects.equals(this.type, _apiResponse.type) && Objects.equals(this.message, _apiResponse.message); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index 51aa1f4e055..dceff653982 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -12,57 +12,66 @@ import com.google.gson.annotations.SerializedName; */ @ApiModel(description = "Model for testing reserved words") public class ModelReturn { - - @SerializedName("return") - private Integer _return = null; + @SerializedName("return") + private Integer _return = null; - /** - **/ - @ApiModelProperty(value = "") - public Integer getReturn() { - return _return; - } - public void setReturn(Integer _return) { - this._return = _return; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get _return + * @return _return + **/ + @ApiModelProperty(value = "") + public Integer getReturn() { + return _return; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set _return + * + * @param _return _return + */ + public void setReturn(Integer _return) { + this._return = _return; } - ModelReturn _return = (ModelReturn) o; - return Objects.equals(this._return, _return._return); - } - @Override - public int hashCode() { - return Objects.hash(_return); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelReturn {\n"); - - sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java index e471107b3dc..9a15ccc032b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -12,96 +12,114 @@ import com.google.gson.annotations.SerializedName; */ @ApiModel(description = "Model for testing model name same as property name") public class Name { - - @SerializedName("name") - private Integer name = null; + @SerializedName("name") + private Integer name = null; + @SerializedName("snake_case") + private Integer snakeCase = null; + @SerializedName("property") + private String property = null; + @SerializedName("123Number") + private Integer _123Number = null; - @SerializedName("snake_case") - private Integer snakeCase = null; - - @SerializedName("property") - private String property = null; - - @SerializedName("123Number") - private Integer _123Number = null; - - /** - **/ - @ApiModelProperty(required = true, value = "") - public Integer getName() { - return name; - } - public void setName(Integer name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(value = "") - public Integer getSnakeCase() { - return snakeCase; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getProperty() { - return property; - } - public void setProperty(String property) { - this.property = property; - } - - /** - **/ - @ApiModelProperty(value = "") - public Integer get123Number() { - return _123Number; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public Integer getName() { + return name; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set name + * + * @param name name + */ + public void setName(Integer name) { + this.name = name; } - Name name = (Name) o; - return Objects.equals(this.name, name.name) && + + /** + * Get snakeCase + * @return snakeCase + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + + /** + * Get property + * @return property + **/ + @ApiModelProperty(value = "") + public String getProperty() { + return property; + } + + /** + * Set property + * + * @param property property + */ + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123Number + * @return _123Number + **/ + @ApiModelProperty(value = "") + public Integer get123Number() { + return _123Number; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && Objects.equals(this.snakeCase, name.snakeCase) && Objects.equals(this.property, name.property) && Objects.equals(this._123Number, name._123Number); - } - - @Override - public int hashCode() { - return Objects.hash(name, snakeCase, property, _123Number); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Name {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); - sb.append(" property: ").append(toIndentedString(property)).append("\n"); - sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123Number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index e5c87a21e5b..6e52dd1712c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -12,20 +12,14 @@ import com.google.gson.annotations.SerializedName; * Order */ public class Order { - - @SerializedName("id") - private Long id = null; - - @SerializedName("petId") - private Long petId = null; - - @SerializedName("quantity") - private Integer quantity = null; - - @SerializedName("shipDate") - private Date shipDate = null; - - + @SerializedName("id") + private Long id = null; + @SerializedName("petId") + private Long petId = null; + @SerializedName("quantity") + private Integer quantity = null; + @SerializedName("shipDate") + private Date shipDate = null; /** * Order Status */ @@ -51,120 +45,168 @@ public class Order { } } - @SerializedName("status") - private StatusEnum status = null; + @SerializedName("status") + private StatusEnum status = null; + @SerializedName("complete") + private Boolean complete = false; - @SerializedName("complete") - private Boolean complete = false; - - /** - **/ - @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - /** - **/ - @ApiModelProperty(value = "") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - /** - **/ - @ApiModelProperty(value = "") - public Date getShipDate() { - return shipDate; - } - public void setShipDate(Date shipDate) { - this.shipDate = shipDate; - } - - /** - * Order Status - **/ - @ApiModelProperty(value = "Order Status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - **/ - @ApiModelProperty(value = "") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set id + * + * @param id id + */ + public void setId(Long id) { + this.id = id; } - Order order = (Order) o; - return Objects.equals(this.id, order.id) && + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + public Long getPetId() { + return petId; + } + + /** + * Set petId + * + * @param petId petId + */ + public void setPetId(Long petId) { + this.petId = petId; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + public Integer getQuantity() { + return quantity; + } + + /** + * Set quantity + * + * @param quantity quantity + */ + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + /** + * Get shipDate + * @return shipDate + **/ + @ApiModelProperty(value = "") + public Date getShipDate() { + return shipDate; + } + + /** + * Set shipDate + * + * @param shipDate shipDate + */ + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { + return status; + } + + /** + * Set status + * + * @param status status + */ + public void setStatus(StatusEnum status) { + this.status = status; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + public Boolean getComplete() { + return complete; + } + + /** + * Set complete + * + * @param complete complete + */ + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && Objects.equals(this.petId, order.petId) && Objects.equals(this.quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) && Objects.equals(this.status, order.status) && Objects.equals(this.complete, order.complete); - } - - @Override - public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); - sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); - sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java index bc18c39e75f..abb2dcdef48 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java @@ -15,23 +15,16 @@ import com.google.gson.annotations.SerializedName; * Pet */ public class Pet { - - @SerializedName("id") - private Long id = null; - - @SerializedName("category") - private Category category = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("photoUrls") - private List photoUrls = new ArrayList(); - - @SerializedName("tags") - private List tags = new ArrayList(); - - + @SerializedName("id") + private Long id = null; + @SerializedName("category") + private Category category = null; + @SerializedName("name") + private String name = null; + @SerializedName("photoUrls") + private List photoUrls = new ArrayList(); + @SerializedName("tags") + private List tags = new ArrayList(); /** * pet status in the store */ @@ -57,117 +50,166 @@ public class Pet { } } - @SerializedName("status") - private StatusEnum status = null; + @SerializedName("status") + private StatusEnum status = null; - /** - **/ - @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - /** - **/ - @ApiModelProperty(required = true, value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - /** - **/ - @ApiModelProperty(value = "") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set id + * + * @param id id + */ + public void setId(Long id) { + this.id = id; } - Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && + + /** + * Get category + * @return category + **/ + @ApiModelProperty(value = "") + public Category getCategory() { + return category; + } + + /** + * Set category + * + * @param category category + */ + public void setCategory(Category category) { + this.category = category; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public String getName() { + return name; + } + + /** + * Set name + * + * @param name name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + + /** + * Set photoUrls + * + * @param photoUrls photoUrls + */ + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + + /** + * Set tags + * + * @param tags tags + */ + public void setTags(List tags) { + this.tags = tags; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + + /** + * Set status + * + * @param status status + */ + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && Objects.equals(this.category, pet.category) && Objects.equals(this.name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) && Objects.equals(this.status, pet.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 2e6c3c4f7ff..bdaa83c3acf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -11,69 +11,79 @@ import com.google.gson.annotations.SerializedName; * ReadOnlyFirst */ public class ReadOnlyFirst { - - @SerializedName("bar") - private String bar = null; + @SerializedName("bar") + private String bar = null; + @SerializedName("baz") + private String baz = null; - @SerializedName("baz") - private String baz = null; - - /** - **/ - @ApiModelProperty(value = "") - public String getBar() { - return bar; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getBaz() { - return baz; - } - public void setBaz(String baz) { - this.baz = baz; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Get baz + * @return baz + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; } - ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; - return Objects.equals(this.bar, readOnlyFirst.bar) && + + /** + * Set baz + * + * @param baz baz + */ + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && Objects.equals(this.baz, readOnlyFirst.baz); - } - - @Override - public int hashCode() { - return Objects.hash(bar, baz); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReadOnlyFirst {\n"); - - sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); - sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java index 46cee3c51f8..2646fadf61c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -11,57 +11,66 @@ import com.google.gson.annotations.SerializedName; * SpecialModelName */ public class SpecialModelName { - - @SerializedName("$special[property.name]") - private Long specialPropertyName = null; + @SerializedName("$special[property.name]") + private Long specialPropertyName = null; - /** - **/ - @ApiModelProperty(value = "") - public Long getSpecialPropertyName() { - return specialPropertyName; - } - public void setSpecialPropertyName(Long specialPropertyName) { - this.specialPropertyName = specialPropertyName; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get specialPropertyName + * @return specialPropertyName + **/ + @ApiModelProperty(value = "") + public Long getSpecialPropertyName() { + return specialPropertyName; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set specialPropertyName + * + * @param specialPropertyName specialPropertyName + */ + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; } - SpecialModelName specialModelName = (SpecialModelName) o; - return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); - } - @Override - public int hashCode() { - return Objects.hash(specialPropertyName); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SpecialModelName {\n"); - - sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java index 600acee2ba7..0f71d4e2a7f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java @@ -11,72 +11,88 @@ import com.google.gson.annotations.SerializedName; * Tag */ public class Tag { - - @SerializedName("id") - private Long id = null; + @SerializedName("id") + private Long id = null; + @SerializedName("name") + private String name = null; - @SerializedName("name") - private String name = null; - - /** - **/ - @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set id + * + * @param id id + */ + public void setId(Long id) { + this.id = id; } - Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + /** + * Set name + * + * @param name name + */ + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && Objects.equals(this.name, tag.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java index c8b44ce6562..332d6b81ba0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java @@ -11,123 +11,178 @@ import com.google.gson.annotations.SerializedName; * User */ public class User { - - @SerializedName("id") - private Long id = null; + @SerializedName("id") + private Long id = null; + @SerializedName("username") + private String username = null; + @SerializedName("firstName") + private String firstName = null; + @SerializedName("lastName") + private String lastName = null; + @SerializedName("email") + private String email = null; + @SerializedName("password") + private String password = null; + @SerializedName("phone") + private String phone = null; + @SerializedName("userStatus") + private Integer userStatus = null; - @SerializedName("username") - private String username = null; - - @SerializedName("firstName") - private String firstName = null; - - @SerializedName("lastName") - private String lastName = null; - - @SerializedName("email") - private String email = null; - - @SerializedName("password") - private String password = null; - - @SerializedName("phone") - private String phone = null; - - @SerializedName("userStatus") - private Integer userStatus = null; - - /** - **/ - @ApiModelProperty(value = "") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - /** - **/ - @ApiModelProperty(value = "") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - /** - * User Status - **/ - @ApiModelProperty(value = "User Status") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; } - if (o == null || getClass() != o.getClass()) { - return false; + + /** + * Set id + * + * @param id id + */ + public void setId(Long id) { + this.id = id; } - User user = (User) o; - return Objects.equals(this.id, user.id) && + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + public String getUsername() { + return username; + } + + /** + * Set username + * + * @param username username + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + /** + * Set firstName + * + * @param firstName firstName + */ + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + /** + * Set lastName + * + * @param lastName lastName + */ + public void setLastName(String lastName) { + this.lastName = lastName; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + /** + * Set email + * + * @param email email + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + /** + * Set password + * + * @param password password + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + public String getPhone() { + return phone; + } + + /** + * Set phone + * + * @param phone phone + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { + return userStatus; + } + + /** + * Set userStatus + * + * @param userStatus userStatus + */ + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && Objects.equals(this.username, user.username) && Objects.equals(this.firstName, user.firstName) && Objects.equals(this.lastName, user.lastName) && @@ -135,39 +190,41 @@ public class User { Objects.equals(this.password, user.password) && Objects.equals(this.phone, user.phone) && Objects.equals(this.userStatus, user.userStatus); - } - - @Override - public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); - sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; } - return o.toString().replace("\n", "\n "); - } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + * + * @param o Object to be converted to indented string + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index a655050c263..1dbc687de01 100644 --- a/samples/client/petstore/python/.gitignore +++ b/samples/client/petstore/python/.gitignore @@ -44,8 +44,6 @@ nosetests.xml coverage.xml *,cover .hypothesis/ -venv/ -.python-version # Translations *.mo diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 7bf57caa2b8..15d55317325 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-07T00:29:52.148+09:00 +- Build date: 2016-06-08T10:26:51.066+08:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -130,6 +130,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## petstore_auth - **Type**: OAuth @@ -139,12 +145,6 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## Author diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 76f1f57c784..ec940b71413 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -221,6 +221,13 @@ class Configuration(object): :return: The Auth Settings information dict. """ return { + 'api_key': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, 'petstore_auth': { @@ -229,13 +236,6 @@ class Configuration(object): 'key': 'Authorization', 'value': 'Bearer ' + self.access_token }, - 'api_key': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'api_key', - 'value': self.get_api_key_with_prefix('api_key') - }, } From acf17c85adc05b60938b830e263e19c1f1123d5c Mon Sep 17 00:00:00 2001 From: cbornet Date: Wed, 8 Jun 2016 18:50:49 +0200 Subject: [PATCH 34/67] add joda support to retrofit clients and use it in samples also adds back the petstore tests --- bin/java-petstore-retrofit2.sh | 2 +- bin/java-petstore-retrofit2rx.sh | 2 +- .../libraries/retrofit2/ApiClient.mustache | 64 ++++ .../libraries/retrofit2/build.gradle.mustache | 17 +- .../libraries/retrofit2/build.sbt.mustache | 7 +- .../Java/libraries/retrofit2/pom.mustache | 11 +- .../petstore/java/retrofit2/build.gradle | 5 +- .../client/petstore/java/retrofit2/build.sbt | 1 + .../petstore/java/retrofit2/docs/FakeApi.md | 8 +- .../java/retrofit2/docs/FormatTest.md | 4 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../petstore/java/retrofit2/docs/Order.md | 2 +- .../client/petstore/java/retrofit2/pom.xml | 8 +- .../java/io/swagger/client/ApiClient.java | 64 ++++ .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../io/swagger/client/model/FormatTest.java | 15 +- ...ropertiesAndAdditionalPropertiesClass.java | 8 +- .../java/io/swagger/client/model/Order.java | 8 +- .../src/test/java/io/swagger/TestUtils.java | 17 + .../io/swagger/client/api/PetApiTest.java | 249 ++++++++------ .../io/swagger/client/api/StoreApiTest.java | 110 +++--- .../io/swagger/client/api/UserApiTest.java | 157 ++++----- .../petstore/java/retrofit2rx/build.gradle | 5 +- .../petstore/java/retrofit2rx/build.sbt | 1 + .../petstore/java/retrofit2rx/docs/FakeApi.md | 8 +- .../java/retrofit2rx/docs/FormatTest.md | 4 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../petstore/java/retrofit2rx/docs/Order.md | 2 +- .../client/petstore/java/retrofit2rx/pom.xml | 7 +- .../java/io/swagger/client/ApiClient.java | 64 ++++ .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 5 +- .../io/swagger/client/model/FormatTest.java | 15 +- ...ropertiesAndAdditionalPropertiesClass.java | 8 +- .../java/io/swagger/client/model/Order.java | 8 +- .../io/swagger/client/api/PetApiTest.java | 313 ++++++++++++------ .../client/api/SkeletonSubscriber.java | 30 ++ .../io/swagger/client/api/StoreApiTest.java | 129 +++++--- .../io/swagger/client/api/UserApiTest.java | 176 +++++----- 40 files changed, 960 insertions(+), 587 deletions(-) create mode 100644 samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java create mode 100644 samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/SkeletonSubscriber.java diff --git a/bin/java-petstore-retrofit2.sh b/bin/java-petstore-retrofit2.sh index 3fda4df3166..14175ce72a2 100755 --- a/bin/java-petstore-retrofit2.sh +++ b/bin/java-petstore-retrofit2.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 -DdateLibrary=joda" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-retrofit2rx.sh b/bin/java-petstore-retrofit2rx.sh index d714cc33455..c62da51daa8 100755 --- a/bin/java-petstore-retrofit2rx.sh +++ b/bin/java-petstore-retrofit2rx.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true,dateLibrary=joda" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index ad5f02c49e4..a4d62eece24 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -9,6 +9,10 @@ import java.util.Map; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import retrofit2.Converter; import retrofit2.Retrofit; @@ -19,6 +23,9 @@ import retrofit2.converter.scalars.ScalarsConverterFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.RequestBody; @@ -108,6 +115,8 @@ public class ApiClient { public void createDefaultAdapter() { Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); okClient = new OkHttpClient(); @@ -346,3 +355,58 @@ class GsonCustomConverterFactory extends Converter.Factory } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index e56e682cfcd..fd2e94b582e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -97,25 +97,20 @@ ext { oltu_version = "1.0.1" retrofit_version = "2.0.2" swagger_annotations_version = "1.5.8" - junit_version = "4.12" -{{#useRxJava}} - rx_java_version = "1.1.3" -{{/useRxJava}} -{{^useRxJava}}{{/useRxJava}} + junit_version = "4.12"{{#useRxJava}} + rx_java_version = "1.1.3"{{/useRxJava}} + jodatime_version = "2.9.3" } dependencies { compile "com.squareup.retrofit2:retrofit:$retrofit_version" compile "com.squareup.retrofit2:converter-scalars:$retrofit_version" - compile "com.squareup.retrofit2:converter-gson:$retrofit_version" -{{#useRxJava}} + compile "com.squareup.retrofit2:converter-gson:$retrofit_version"{{#useRxJava}} compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version" - compile "io.reactivex:rxjava:$rx_java_version" -{{/useRxJava}} -{{^useRxJava}}{{/useRxJava}} - + compile "io.reactivex:rxjava:$rx_java_version"{{/useRxJava}} compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "joda-time:joda-time:$jodatime_version" testCompile "junit:junit:$junit_version" } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache index 8e6986fa2d2..ff564803b44 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache @@ -11,13 +11,12 @@ lazy val root = (project in file(".")). libraryDependencies ++= Seq( "com.squareup.retrofit2" % "retrofit" % "2.0.2" % "compile", "com.squareup.retrofit2" % "converter-scalars" % "2.0.2" % "compile", - "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile", - {{#useRxJava}} + "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile",{{#useRxJava}} "com.squareup.retrofit2" % "adapter-rxjava" % "2.0.2" % "compile", - "io.reactivex" % "rxjava" % "1.1.3" % "compile", - {{/useRxJava}} + "io.reactivex" % "rxjava" % "1.1.3" % "compile",{{/useRxJava}} "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index 30f6a71d285..2cc806ebbd3 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -131,6 +131,11 @@ org.apache.oltu.oauth2 org.apache.oltu.oauth2.client ${oltu-version} + + + joda-time + joda-time + ${jodatime-version} {{#useRxJava}} io.reactivex @@ -153,9 +158,9 @@ 1.5.8 - 2.0.2 - {{#useRxJava}}1.1.3{{/useRxJava}} - 3.2.0 + 2.0.2{{#useRxJava}} + 1.1.3{{/useRxJava}} + 2.9.3 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index 6b96656a4a8..4287ae6e53f 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -98,17 +98,16 @@ ext { retrofit_version = "2.0.2" swagger_annotations_version = "1.5.8" junit_version = "4.12" - + jodatime_version = "2.9.3" } dependencies { compile "com.squareup.retrofit2:retrofit:$retrofit_version" compile "com.squareup.retrofit2:converter-scalars:$retrofit_version" compile "com.squareup.retrofit2:converter-gson:$retrofit_version" - - compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "joda-time:joda-time:$jodatime_version" testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/retrofit2/build.sbt b/samples/client/petstore/java/retrofit2/build.sbt index 8ebea3cad9d..c42d32f7b53 100644 --- a/samples/client/petstore/java/retrofit2/build.sbt +++ b/samples/client/petstore/java/retrofit2/build.sbt @@ -14,6 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-gson" % "2.0.2" % "compile", "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index 55f7cef2df4..e077fa5c821 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None Long int64 = 789L; // Long | None Float _float = 3.4F; // Float | None byte[] binary = B; // byte[] | None -Date date = new Date(); // Date | None -Date dateTime = new Date(); // Date | None +LocalDate date = new LocalDate(); // LocalDate | None +DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None try { Void result = apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -57,8 +57,8 @@ Name | Type | Description | Notes **int64** | **Long**| None | [optional] **_float** | **Float**| None | [optional] **binary** | **byte[]**| None | [optional] - **date** | **Date**| None | [optional] - **dateTime** | **Date**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2/docs/FormatTest.md b/samples/client/petstore/java/retrofit2/docs/FormatTest.md index dc2b559dad2..44de7d9511a 100644 --- a/samples/client/petstore/java/retrofit2/docs/FormatTest.md +++ b/samples/client/petstore/java/retrofit2/docs/FormatTest.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **string** | **String** | | [optional] **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | -**dateTime** | [**Date**](Date.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 00cc10ca9b3..e3487bcc501 100644 --- a/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] -**dateTime** | [**Date**](Date.md) | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2/docs/Order.md b/samples/client/petstore/java/retrofit2/docs/Order.md index 29ca3ddbc6b..a1089f5384e 100644 --- a/samples/client/petstore/java/retrofit2/docs/Order.md +++ b/samples/client/petstore/java/retrofit2/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**Date**](Date.md) | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 05774ac3834..26c32613c1f 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -132,6 +132,11 @@ org.apache.oltu.oauth2.client ${oltu-version} + + joda-time + joda-time + ${jodatime-version} + @@ -144,8 +149,7 @@ 1.5.8 2.0.2 - - 3.2.0 + 2.9.3 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index e49bdf24d7b..305b8b783e4 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -9,6 +9,10 @@ import java.util.Map; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import retrofit2.Converter; import retrofit2.Retrofit; @@ -19,6 +23,9 @@ import retrofit2.converter.scalars.ScalarsConverterFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.RequestBody; @@ -107,6 +114,8 @@ public class ApiClient { public void createDefaultAdapter() { Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); okClient = new OkHttpClient(); @@ -345,3 +354,58 @@ class GsonCustomConverterFactory extends Converter.Factory } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index 16b65ffb7ef..344f523df41 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:04:39.523+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-08T18:45:27.896+02:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index 75fe792872a..91bd85c1b33 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,8 +8,9 @@ import retrofit2.http.*; import okhttp3.RequestBody; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import java.util.ArrayList; import java.util.HashMap; @@ -38,7 +39,7 @@ public interface FakeApi { @FormUrlEncoded @POST("fake") Call testEndpointParameters( - @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password ); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java index 694335531fd..6063cf33f77 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/FormatTest.java @@ -4,7 +4,8 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; import com.google.gson.annotations.SerializedName; @@ -42,10 +43,10 @@ public class FormatTest { private byte[] binary = null; @SerializedName("date") - private Date date = null; + private LocalDate date = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("uuid") private String uuid = null; @@ -156,20 +157,20 @@ public class FormatTest { /** **/ @ApiModelProperty(required = true, value = "") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4afc996440..cf7f73c705f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -4,10 +4,10 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -21,7 +21,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("map") private Map map = new HashMap(); @@ -39,10 +39,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java index 2f774c13834..569d1c0fe46 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Order.java @@ -3,7 +3,7 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -23,7 +23,7 @@ public class Order { private Integer quantity = null; @SerializedName("shipDate") - private Date shipDate = null; + private DateTime shipDate = null; /** @@ -90,10 +90,10 @@ public class Order { /** **/ @ApiModelProperty(value = "") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java new file mode 100644 index 00000000000..bf5a476ab29 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/TestUtils.java @@ -0,0 +1,17 @@ +package io.swagger; + +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +public class TestUtils { + private static final AtomicLong atomicId = createAtomicId(); + + public static long nextId() { + return atomicId.getAndIncrement(); + } + + private static AtomicLong createAtomicId() { + int baseId = new Random(System.currentTimeMillis()).nextInt(1000000) + 20000; + return new AtomicLong((long) baseId); + } +} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/PetApiTest.java index 39b4dc05ee0..8b554674623 100644 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,137 +1,190 @@ package io.swagger.client.api; +import io.swagger.TestUtils; + import io.swagger.client.ApiClient; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.CollectionFormats.*; +import io.swagger.client.api.*; +import io.swagger.client.model.*; + +import java.io.BufferedWriter; import java.io.File; -import org.junit.Before; -import org.junit.Test; - +import java.io.FileWriter; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; -import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; + +import retrofit2.Response; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import static org.junit.Assert.*; + public class PetApiTest { - - private PetApi api; + PetApi api = null; @Before public void setup() { api = new ApiClient().createService(PetApi.class); } - - /** - * Add a new pet to the store - * - * - */ @Test - public void addPetTest() { - Pet body = null; - // Void response = api.addPet(body); + public void testCreateAndGetPet() throws Exception { + Pet pet = createRandomPet(); + Response rp2 = api.addPet(pet).execute(); - // TODO: test validations + Response rp = api.getPetById(pet.getId()).execute(); + Pet fetched = rp.body(); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Deletes a pet - * - * - */ + @Test - public void deletePetTest() { - Long petId = null; - String apiKey = null; - // Void response = api.deletePet(petId, apiKey); + public void testUpdatePet() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); - // TODO: test validations + api.updatePet(pet).execute(); + + Pet fetched = api.getPetById(pet.getId()).execute().body(); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - */ + @Test - public void findPetsByStatusTest() { - List status = null; - // List response = api.findPetsByStatus(status); + public void testFindPetsByStatus() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + api.updatePet(pet).execute(); + + List pets = api.findPetsByStatus(new CSVParams("available")).execute().body(); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - */ + @Test - public void findPetsByTagsTest() { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testFindPetsByTags() throws Exception { + Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet).execute(); + + List pets = api.findPetsByTags(new CSVParams("friendly")).execute().body(); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); } - - /** - * Find pet by ID - * - * Returns a single pet - */ + @Test - public void getPetByIdTest() { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testUpdatePetWithForm() throws Exception { + Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet).execute(); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()).execute().body(); + + api.updatePetWithForm(fetched.getId(), "furt", null).execute(); + Pet updated = api.getPetById(fetched.getId()).execute().body(); + + assertEquals(updated.getName(), "furt"); } - - /** - * Update an existing pet - * - * - */ + @Test - public void updatePetTest() { - Pet body = null; - // Void response = api.updatePet(body); + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet).execute(); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()).execute().body(); + api.deletePet(fetched.getId(), null).execute(); + + assertFalse(api.getPetById(fetched.getId()).execute().isSuccessful()); } - - /** - * Updates a pet in the store with form data - * - * - */ + @Test - public void updatePetWithFormTest() { - Long petId = null; - String name = null; - String status = null; - // Void response = api.updatePetWithForm(petId, name, status); + public void testUploadFile() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet).execute(); - // TODO: test validations + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), null, RequestBody.create(MediaType.parse("text/plain"), file)).execute(); } - - /** - * uploads an image - * - * - */ + @Test - public void uploadFileTest() { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); - // TODO: test validations + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; } - } diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/StoreApiTest.java index 1da787edf19..4a8fd9a50bd 100644 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,77 +1,77 @@ package io.swagger.client.api; -import io.swagger.client.ApiClient; -import io.swagger.client.model.Order; -import org.junit.Before; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import io.swagger.client.ApiClient; +import io.swagger.client.api.*; +import io.swagger.client.model.*; + +import java.lang.reflect.Field; import java.util.Map; -/** - * API tests for StoreApi - */ -public class StoreApiTest { +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.*; - private StoreApi api; +import retrofit2.Response; +import static org.junit.Assert.*; + +public class StoreApiTest { + StoreApi api = null; @Before public void setup() { api = new ApiClient().createService(StoreApi.class); } - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - */ @Test - public void deleteOrderTest() { - String orderId = null; - // Void response = api.deleteOrder(orderId); - - // TODO: test validations + public void testGetInventory() throws Exception { + Map inventory = api.getInventory().execute().body(); + assertTrue(inventory.keySet().size() > 0); } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - */ + @Test - public void getInventoryTest() { - // Map response = api.getInventory(); + public void testPlaceOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order).execute(); - // TODO: test validations + Order fetched = api.getOrderById(order.getId()).execute().body(); + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - */ + @Test - public void getOrderByIdTest() { - Long orderId = null; - // Order response = api.getOrderById(orderId); + public void testDeleteOrder() throws Exception { + Order order = createOrder(); + Response aa = api.placeOrder(order).execute(); - // TODO: test validations - } - - /** - * Place an order for a pet - * - * - */ - @Test - public void placeOrderTest() { - Order body = null; - // Order response = api.placeOrder(body); + Order fetched = api.getOrderById(order.getId()).execute().body(); + assertEquals(fetched.getId(), order.getId()); - // TODO: test validations + api.deleteOrder(String.valueOf(order.getId())).execute(); + + api.getOrderById(order.getId()).execute(); + //also in retrofit 1 should return an error but don't, check server api impl. + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, TestUtils.nextId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/UserApiTest.java index cd8553d8419..70fbb8fef98 100644 --- a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,131 +1,86 @@ package io.swagger.client.api; +import io.swagger.TestUtils; + import io.swagger.client.ApiClient; -import io.swagger.client.model.User; -import org.junit.Before; -import org.junit.Test; +import io.swagger.client.api.*; +import io.swagger.client.model.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -/** - * API tests for UserApi - */ +import java.util.Arrays; + +import org.junit.*; +import static org.junit.Assert.*; + public class UserApiTest { - - private UserApi api; + UserApi api = null; @Before public void setup() { api = new ApiClient().createService(UserApi.class); } - - /** - * Create user - * - * This can only be done by the logged in user. - */ @Test - public void createUserTest() { - User body = null; - // Void response = api.createUser(body); + public void testCreateUser() throws Exception { + User user = createUser(); - // TODO: test validations + api.createUser(user).execute(); + + User fetched = api.getUserByName(user.getUsername()).execute().body(); + assertEquals(user.getId(), fetched.getId()); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithArrayInputTest() { - List body = null; - // Void response = api.createUsersWithArrayInput(body); + public void testCreateUsersWithArray() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).execute(); + + User fetched = api.getUserByName(user1.getUsername()).execute().body(); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithListInputTest() { - List body = null; - // Void response = api.createUsersWithListInput(body); + public void testCreateUsersWithList() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).execute(); + + User fetched = api.getUserByName(user1.getUsername()).execute().body(); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Delete user - * - * This can only be done by the logged in user. - */ + @Test - public void deleteUserTest() { - String username = null; - // Void response = api.deleteUser(username); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user).execute(); - // TODO: test validations + String token = api.loginUser(user.getUsername(), user.getPassword()).execute().body(); + assertTrue(token.startsWith("logged in user session:")); } - - /** - * Get user by user name - * - * - */ + @Test - public void getUserByNameTest() { - String username = null; - // User response = api.getUserByName(username); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser().execute(); } - - /** - * Logs user into the system - * - * - */ - @Test - public void loginUserTest() { - String username = null; - String password = null; - // String response = api.loginUser(username, password); - // TODO: test validations - } - - /** - * Logs out current logged in user session - * - * - */ - @Test - public void logoutUserTest() { - // Void response = api.logoutUser(); + private User createUser() { + User user = new User(); + user.setId(TestUtils.nextId()); + user.setUsername("fred"); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); - // TODO: test validations + return user; } - - /** - * Updated user - * - * This can only be done by the logged in user. - */ - @Test - public void updateUserTest() { - String username = null; - User body = null; - // Void response = api.updateUser(username, body); - - // TODO: test validations - } - } diff --git a/samples/client/petstore/java/retrofit2rx/build.gradle b/samples/client/petstore/java/retrofit2rx/build.gradle index cbd0119e24b..8d9fa82e69a 100644 --- a/samples/client/petstore/java/retrofit2rx/build.gradle +++ b/samples/client/petstore/java/retrofit2rx/build.gradle @@ -99,7 +99,7 @@ ext { swagger_annotations_version = "1.5.8" junit_version = "4.12" rx_java_version = "1.1.3" - + jodatime_version = "2.9.3" } dependencies { @@ -108,10 +108,9 @@ dependencies { compile "com.squareup.retrofit2:converter-gson:$retrofit_version" compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version" compile "io.reactivex:rxjava:$rx_java_version" - - compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "joda-time:joda-time:$jodatime_version" testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/retrofit2rx/build.sbt b/samples/client/petstore/java/retrofit2rx/build.sbt index cfe2d8d341c..3e999d082e0 100644 --- a/samples/client/petstore/java/retrofit2rx/build.sbt +++ b/samples/client/petstore/java/retrofit2rx/build.sbt @@ -16,6 +16,7 @@ lazy val root = (project in file(".")). "io.reactivex" % "rxjava" % "1.1.3" % "compile", "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index 55f7cef2df4..e077fa5c821 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None Long int64 = 789L; // Long | None Float _float = 3.4F; // Float | None byte[] binary = B; // byte[] | None -Date date = new Date(); // Date | None -Date dateTime = new Date(); // Date | None +LocalDate date = new LocalDate(); // LocalDate | None +DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None try { Void result = apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -57,8 +57,8 @@ Name | Type | Description | Notes **int64** | **Long**| None | [optional] **_float** | **Float**| None | [optional] **binary** | **byte[]**| None | [optional] - **date** | **Date**| None | [optional] - **dateTime** | **Date**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2rx/docs/FormatTest.md b/samples/client/petstore/java/retrofit2rx/docs/FormatTest.md index dc2b559dad2..44de7d9511a 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FormatTest.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FormatTest.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **string** | **String** | | [optional] **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | -**dateTime** | [**Date**](Date.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 00cc10ca9b3..e3487bcc501 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/retrofit2rx/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] -**dateTime** | [**Date**](Date.md) | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/docs/Order.md b/samples/client/petstore/java/retrofit2rx/docs/Order.md index 29ca3ddbc6b..a1089f5384e 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/Order.md +++ b/samples/client/petstore/java/retrofit2rx/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**Date**](Date.md) | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/pom.xml b/samples/client/petstore/java/retrofit2rx/pom.xml index 79d826c3a41..322fd209415 100644 --- a/samples/client/petstore/java/retrofit2rx/pom.xml +++ b/samples/client/petstore/java/retrofit2rx/pom.xml @@ -132,6 +132,11 @@ org.apache.oltu.oauth2.client ${oltu-version} + + joda-time + joda-time + ${jodatime-version} + io.reactivex rxjava @@ -155,7 +160,7 @@ 1.5.8 2.0.2 1.1.3 - 3.2.0 + 2.9.3 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java index 32799fdf3d8..9e424881cbd 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java @@ -9,6 +9,10 @@ import java.util.Map; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import retrofit2.Converter; import retrofit2.Retrofit; @@ -19,6 +23,9 @@ import retrofit2.converter.scalars.ScalarsConverterFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.RequestBody; @@ -107,6 +114,8 @@ public class ApiClient { public void createDefaultAdapter() { Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); okClient = new OkHttpClient(); @@ -345,3 +354,58 @@ class GsonCustomConverterFactory extends Converter.Factory } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java index 4d786f28438..391c1c016c6 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:05:33.279+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-08T18:44:17.529+02:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index cc0d5605548..5e0511922fb 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,8 +8,9 @@ import retrofit2.http.*; import okhttp3.RequestBody; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import java.util.ArrayList; import java.util.HashMap; @@ -38,7 +39,7 @@ public interface FakeApi { @FormUrlEncoded @POST("fake") Observable testEndpointParameters( - @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password ); } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java index 694335531fd..6063cf33f77 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/FormatTest.java @@ -4,7 +4,8 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; import com.google.gson.annotations.SerializedName; @@ -42,10 +43,10 @@ public class FormatTest { private byte[] binary = null; @SerializedName("date") - private Date date = null; + private LocalDate date = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("uuid") private String uuid = null; @@ -156,20 +157,20 @@ public class FormatTest { /** **/ @ApiModelProperty(required = true, value = "") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4afc996440..cf7f73c705f 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -4,10 +4,10 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -21,7 +21,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("map") private Map map = new HashMap(); @@ -39,10 +39,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java index 2f774c13834..569d1c0fe46 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Order.java @@ -3,7 +3,7 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -23,7 +23,7 @@ public class Order { private Integer quantity = null; @SerializedName("shipDate") - private Date shipDate = null; + private DateTime shipDate = null; /** @@ -90,10 +90,10 @@ public class Order { /** **/ @ApiModelProperty(value = "") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/PetApiTest.java index 39b4dc05ee0..8fa02bed636 100644 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,137 +1,254 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.CollectionFormats.*; +import io.swagger.client.model.*; + +import java.io.BufferedWriter; import java.io.File; -import org.junit.Before; -import org.junit.Test; - +import java.io.FileWriter; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; -import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import static org.junit.Assert.*; + public class PetApiTest { - - private PetApi api; + PetApi api = null; @Before public void setup() { api = new ApiClient().createService(PetApi.class); } - - /** - * Add a new pet to the store - * - * - */ @Test - public void addPetTest() { - Pet body = null; - // Void response = api.addPet(body); + public void testCreateAndGetPet() throws Exception { + final Pet pet = createRandomPet(); + api.addPet(pet).subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Pet fetched) { + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + }); + + } + }); - // TODO: test validations } - - /** - * Deletes a pet - * - * - */ + @Test - public void deletePetTest() { - Long petId = null; - String apiKey = null; - // Void response = api.deletePet(petId, apiKey); + public void testUpdatePet() throws Exception { + final Pet pet = createRandomPet(); + pet.setName("programmer"); + + api.updatePet(pet).subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Pet fetched) { + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + }); + + } + }); - // TODO: test validations } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - */ + @Test - public void findPetsByStatusTest() { - List status = null; - // List response = api.findPetsByStatus(status); + public void testFindPetsByStatus() throws Exception { + final Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + api.updatePet(pet).subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.findPetsByStatus(new CSVParams("available")).subscribe(new SkeletonSubscriber>() { + @Override + public void onNext(List pets) { + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); + } + }); + + } + }); - // TODO: test validations } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - */ + @Test - public void findPetsByTagsTest() { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testFindPetsByTags() throws Exception { + final Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet).subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.findPetsByTags(new CSVParams("friendly")).subscribe(new SkeletonSubscriber>() { + @Override + public void onNext(List pets) { + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + } + }); + + } + }); - // TODO: test validations } - - /** - * Find pet by ID - * - * Returns a single pet - */ + @Test - public void getPetByIdTest() { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testUpdatePetWithForm() throws Exception { + final Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); + api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(final Pet fetched) { + api.updatePetWithForm(fetched.getId(), "furt", null) + .subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Pet updated) { + assertEquals(updated.getName(), "furt"); + } + }); + + } + }); + } + }); + - // TODO: test validations } - - /** - * Update an existing pet - * - * - */ + @Test - public void updatePetTest() { - Pet body = null; - // Void response = api.updatePet(body); + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); - // TODO: test validations + api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Pet fetched) { + + api.deletePet(fetched.getId(), null).subscribe(SkeletonSubscriber.failTestOnError()); + api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Pet deletedPet) { + fail("Should not have found deleted pet."); + } + + @Override + public void onError(Throwable e) { + // expected, because the pet has been deleted. + } + }); + } + }); } - - /** - * Updates a pet in the store with form data - * - * - */ + @Test - public void updatePetWithFormTest() { - Long petId = null; - String name = null; - String status = null; - // Void response = api.updatePetWithForm(petId, name, status); + public void testUploadFile() throws Exception { + File file = File.createTempFile("test", "hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - // TODO: test validations + writer.write("Hello world!"); + writer.close(); + + Pet pet = createRandomPet(); + api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError()); + + RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file); + api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber() { + @Override + public void onError(Throwable e) { + // this also yields a 400 for other tests, so I guess it's okay... + } + }); } - - /** - * uploads an image - * - * - */ + @Test - public void uploadFileTest() { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); - // TODO: test validations + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(System.currentTimeMillis()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; } - } diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/SkeletonSubscriber.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/SkeletonSubscriber.java new file mode 100644 index 00000000000..47d0df05e28 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/SkeletonSubscriber.java @@ -0,0 +1,30 @@ +package io.swagger.client.api; + +import junit.framework.TestFailure; +import rx.Subscriber; + +/** + * Skeleton subscriber for tests that will fail when onError() is called unexpectedly. + */ +public abstract class SkeletonSubscriber extends Subscriber { + + public static SkeletonSubscriber failTestOnError() { + return new SkeletonSubscriber() { + }; + } + + @Override + public void onCompleted() { + // space for rent + } + + @Override + public void onNext(T t) { + // space for rent + } + + @Override + public void onError(Throwable e) { + throw new RuntimeException("Subscriber onError() called with unhandled exception!", e); + } +} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/StoreApiTest.java index 1da787edf19..62f1b194766 100644 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,77 +1,98 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; -import io.swagger.client.model.Order; -import org.junit.Before; -import org.junit.Test; +import io.swagger.client.model.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.lang.reflect.Field; import java.util.Map; -/** - * API tests for StoreApi - */ -public class StoreApiTest { +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.*; - private StoreApi api; +import retrofit2.Response; + +import static org.junit.Assert.*; + +public class StoreApiTest { + StoreApi api = null; @Before public void setup() { api = new ApiClient().createService(StoreApi.class); } - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - */ @Test - public void deleteOrderTest() { - String orderId = null; - // Void response = api.deleteOrder(orderId); + public void testGetInventory() throws Exception { + api.getInventory().subscribe(new SkeletonSubscriber>() { + @Override + public void onNext(Map inventory) { + assertTrue(inventory.keySet().size() > 0); + } + }); - // TODO: test validations } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - */ + @Test - public void getInventoryTest() { - // Map response = api.getInventory(); - - // TODO: test validations + public void testPlaceOrder() throws Exception { + final Order order = createOrder(); + api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); + api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Order fetched) { + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); + } + }); } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - */ + @Test - public void getOrderByIdTest() { - Long orderId = null; - // Order response = api.getOrderById(orderId); + public void testDeleteOrder() throws Exception { + final Order order = createOrder(); + api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError()); - // TODO: test validations - } - - /** - * Place an order for a pet - * - * - */ - @Test - public void placeOrderTest() { - Order body = null; - // Order response = api.placeOrder(body); + api.getOrderById(order.getId()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Order fetched) { + assertEquals(fetched.getId(), order.getId()); + } + }); - // TODO: test validations + + api.deleteOrder(String.valueOf(order.getId())).subscribe(SkeletonSubscriber.failTestOnError()); + api.getOrderById(order.getId()) + .subscribe(new SkeletonSubscriber() { + @Override + public void onNext(Order order) { + throw new RuntimeException("Should not have found deleted order."); + } + + @Override + public void onError(Throwable e) { + // should not find deleted order. + } + } + ); + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, System.currentTimeMillis()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/UserApiTest.java index cd8553d8419..02c3942b210 100644 --- a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,131 +1,107 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; -import io.swagger.client.model.User; -import org.junit.Before; -import org.junit.Test; +import io.swagger.client.model.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; + +import java.util.Arrays; + +import org.junit.*; + +import static org.junit.Assert.*; /** - * API tests for UserApi + * NOTE: This serves as a sample and test case for the generator, which is why this is java-7 code. + * Much looks much nicer with no anonymous classes. */ public class UserApiTest { - - private UserApi api; + UserApi api = null; @Before public void setup() { api = new ApiClient().createService(UserApi.class); } - - /** - * Create user - * - * This can only be done by the logged in user. - */ @Test - public void createUserTest() { - User body = null; - // Void response = api.createUser(body); + public void testCreateUser() throws Exception { + final User user = createUser(); - // TODO: test validations + api.createUser(user).subscribe(new SkeletonSubscriber() { + @Override + public void onCompleted() { + api.getUserByName(user.getUsername()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(User fetched) { + assertEquals(user.getId(), fetched.getId()); + } + }); + } + }); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithArrayInputTest() { - List body = null; - // Void response = api.createUsersWithArrayInput(body); + public void testCreateUsersWithArray() throws Exception { + final User user1 = createUser(); + user1.setUsername("abc123"); + User user2 = createUser(); + user2.setUsername("123abc"); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError()); + + api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(User fetched) { + assertEquals(user1.getId(), fetched.getId()); + } + }); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithListInputTest() { - List body = null; - // Void response = api.createUsersWithListInput(body); + public void testCreateUsersWithList() throws Exception { + final User user1 = createUser(); + user1.setUsername("abc123"); + User user2 = createUser(); + user2.setUsername("123abc"); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError()); + + api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(User fetched) { + assertEquals(user1.getId(), fetched.getId()); + } + }); } - - /** - * Delete user - * - * This can only be done by the logged in user. - */ + @Test - public void deleteUserTest() { - String username = null; - // Void response = api.deleteUser(username); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user); - // TODO: test validations + api.loginUser(user.getUsername(), user.getPassword()).subscribe(new SkeletonSubscriber() { + @Override + public void onNext(String token) { + assertTrue(token.startsWith("logged in user session:")); + } + }); } - - /** - * Get user by user name - * - * - */ + @Test - public void getUserByNameTest() { - String username = null; - // User response = api.getUserByName(username); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser(); } - - /** - * Logs user into the system - * - * - */ - @Test - public void loginUserTest() { - String username = null; - String password = null; - // String response = api.loginUser(username, password); - // TODO: test validations - } - - /** - * Logs out current logged in user session - * - * - */ - @Test - public void logoutUserTest() { - // Void response = api.logoutUser(); + private User createUser() { + User user = new User(); + user.setId(System.currentTimeMillis()); + user.setUsername("fred"); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); - // TODO: test validations + return user; } - - /** - * Updated user - * - * This can only be done by the logged in user. - */ - @Test - public void updateUserTest() { - String username = null; - User body = null; - // Void response = api.updateUser(username, body); - - // TODO: test validations - } - -} +} \ No newline at end of file From ec3a200c8c3e7c300ca995dbf531c3dd2c594fbe Mon Sep 17 00:00:00 2001 From: cbornet Date: Wed, 8 Jun 2016 19:53:00 +0200 Subject: [PATCH 35/67] remove generated annotation in feign sample --- bin/java-petstore-feign.sh | 2 +- .../java/feign/src/main/java/io/swagger/client/ApiClient.java | 2 +- .../feign/src/main/java/io/swagger/client/FormAwareEncoder.java | 2 +- .../java/feign/src/main/java/io/swagger/client/StringUtil.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/FakeApi.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/PetApi.java | 2 +- .../feign/src/main/java/io/swagger/client/api/StoreApi.java | 2 +- .../java/feign/src/main/java/io/swagger/client/api/UserApi.java | 2 +- .../java/io/swagger/client/model/AdditionalPropertiesClass.java | 2 +- .../feign/src/main/java/io/swagger/client/model/Animal.java | 2 +- .../feign/src/main/java/io/swagger/client/model/AnimalFarm.java | 2 +- .../feign/src/main/java/io/swagger/client/model/ArrayTest.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Cat.java | 2 +- .../feign/src/main/java/io/swagger/client/model/Category.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Dog.java | 2 +- .../feign/src/main/java/io/swagger/client/model/EnumTest.java | 2 +- .../feign/src/main/java/io/swagger/client/model/FormatTest.java | 2 +- .../model/MixedPropertiesAndAdditionalPropertiesClass.java | 2 +- .../src/main/java/io/swagger/client/model/Model200Response.java | 2 +- .../src/main/java/io/swagger/client/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/client/model/ModelReturn.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Name.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Order.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Pet.java | 2 +- .../src/main/java/io/swagger/client/model/ReadOnlyFirst.java | 2 +- .../src/main/java/io/swagger/client/model/SpecialModelName.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/Tag.java | 2 +- .../java/feign/src/main/java/io/swagger/client/model/User.java | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index e28439842d9..40dbc592f7e 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DdateLibrary=joda" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DdateLibrary=joda,hideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java index 790e401a3d7..75b3a96f2c7 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java @@ -19,7 +19,7 @@ import feign.slf4j.Slf4jLogger; import io.swagger.client.auth.*; import io.swagger.client.auth.OAuth.AccessTokenListener; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class ApiClient { public interface Api {} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java index 082c11e0032..179a2834da9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/FormAwareEncoder.java @@ -14,7 +14,7 @@ import feign.codec.EncodeException; import feign.codec.Encoder; import feign.RequestTemplate; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class FormAwareEncoder implements Encoder { public static final String UTF_8 = "utf-8"; private static final String LINE_FEED = "\r\n"; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index bc13cd205d5..1383dd0decb 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index c40f87ebdae..dbabdc64995 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public interface FakeApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index 2f8c942bd74..e486495c5a9 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public interface PetApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java index 98085dca230..ee80acba0b4 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/StoreApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public interface StoreApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java index f114d5f23c9..6a2c8a6afb1 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/UserApi.java @@ -10,7 +10,7 @@ import java.util.List; import java.util.Map; import feign.*; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public interface UserApi extends ApiClient.Api { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index c15373b66c8..ccaba7709c4 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class AdditionalPropertiesClass { private Map mapProperty = new HashMap(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java index c1c1a411607..25c7d3e421c 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Animal.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java index 28a7b9c3be4..647e3a893e1 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -10,7 +10,7 @@ import java.util.List; /** * AnimalFarm */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class AnimalFarm extends ArrayList { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java index 455f93dc4f6..6c1eb23d8d0 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ArrayTest.java @@ -12,7 +12,7 @@ import java.util.List; /** * ArrayTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class ArrayTest { private List arrayOfString = new ArrayList(); diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java index f300be5fcad..5ef9e23bd96 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java index c299f04c7dd..c6cb703a89e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Category { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java index 372d5bcb4f6..4b3cc947cc5 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java index f038af89dda..1c8657fd3ec 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class EnumTest { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java index 06545402ab9..79376150017 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/FormatTest.java @@ -13,7 +13,7 @@ import org.joda.time.LocalDate; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class FormatTest { private Integer integer = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 10af0257255..2f0972bf41e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -15,7 +15,7 @@ import org.joda.time.DateTime; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index fc398928514..b2809525c7f 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java index 408b2536a1b..32fb86dd323 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ModelApiResponse */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java index e7b24a568e6..a076d16f964 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelReturn.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java index fae7beeef93..1ba2cc5e4a3 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Name.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java index 893d121daa2..cec651e73a6 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Order.java @@ -12,7 +12,7 @@ import org.joda.time.DateTime; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Order { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java index d426d6c216e..da8b76ad024 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index ddfa45b5dbd..fdc3587df0e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class ReadOnlyFirst { private String bar = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java index b7dd8dc42ca..24e57756cb2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java index 2bcfcc68c92..9d3bdd8cb9e 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java index a6be090fd12..f23553660de 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-07T22:38:14.473+02:00") + public class User { private Long id = null; From 6df4ffab13e70cf94efd2b009bee736d2fc24cd2 Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 8 Jun 2016 22:37:41 +0200 Subject: [PATCH 36/67] use explicit Response class from okhttp fixing #3071 --- .../main/resources/Java/libraries/okhttp-gson/api.mustache | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 13c813e58af..cf5841b5ec8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -13,7 +13,6 @@ import com.google.gson.reflect.TypeToken; import com.squareup.okhttp.Call; import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Response; import java.io.IOException; @@ -90,8 +89,8 @@ public class {{classname}} { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); From 6cab3a2a373964d9dda9e3f4485e11c3c4e93a4b Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 8 Jun 2016 22:53:58 +0200 Subject: [PATCH 37/67] added GraphHopper to projects/companies --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3a8e9d4c629..ece108666e1 100644 --- a/README.md +++ b/README.md @@ -860,6 +860,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [everystory.us](http://everystory.us) - [Expected Behavior](http://www.expectedbehavior.com/) - [FH Münster - University of Applied Sciences](http://www.fh-muenster.de) +- [GraphHopper](https://graphhopper.com/) - [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications) - [Interactive Intelligence](http://developer.mypurecloud.com/) - [LANDR Audio](https://www.landr.com/) From 03f5619beb72846f42ab7c4bda8d99467e234f66 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Fri, 3 Jun 2016 07:08:28 +0900 Subject: [PATCH 38/67] Update python constructor to provide arguments for instance initialization ( #3029 ) --- .../src/main/resources/python/model.mustache | 4 +-- .../models/additional_properties_class.py | 6 ++-- .../python/petstore_api/models/animal.py | 6 ++-- .../petstore_api/models/api_response.py | 8 +++--- .../python/petstore_api/models/array_test.py | 8 +++--- .../python/petstore_api/models/cat.py | 8 +++--- .../python/petstore_api/models/category.py | 6 ++-- .../python/petstore_api/models/dog.py | 8 +++--- .../python/petstore_api/models/enum_test.py | 8 +++--- .../python/petstore_api/models/format_test.py | 28 +++++++++---------- ...perties_and_additional_properties_class.py | 8 +++--- .../petstore_api/models/model_200_response.py | 4 +-- .../petstore_api/models/model_return.py | 4 +-- .../python/petstore_api/models/name.py | 10 +++---- .../python/petstore_api/models/order.py | 14 +++++----- .../python/petstore_api/models/pet.py | 14 +++++----- .../petstore_api/models/read_only_first.py | 6 ++-- .../petstore_api/models/special_model_name.py | 4 +-- .../python/petstore_api/models/tag.py | 6 ++-- .../python/petstore_api/models/user.py | 18 ++++++------ 20 files changed, 89 insertions(+), 89 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index a592278bf12..1239ef8557d 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -14,7 +14,7 @@ class {{classname}}(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): """ {{classname}} - a model defined in Swagger @@ -34,7 +34,7 @@ class {{classname}}(object): } {{#vars}} - self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}} + self._{{name}} = {{name}} {{/vars}} {{#vars}}{{#-first}} {{/-first}} diff --git a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py index 510287a1633..b5383efed38 100644 --- a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py @@ -32,7 +32,7 @@ class AdditionalPropertiesClass(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, map_property=None, map_of_map_property=None): """ AdditionalPropertiesClass - a model defined in Swagger @@ -51,8 +51,8 @@ class AdditionalPropertiesClass(object): 'map_of_map_property': 'map_of_map_property' } - self._map_property = None - self._map_of_map_property = None + self._map_property = map_property + self._map_of_map_property = map_of_map_property @property def map_property(self): diff --git a/samples/client/petstore/python/petstore_api/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py index 6ed4786c88b..8a5b6499872 100644 --- a/samples/client/petstore/python/petstore_api/models/animal.py +++ b/samples/client/petstore/python/petstore_api/models/animal.py @@ -32,7 +32,7 @@ class Animal(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, class_name=None, color='red'): """ Animal - a model defined in Swagger @@ -51,8 +51,8 @@ class Animal(object): 'color': 'color' } - self._class_name = None - self._color = 'red' + self._class_name = class_name + self._color = color @property def class_name(self): diff --git a/samples/client/petstore/python/petstore_api/models/api_response.py b/samples/client/petstore/python/petstore_api/models/api_response.py index 8719ec107be..7cb5eb5c889 100644 --- a/samples/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/client/petstore/python/petstore_api/models/api_response.py @@ -32,7 +32,7 @@ class ApiResponse(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, code=None, type=None, message=None): """ ApiResponse - a model defined in Swagger @@ -53,9 +53,9 @@ class ApiResponse(object): 'message': 'message' } - self._code = None - self._type = None - self._message = None + self._code = code + self._type = type + self._message = message @property def code(self): diff --git a/samples/client/petstore/python/petstore_api/models/array_test.py b/samples/client/petstore/python/petstore_api/models/array_test.py index c0006207649..adaeecc2ed7 100644 --- a/samples/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/client/petstore/python/petstore_api/models/array_test.py @@ -32,7 +32,7 @@ class ArrayTest(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): """ ArrayTest - a model defined in Swagger @@ -53,9 +53,9 @@ class ArrayTest(object): 'array_array_of_model': 'array_array_of_model' } - self._array_of_string = None - self._array_array_of_integer = None - self._array_array_of_model = None + self._array_of_string = array_of_string + self._array_array_of_integer = array_array_of_integer + self._array_array_of_model = array_array_of_model @property def array_of_string(self): diff --git a/samples/client/petstore/python/petstore_api/models/cat.py b/samples/client/petstore/python/petstore_api/models/cat.py index 3b44fde4ee0..a37e0b0674b 100644 --- a/samples/client/petstore/python/petstore_api/models/cat.py +++ b/samples/client/petstore/python/petstore_api/models/cat.py @@ -32,7 +32,7 @@ class Cat(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, class_name=None, color='red', declawed=None): """ Cat - a model defined in Swagger @@ -53,9 +53,9 @@ class Cat(object): 'declawed': 'declawed' } - self._class_name = None - self._color = 'red' - self._declawed = None + self._class_name = class_name + self._color = color + self._declawed = declawed @property def class_name(self): diff --git a/samples/client/petstore/python/petstore_api/models/category.py b/samples/client/petstore/python/petstore_api/models/category.py index 4a88b5776f2..9adf7e1bab2 100644 --- a/samples/client/petstore/python/petstore_api/models/category.py +++ b/samples/client/petstore/python/petstore_api/models/category.py @@ -32,7 +32,7 @@ class Category(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, id=None, name=None): """ Category - a model defined in Swagger @@ -51,8 +51,8 @@ class Category(object): 'name': 'name' } - self._id = None - self._name = None + self._id = id + self._name = name @property def id(self): diff --git a/samples/client/petstore/python/petstore_api/models/dog.py b/samples/client/petstore/python/petstore_api/models/dog.py index bf31dd37312..70225244a13 100644 --- a/samples/client/petstore/python/petstore_api/models/dog.py +++ b/samples/client/petstore/python/petstore_api/models/dog.py @@ -32,7 +32,7 @@ class Dog(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, class_name=None, color='red', breed=None): """ Dog - a model defined in Swagger @@ -53,9 +53,9 @@ class Dog(object): 'breed': 'breed' } - self._class_name = None - self._color = 'red' - self._breed = None + self._class_name = class_name + self._color = color + self._breed = breed @property def class_name(self): diff --git a/samples/client/petstore/python/petstore_api/models/enum_test.py b/samples/client/petstore/python/petstore_api/models/enum_test.py index 9bcaafc0501..faf89659ef2 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python/petstore_api/models/enum_test.py @@ -32,7 +32,7 @@ class EnumTest(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, enum_string=None, enum_integer=None, enum_number=None): """ EnumTest - a model defined in Swagger @@ -53,9 +53,9 @@ class EnumTest(object): 'enum_number': 'enum_number' } - self._enum_string = None - self._enum_integer = None - self._enum_number = None + self._enum_string = enum_string + self._enum_integer = enum_integer + self._enum_number = enum_number @property def enum_string(self): diff --git a/samples/client/petstore/python/petstore_api/models/format_test.py b/samples/client/petstore/python/petstore_api/models/format_test.py index d29155be143..54522805164 100644 --- a/samples/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/client/petstore/python/petstore_api/models/format_test.py @@ -32,7 +32,7 @@ class FormatTest(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): """ FormatTest - a model defined in Swagger @@ -73,19 +73,19 @@ class FormatTest(object): 'password': 'password' } - self._integer = None - self._int32 = None - self._int64 = None - self._number = None - self._float = None - self._double = None - self._string = None - self._byte = None - self._binary = None - self._date = None - self._date_time = None - self._uuid = None - self._password = None + self._integer = integer + self._int32 = int32 + self._int64 = int64 + self._number = number + self._float = float + self._double = double + self._string = string + self._byte = byte + self._binary = binary + self._date = date + self._date_time = date_time + self._uuid = uuid + self._password = password @property def integer(self): diff --git a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index 99c7c9d943c..9c4bdd2a851 100644 --- a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -32,7 +32,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, uuid=None, date_time=None, map=None): """ MixedPropertiesAndAdditionalPropertiesClass - a model defined in Swagger @@ -53,9 +53,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): 'map': 'map' } - self._uuid = None - self._date_time = None - self._map = None + self._uuid = uuid + self._date_time = date_time + self._map = map @property def uuid(self): diff --git a/samples/client/petstore/python/petstore_api/models/model_200_response.py b/samples/client/petstore/python/petstore_api/models/model_200_response.py index cd86b10e963..95326567ada 100644 --- a/samples/client/petstore/python/petstore_api/models/model_200_response.py +++ b/samples/client/petstore/python/petstore_api/models/model_200_response.py @@ -32,7 +32,7 @@ class Model200Response(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, name=None): """ Model200Response - a model defined in Swagger @@ -49,7 +49,7 @@ class Model200Response(object): 'name': 'name' } - self._name = None + self._name = name @property def name(self): diff --git a/samples/client/petstore/python/petstore_api/models/model_return.py b/samples/client/petstore/python/petstore_api/models/model_return.py index 711418c3d91..5587c068b0f 100644 --- a/samples/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/client/petstore/python/petstore_api/models/model_return.py @@ -32,7 +32,7 @@ class ModelReturn(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, _return=None): """ ModelReturn - a model defined in Swagger @@ -49,7 +49,7 @@ class ModelReturn(object): '_return': 'return' } - self.__return = None + self.__return = _return @property def _return(self): diff --git a/samples/client/petstore/python/petstore_api/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py index 45d7b4bd8d0..2cff0bfc231 100644 --- a/samples/client/petstore/python/petstore_api/models/name.py +++ b/samples/client/petstore/python/petstore_api/models/name.py @@ -32,7 +32,7 @@ class Name(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): """ Name - a model defined in Swagger @@ -55,10 +55,10 @@ class Name(object): '_123_number': '123Number' } - self._name = None - self._snake_case = None - self.__property = None - self.__123_number = None + self._name = name + self._snake_case = snake_case + self.__property = _property + self.__123_number = _123_number @property def name(self): diff --git a/samples/client/petstore/python/petstore_api/models/order.py b/samples/client/petstore/python/petstore_api/models/order.py index a15e20f924e..98d36719006 100644 --- a/samples/client/petstore/python/petstore_api/models/order.py +++ b/samples/client/petstore/python/petstore_api/models/order.py @@ -32,7 +32,7 @@ class Order(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): """ Order - a model defined in Swagger @@ -59,12 +59,12 @@ class Order(object): 'complete': 'complete' } - self._id = None - self._pet_id = None - self._quantity = None - self._ship_date = None - self._status = None - self._complete = False + self._id = id + self._pet_id = pet_id + self._quantity = quantity + self._ship_date = ship_date + self._status = status + self._complete = complete @property def id(self): diff --git a/samples/client/petstore/python/petstore_api/models/pet.py b/samples/client/petstore/python/petstore_api/models/pet.py index deccb9630b7..7a93da19db9 100644 --- a/samples/client/petstore/python/petstore_api/models/pet.py +++ b/samples/client/petstore/python/petstore_api/models/pet.py @@ -32,7 +32,7 @@ class Pet(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): """ Pet - a model defined in Swagger @@ -59,12 +59,12 @@ class Pet(object): 'status': 'status' } - self._id = None - self._category = None - self._name = None - self._photo_urls = None - self._tags = None - self._status = None + self._id = id + self._category = category + self._name = name + self._photo_urls = photo_urls + self._tags = tags + self._status = status @property def id(self): diff --git a/samples/client/petstore/python/petstore_api/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py index 4f479ae1d7f..b1ca04f4a09 100644 --- a/samples/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python/petstore_api/models/read_only_first.py @@ -32,7 +32,7 @@ class ReadOnlyFirst(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, bar=None, baz=None): """ ReadOnlyFirst - a model defined in Swagger @@ -51,8 +51,8 @@ class ReadOnlyFirst(object): 'baz': 'baz' } - self._bar = None - self._baz = None + self._bar = bar + self._baz = baz @property def bar(self): diff --git a/samples/client/petstore/python/petstore_api/models/special_model_name.py b/samples/client/petstore/python/petstore_api/models/special_model_name.py index af3fb00dda7..e48b7d79faf 100644 --- a/samples/client/petstore/python/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python/petstore_api/models/special_model_name.py @@ -32,7 +32,7 @@ class SpecialModelName(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, special_property_name=None): """ SpecialModelName - a model defined in Swagger @@ -49,7 +49,7 @@ class SpecialModelName(object): 'special_property_name': '$special[property.name]' } - self._special_property_name = None + self._special_property_name = special_property_name @property def special_property_name(self): diff --git a/samples/client/petstore/python/petstore_api/models/tag.py b/samples/client/petstore/python/petstore_api/models/tag.py index a91b8127d51..95013b4fa8a 100644 --- a/samples/client/petstore/python/petstore_api/models/tag.py +++ b/samples/client/petstore/python/petstore_api/models/tag.py @@ -32,7 +32,7 @@ class Tag(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, id=None, name=None): """ Tag - a model defined in Swagger @@ -51,8 +51,8 @@ class Tag(object): 'name': 'name' } - self._id = None - self._name = None + self._id = id + self._name = name @property def id(self): diff --git a/samples/client/petstore/python/petstore_api/models/user.py b/samples/client/petstore/python/petstore_api/models/user.py index f98a895b716..1caf604d825 100644 --- a/samples/client/petstore/python/petstore_api/models/user.py +++ b/samples/client/petstore/python/petstore_api/models/user.py @@ -32,7 +32,7 @@ class User(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self): + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): """ User - a model defined in Swagger @@ -63,14 +63,14 @@ class User(object): 'user_status': 'userStatus' } - self._id = None - self._username = None - self._first_name = None - self._last_name = None - self._email = None - self._password = None - self._phone = None - self._user_status = None + self._id = id + self._username = username + self._first_name = first_name + self._last_name = last_name + self._email = email + self._password = password + self._phone = phone + self._user_status = user_status @property def id(self): From 2c939b03b40e18ce0c100ccff33a20e3a46a6658 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Wed, 8 Jun 2016 23:48:34 +0900 Subject: [PATCH 39/67] Apply readWriteVars to constructor in python/model.mustach --- .../src/main/resources/python/gitignore.mustache | 2 ++ .../src/main/resources/python/model.mustache | 9 ++++++--- samples/client/petstore/python/README.md | 12 ++++++------ .../petstore/python/petstore_api/models/name.py | 6 +++--- .../python/petstore_api/models/read_only_first.py | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/gitignore.mustache b/modules/swagger-codegen/src/main/resources/python/gitignore.mustache index 1dbc687de01..a655050c263 100644 --- a/modules/swagger-codegen/src/main/resources/python/gitignore.mustache +++ b/modules/swagger-codegen/src/main/resources/python/gitignore.mustache @@ -44,6 +44,8 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +venv/ +.python-version # Translations *.mo diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 1239ef8557d..4a8cf2a4cc2 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -14,7 +14,7 @@ class {{classname}}(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): + def __init__(self{{#readWriteVars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/readWriteVars}}): """ {{classname}} - a model defined in Swagger @@ -33,9 +33,12 @@ class {{classname}}(object): {{/hasMore}}{{/vars}} } -{{#vars}} +{{#readOnlyVars}} + self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}} +{{/readOnlyVars}} +{{#readWriteVars}} self._{{name}} = {{name}} -{{/vars}} +{{/readWriteVars}} {{#vars}}{{#-first}} {{/-first}} @property diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 15d55317325..a25525100af 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-08T10:26:51.066+08:00 +- Build date: 2016-06-08T23:40:51.798+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -24,7 +24,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git Then import the package: ```python -import swagger_client +import petstore_api ``` ### Setuptools @@ -38,7 +38,7 @@ python setup.py install --user Then import the package: ```python -import swagger_client +import petstore_api ``` ## Getting Started @@ -47,11 +47,11 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python import time -import swagger_client -from swagger_client.rest import ApiException +import petstore_api +from petstore_api.rest import ApiException from pprint import pprint # create an instance of the API class -api_instance = swagger_client.FakeApi +api_instance = petstore_api.FakeApi number = 3.4 # float | None double = 1.2 # float | None string = 'string_example' # str | None diff --git a/samples/client/petstore/python/petstore_api/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py index 2cff0bfc231..bddb37ed6ec 100644 --- a/samples/client/petstore/python/petstore_api/models/name.py +++ b/samples/client/petstore/python/petstore_api/models/name.py @@ -32,7 +32,7 @@ class Name(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): + def __init__(self, name=None, _property=None): """ Name - a model defined in Swagger @@ -55,10 +55,10 @@ class Name(object): '_123_number': '123Number' } + self._snake_case = None + self.__123_number = None self._name = name - self._snake_case = snake_case self.__property = _property - self.__123_number = _123_number @property def name(self): diff --git a/samples/client/petstore/python/petstore_api/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py index b1ca04f4a09..d7a29c0fb89 100644 --- a/samples/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python/petstore_api/models/read_only_first.py @@ -32,7 +32,7 @@ class ReadOnlyFirst(object): NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ - def __init__(self, bar=None, baz=None): + def __init__(self, baz=None): """ ReadOnlyFirst - a model defined in Swagger @@ -51,7 +51,7 @@ class ReadOnlyFirst(object): 'baz': 'baz' } - self._bar = bar + self._bar = None self._baz = baz @property From 2ea37202a946e03e1c2f7cff295d1b3faaf17601 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Thu, 9 Jun 2016 07:53:03 +0900 Subject: [PATCH 40/67] Omit @property.setter for readonly property --- .../src/main/resources/python/model.mustache | 2 ++ samples/client/petstore/python/.gitignore | 2 ++ samples/client/petstore/python/README.md | 18 +++++++------- .../python/petstore_api/configuration.py | 14 +++++------ .../python/petstore_api/models/name.py | 24 ------------------- .../petstore_api/models/read_only_first.py | 12 ---------- 6 files changed, 20 insertions(+), 52 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 4a8cf2a4cc2..a08595db88a 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -52,6 +52,7 @@ class {{classname}}(object): """ return self._{{name}} +{{^isReadOnly}} @{{name}}.setter def {{name}}(self, {{name}}): """ @@ -99,6 +100,7 @@ class {{classname}}(object): self._{{name}} = {{name}} +{{/isReadOnly}} {{/vars}} def to_dict(self): """ diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index 1dbc687de01..a655050c263 100644 --- a/samples/client/petstore/python/.gitignore +++ b/samples/client/petstore/python/.gitignore @@ -44,6 +44,8 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +venv/ +.python-version # Translations *.mo diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index a25525100af..8fc15c13eec 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -1,11 +1,11 @@ -# swagger_client +# petstore_api This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-08T23:40:51.798+09:00 +- Build date: 2016-06-09T08:00:02.342+09:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -24,7 +24,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git Then import the package: ```python -import petstore_api +import petstore_api ``` ### Setuptools @@ -130,12 +130,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -145,6 +139,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index ec940b71413..76f1f57c784 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -221,13 +221,6 @@ class Configuration(object): :return: The Auth Settings information dict. """ return { - 'api_key': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'api_key', - 'value': self.get_api_key_with_prefix('api_key') - }, 'petstore_auth': { @@ -236,6 +229,13 @@ class Configuration(object): 'key': 'Authorization', 'value': 'Bearer ' + self.access_token }, + 'api_key': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, } diff --git a/samples/client/petstore/python/petstore_api/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py index bddb37ed6ec..fa489658960 100644 --- a/samples/client/petstore/python/petstore_api/models/name.py +++ b/samples/client/petstore/python/petstore_api/models/name.py @@ -94,18 +94,6 @@ class Name(object): """ return self._snake_case - @snake_case.setter - def snake_case(self, snake_case): - """ - Sets the snake_case of this Name. - - - :param snake_case: The snake_case of this Name. - :type: int - """ - - self._snake_case = snake_case - @property def _property(self): """ @@ -140,18 +128,6 @@ class Name(object): """ return self.__123_number - @_123_number.setter - def _123_number(self, _123_number): - """ - Sets the _123_number of this Name. - - - :param _123_number: The _123_number of this Name. - :type: int - """ - - self.__123_number = _123_number - def to_dict(self): """ Returns the model properties as a dict diff --git a/samples/client/petstore/python/petstore_api/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py index d7a29c0fb89..c04d52501cf 100644 --- a/samples/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python/petstore_api/models/read_only_first.py @@ -65,18 +65,6 @@ class ReadOnlyFirst(object): """ return self._bar - @bar.setter - def bar(self, bar): - """ - Sets the bar of this ReadOnlyFirst. - - - :param bar: The bar of this ReadOnlyFirst. - :type: str - """ - - self._bar = bar - @property def baz(self): """ From 28bece0ce0ef6036d8afe36bbfab31a64532b79e Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 9 Jun 2016 08:56:42 +0200 Subject: [PATCH 41/67] made response change to petstore --- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 5 ++- .../java/io/swagger/client/api/PetApi.java | 33 +++++++++---------- .../java/io/swagger/client/api/StoreApi.java | 17 +++++----- .../java/io/swagger/client/api/UserApi.java | 33 +++++++++---------- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- 10 files changed, 48 insertions(+), 52 deletions(-) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 325f124c2d5..0b6b9773ee7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 0131c5123a5..6ae2ec402d5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index 886d6130e96..d76c4f87d8e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 605a18984b2..6a173209cd0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index 313707926bf..e94e2ea0ada 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,7 +13,6 @@ import com.google.gson.reflect.TypeToken; import com.squareup.okhttp.Call; import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Response; import java.io.IOException; @@ -118,8 +117,8 @@ public class FakeApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index c3090d83e1e..1d6d974d6a9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -13,7 +13,6 @@ import com.google.gson.reflect.TypeToken; import com.squareup.okhttp.Call; import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Response; import java.io.IOException; @@ -80,8 +79,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -185,8 +184,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -292,8 +291,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -400,8 +399,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -507,8 +506,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -613,8 +612,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -720,8 +719,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -833,8 +832,8 @@ public class PetApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index a17475df5b2..964c496b8bb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -13,7 +13,6 @@ import com.google.gson.reflect.TypeToken; import com.squareup.okhttp.Call; import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Response; import java.io.IOException; @@ -79,8 +78,8 @@ public class StoreApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -176,8 +175,8 @@ public class StoreApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -280,8 +279,8 @@ public class StoreApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -386,8 +385,8 @@ public class StoreApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index da664e27c4b..a6cb3fcf327 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -13,7 +13,6 @@ import com.google.gson.reflect.TypeToken; import com.squareup.okhttp.Call; import com.squareup.okhttp.Interceptor; -import com.squareup.okhttp.Response; import java.io.IOException; @@ -78,8 +77,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -180,8 +179,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -282,8 +281,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -385,8 +384,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -488,8 +487,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -603,8 +602,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -707,8 +706,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); @@ -812,8 +811,8 @@ public class UserApi { if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - Response originalResponse = chain.proceed(chain.request()); + public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 25c57b9e7d9..c62830180fe 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index 354330e0013..575d556b983 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T08:56:08.812+02:00") public class OAuth implements Authentication { private String accessToken; From 2d170fd7a6afd36e9b55986e183e3251bc0d7ca8 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 9 Jun 2016 16:07:36 +0800 Subject: [PATCH 42/67] add license to --- bin/java-petstore-okhttp-gson.sh | 2 +- bin/windows/java-petsore-okhttp-gson.bat | 10 +++++++ .../resources/Java/Configuration.mustache | 2 ++ .../src/main/resources/Java/Pair.mustache | 2 ++ .../main/resources/Java/StringUtil.mustache | 2 ++ .../src/main/resources/Java/api_test.mustache | 2 ++ .../okhttp-gson/ApiCallback.mustache | 2 ++ .../libraries/okhttp-gson/ApiClient.mustache | 2 ++ .../okhttp-gson/ApiResponse.mustache | 2 ++ .../Java/libraries/okhttp-gson/JSON.mustache | 2 ++ .../okhttp-gson/ProgressRequestBody.mustache | 2 ++ .../okhttp-gson/ProgressResponseBody.mustache | 2 ++ .../Java/libraries/okhttp-gson/api.mustache | 2 ++ .../okhttp-gson/auth/HttpBasicAuth.mustache | 2 ++ .../Java/libraries/okhttp-gson/model.mustache | 2 ++ .../java/io/swagger/client/ApiCallback.java | 24 +++++++++++++++++ .../java/io/swagger/client/ApiClient.java | 24 +++++++++++++++++ .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/ApiResponse.java | 24 +++++++++++++++++ .../java/io/swagger/client/Configuration.java | 26 ++++++++++++++++++- .../src/main/java/io/swagger/client/JSON.java | 24 +++++++++++++++++ .../src/main/java/io/swagger/client/Pair.java | 26 ++++++++++++++++++- .../swagger/client/ProgressRequestBody.java | 24 +++++++++++++++++ .../swagger/client/ProgressResponseBody.java | 24 +++++++++++++++++ .../java/io/swagger/client/StringUtil.java | 26 ++++++++++++++++++- .../java/io/swagger/client/api/FakeApi.java | 24 +++++++++++++++++ .../java/io/swagger/client/api/PetApi.java | 24 +++++++++++++++++ .../java/io/swagger/client/api/StoreApi.java | 24 +++++++++++++++++ .../java/io/swagger/client/api/UserApi.java | 24 +++++++++++++++++ .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 24 +++++++++++++++++ .../java/io/swagger/client/auth/OAuth.java | 2 +- .../model/AdditionalPropertiesClass.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Animal.java | 24 +++++++++++++++++ .../io/swagger/client/model/AnimalFarm.java | 24 +++++++++++++++++ .../io/swagger/client/model/ArrayTest.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Cat.java | 24 +++++++++++++++++ .../io/swagger/client/model/Category.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Dog.java | 24 +++++++++++++++++ .../io/swagger/client/model/EnumClass.java | 24 +++++++++++++++++ .../io/swagger/client/model/EnumTest.java | 24 +++++++++++++++++ .../io/swagger/client/model/FormatTest.java | 24 +++++++++++++++++ ...ropertiesAndAdditionalPropertiesClass.java | 24 +++++++++++++++++ .../client/model/Model200Response.java | 24 +++++++++++++++++ .../client/model/ModelApiResponse.java | 24 +++++++++++++++++ .../io/swagger/client/model/ModelReturn.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Name.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Order.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Pet.java | 24 +++++++++++++++++ .../swagger/client/model/ReadOnlyFirst.java | 24 +++++++++++++++++ .../client/model/SpecialModelName.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/Tag.java | 24 +++++++++++++++++ .../java/io/swagger/client/model/User.java | 24 +++++++++++++++++ 53 files changed, 883 insertions(+), 7 deletions(-) create mode 100755 bin/windows/java-petsore-okhttp-gson.bat diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index f656624a6c6..b62610b1eff 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/java-petsore-okhttp-gson.bat b/bin/windows/java-petsore-okhttp-gson.bat new file mode 100755 index 00000000000..cc2b52e4fa1 --- /dev/null +++ b/bin/windows/java-petsore-okhttp-gson.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java --library=okhttp-gson -DhideGenerationTimestamp=true + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache index ea6cccb7d85..cb425df3563 100644 --- a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; {{>generatedAnnotation}} diff --git a/modules/swagger-codegen/src/main/resources/Java/Pair.mustache b/modules/swagger-codegen/src/main/resources/Java/Pair.mustache index e2a47317afe..c08f145a482 100644 --- a/modules/swagger-codegen/src/main/resources/Java/Pair.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/Pair.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; {{>generatedAnnotation}} diff --git a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache index 073966b0c21..7b72a7bab45 100644 --- a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; {{>generatedAnnotation}} diff --git a/modules/swagger-codegen/src/main/resources/Java/api_test.mustache b/modules/swagger-codegen/src/main/resources/Java/api_test.mustache index f9e00ef2979..0a7639e0ec1 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api_test.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{package}}; import {{invokerPackage}}.ApiException; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache index 3b554fefeff..4cc99a76ec3 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiCallback.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.io.IOException; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index ac140471567..3d6b3fe17f0 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.squareup.okhttp.Call; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache index 88dcc43af4b..82c86b3e215 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.List; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache index c7dd1d8e62f..8e92e16c0ad 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.google.gson.Gson; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache index a1c300b9f30..d6570bd0d3b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.squareup.okhttp.MediaType; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache index 061a95ac299..3f53133697c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import com.squareup.okhttp.MediaType; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 13c813e58af..b2f8a72df6b 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{package}}; import {{invokerPackage}}.ApiCallback; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache index 636691a2f21..320903b0319 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/auth/HttpBasicAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache index 4bd6d5638b4..0c262eaa3a3 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/model.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{package}}; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java index 9a1188c92e5..2c9ca479f6c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import java.io.IOException; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index a035a3175df..9db03685120 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import com.squareup.okhttp.Call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 325f124c2d5..73f637e7be4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java index b611649f494..2ba402bc1b1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import java.util.List; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 0131c5123a5..4c252410dd9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,30 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java index 61120482629..14806b23ba5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import com.google.gson.Gson; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index 886d6130e96..cd6e1443acd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,30 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java index d20991c6780..ddecd78de5d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import com.squareup.okhttp.MediaType; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java index 138da3f2106..98cc1ee5f7d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; import com.squareup.okhttp.MediaType; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 605a18984b2..20aa7ab30e0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,30 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index 313707926bf..ae1853eeccd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.api; import io.swagger.client.ApiCallback; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index c3090d83e1e..3bc7e6df69c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.api; import io.swagger.client.ApiCallback; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index a17475df5b2..1f4717ee850 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.api; import io.swagger.client.ApiCallback; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index da664e27c4b..ffc7aebb9b2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.api; import io.swagger.client.ApiCallback; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 25c57b9e7d9..6882dbc41c0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 45477136538..3406f8f55fd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index 354330e0013..76d2917f24e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-09T00:01:22.559+08:00") + public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index eae1fc450de..d408dc42459 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java index 1dc78139c73..5270f3be9ef 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java index ccbebe839f1..a30976c730c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java index 6a0f8f790fa..e00a2d644ed 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java index c7655665883..13c814801af 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java index c156ce3a330..06312c229eb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java index e2823490c0d..a9eeaf5bae8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java index 7008dd7ba4b..970d8abf626 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java index 3da7e768f66..ddd0f7acb13 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index 37c3412ee08..494750d2e6a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 124515dad27..35762f1a0c7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index 6a14bc15a22..382f5014afb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java index 1c13fce28b8..e82ddccc724 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index dceff653982..2be1c8524bd 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java index 9a15ccc032b..ae8d4122cea 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index 6e52dd1712c..def3eee8645 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java index abb2dcdef48..a010b806792 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index bdaa83c3acf..23a8328a0c2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java index 2646fadf61c..da372a36f9d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java index 0f71d4e2a7f..f8d857eea7b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java index 332d6b81ba0..ad87af2477f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java @@ -1,3 +1,27 @@ +/** +* Swagger Petstore +* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@swagger.io +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package io.swagger.client.model; import java.util.Objects; From 0a3a47dbd471eaa762cf87dd0bb7aed348246293 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 9 Jun 2016 16:20:57 +0800 Subject: [PATCH 43/67] add license to java okhttp client --- .../main/resources/Java/apiException.mustache | 2 + .../resources/Java/auth/ApiKeyAuth.mustache | 2 + .../Java/auth/Authentication.mustache | 2 + .../Java/auth/HttpBasicAuth.mustache | 2 + .../main/resources/Java/auth/OAuth.mustache | 2 + .../resources/Java/auth/OAuthFlow.mustache | 4 +- .../main/resources/Java/licenseInfo.mustache | 23 ++++++++++ .../java/io/swagger/client/ApiCallback.java | 45 ++++++++++--------- .../java/io/swagger/client/ApiClient.java | 45 ++++++++++--------- .../java/io/swagger/client/ApiException.java | 25 +++++++++++ .../java/io/swagger/client/ApiResponse.java | 45 ++++++++++--------- .../java/io/swagger/client/Configuration.java | 45 ++++++++++--------- .../src/main/java/io/swagger/client/JSON.java | 45 ++++++++++--------- .../src/main/java/io/swagger/client/Pair.java | 45 ++++++++++--------- .../swagger/client/ProgressRequestBody.java | 45 ++++++++++--------- .../swagger/client/ProgressResponseBody.java | 45 ++++++++++--------- .../java/io/swagger/client/StringUtil.java | 45 ++++++++++--------- .../java/io/swagger/client/api/FakeApi.java | 45 ++++++++++--------- .../java/io/swagger/client/api/PetApi.java | 45 ++++++++++--------- .../java/io/swagger/client/api/StoreApi.java | 45 ++++++++++--------- .../java/io/swagger/client/api/UserApi.java | 45 ++++++++++--------- .../io/swagger/client/auth/ApiKeyAuth.java | 25 +++++++++++ .../swagger/client/auth/Authentication.java | 25 +++++++++++ .../io/swagger/client/auth/HttpBasicAuth.java | 45 ++++++++++--------- .../java/io/swagger/client/auth/OAuth.java | 25 +++++++++++ .../io/swagger/client/auth/OAuthFlow.java | 27 ++++++++++- .../model/AdditionalPropertiesClass.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Animal.java | 45 ++++++++++--------- .../io/swagger/client/model/AnimalFarm.java | 45 ++++++++++--------- .../io/swagger/client/model/ArrayTest.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Cat.java | 45 ++++++++++--------- .../io/swagger/client/model/Category.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Dog.java | 45 ++++++++++--------- .../io/swagger/client/model/EnumClass.java | 45 ++++++++++--------- .../io/swagger/client/model/EnumTest.java | 45 ++++++++++--------- .../io/swagger/client/model/FormatTest.java | 45 ++++++++++--------- ...ropertiesAndAdditionalPropertiesClass.java | 45 ++++++++++--------- .../client/model/Model200Response.java | 45 ++++++++++--------- .../client/model/ModelApiResponse.java | 45 ++++++++++--------- .../io/swagger/client/model/ModelReturn.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Name.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Order.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Pet.java | 45 ++++++++++--------- .../swagger/client/model/ReadOnlyFirst.java | 45 ++++++++++--------- .../client/model/SpecialModelName.java | 45 ++++++++++--------- .../java/io/swagger/client/model/Tag.java | 45 ++++++++++--------- .../java/io/swagger/client/model/User.java | 45 ++++++++++--------- 47 files changed, 967 insertions(+), 772 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/Java/licenseInfo.mustache diff --git a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache index 740ed4143ab..89ed524d37e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}; import java.util.Map; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache index 931d17b0d04..f73a6f5b3f8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache index 592b55c2552..26174fa3b59 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache index febabe33d64..0438f6a40b7 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache index 902f54a2e3a..ffc9923d1fe 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache @@ -1,3 +1,5 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; import {{invokerPackage}}.Pair; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/OAuthFlow.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/OAuthFlow.mustache index 7ab35f6d890..002e9572f33 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/OAuthFlow.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/OAuthFlow.mustache @@ -1,5 +1,7 @@ +{{>licenseInfo}} + package {{invokerPackage}}.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/main/resources/Java/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/Java/licenseInfo.mustache new file mode 100644 index 00000000000..861d97234cf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java index 2c9ca479f6c..efd0535e654 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiCallback.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index 9db03685120..34af59510c2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java index 73f637e7be4..600bb507f09 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiException.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; import java.util.Map; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java index 2ba402bc1b1..b112f15f3e3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiResponse.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java index 4c252410dd9..cbdadd6262d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Configuration.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java index 14806b23ba5..0a3232fd91c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java index cd6e1443acd..4b44c415812 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/Pair.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java index ddecd78de5d..a29fc9aec70 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressRequestBody.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java index 98cc1ee5f7d..c20672cf0c4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ProgressResponseBody.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java index 20aa7ab30e0..03c6c81e434 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/StringUtil.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index ae1853eeccd..42f6e8bb356 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.api; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index 3bc7e6df69c..eeec7a8e46e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.api; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index 1f4717ee850..7037797d751 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.api; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index ffc7aebb9b2..b8fd7cbed5b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.api; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6882dbc41c0..6ba15566b60 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java index c5527df3b33..a063a6998b5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/Authentication.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 3406f8f55fd..9ac184eda83 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.auth; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java index 76d2917f24e..8802ebc92c8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index d408dc42459..da61d03f8d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java index 5270f3be9ef..dca1f555e38 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Animal.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java index a30976c730c..516ff068c08 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java index e00a2d644ed..9795e9b4d79 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ArrayTest.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java index 13c814801af..63bef8d8bbf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Cat.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java index 06312c229eb..31e61e56c25 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Category.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java index a9eeaf5bae8..cba351a12c9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Dog.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java index 970d8abf626..af9ec9f32dc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumClass.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java index ddd0f7acb13..563a785d0b7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/EnumTest.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index 494750d2e6a..11516b0c554 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 35762f1a0c7..470e8b94665 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index 382f5014afb..8c7227f3f4e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java index e82ddccc724..e72fe0c7dbe 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java index 2be1c8524bd..52fd8ceaca1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ModelReturn.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java index ae8d4122cea..fb4ef89df70 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Name.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index def3eee8645..89f901ff678 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java index a010b806792..92c499ae757 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Pet.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 23a8328a0c2..a43413d0903 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java index da372a36f9d..1ed10e372ae 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java index f8d857eea7b..a80ef012510 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Tag.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java index ad87af2477f..cac9626602d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/User.java @@ -1,26 +1,27 @@ /** -* Swagger Petstore -* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -* -* OpenAPI spec version: 1.0.0 -* Contact: apiteam@swagger.io -* -* NOTE: This class is auto generated by the swagger code generator program. -* https://github.com/swagger-api/swagger-codegen.git -* Do not edit the class manually. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.client.model; From 1ff18c4ac61398733f7967400428bf98ba37b310 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 9 Jun 2016 11:31:15 +0200 Subject: [PATCH 44/67] make all okhttp classes explicit to avoid conflict --- .../Java/libraries/okhttp-gson/api.mustache | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache index ed447a8f5dd..7abe897d42e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -13,9 +13,6 @@ import {{invokerPackage}}.ProgressResponseBody; import com.google.gson.reflect.TypeToken; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Interceptor; - import java.io.IOException; {{#imports}}import {{import}}; @@ -51,7 +48,7 @@ public class {{classname}} { {{#operation}} /* Build call for {{operationId}} */ - private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set @@ -89,9 +86,9 @@ public class {{classname}} { {{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -124,7 +121,7 @@ public class {{classname}} { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { - Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null); + com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}null, null); {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType);{{/returnType}}{{^returnType}}return {{localVariablePrefix}}apiClient.execute({{localVariablePrefix}}call);{{/returnType}} } @@ -137,7 +134,7 @@ public class {{classname}} { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { + public com.squareup.okhttp.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -158,7 +155,7 @@ public class {{classname}} { }; } - Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); + com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}progressListener, progressRequestListener); {{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); {{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}localVarReturnType, {{localVariablePrefix}}callback);{{/returnType}}{{^returnType}}{{localVariablePrefix}}apiClient.executeAsync({{localVariablePrefix}}call, {{localVariablePrefix}}callback);{{/returnType}} return {{localVariablePrefix}}call; From 32cabcfb230ab8749a1c27cf6c376ad9ba97d1e9 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 9 Jun 2016 11:35:03 +0200 Subject: [PATCH 45/67] updated petstore with latest okhttp changes --- .../java/io/swagger/client/api/FakeApi.java | 15 ++- .../java/io/swagger/client/api/PetApi.java | 99 +++++++++---------- .../java/io/swagger/client/api/StoreApi.java | 51 +++++----- .../java/io/swagger/client/api/UserApi.java | 99 +++++++++---------- 4 files changed, 126 insertions(+), 138 deletions(-) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index 3e28653cab4..2784add9c9c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -36,9 +36,6 @@ import io.swagger.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Interceptor; - import java.io.IOException; import java.util.Date; @@ -70,7 +67,7 @@ public class FakeApi { } /* Build call for testEndpointParameters */ - private Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -140,9 +137,9 @@ public class FakeApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -195,7 +192,7 @@ public class FakeApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { - Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); + com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); return apiClient.execute(call); } @@ -218,7 +215,7 @@ public class FakeApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -239,7 +236,7 @@ public class FakeApi { }; } - Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index d47afbe2d51..765754a3b09 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -36,9 +36,6 @@ import io.swagger.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Interceptor; - import java.io.IOException; import io.swagger.client.model.Pet; @@ -71,7 +68,7 @@ public class PetApi { } /* Build call for addPet */ - private Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call addPetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -102,9 +99,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -135,7 +132,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - Call call = addPetCall(body, null, null); + com.squareup.okhttp.Call call = addPetCall(body, null, null); return apiClient.execute(call); } @@ -147,7 +144,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call addPetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -168,12 +165,12 @@ public class PetApi { }; } - Call call = addPetCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = addPetCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for deletePet */ - private Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call deletePetCall(Long petId, String apiKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -207,9 +204,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -242,7 +239,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { - Call call = deletePetCall(petId, apiKey, null, null); + com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, null, null); return apiClient.execute(call); } @@ -255,7 +252,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call deletePetAsync(Long petId, String apiKey, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -276,12 +273,12 @@ public class PetApi { }; } - Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = deletePetCall(petId, apiKey, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for findPetsByStatus */ - private Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call findPetsByStatusCall(List status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'status' is set @@ -314,9 +311,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -349,7 +346,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { - Call call = findPetsByStatusCall(status, null, null); + com.squareup.okhttp.Call call = findPetsByStatusCall(status, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -362,7 +359,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { + public com.squareup.okhttp.Call findPetsByStatusAsync(List status, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -383,13 +380,13 @@ public class PetApi { }; } - Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = findPetsByStatusCall(status, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for findPetsByTags */ - private Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call findPetsByTagsCall(List tags, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'tags' is set @@ -422,9 +419,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -457,7 +454,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { - Call call = findPetsByTagsCall(tags, null, null); + com.squareup.okhttp.Call call = findPetsByTagsCall(tags, null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -470,7 +467,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { + public com.squareup.okhttp.Call findPetsByTagsAsync(List tags, final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -491,13 +488,13 @@ public class PetApi { }; } - Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = findPetsByTagsCall(tags, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getPetById */ - private Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call getPetByIdCall(Long petId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -529,9 +526,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -564,7 +561,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { - Call call = getPetByIdCall(petId, null, null); + com.squareup.okhttp.Call call = getPetByIdCall(petId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -577,7 +574,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call getPetByIdAsync(Long petId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -598,13 +595,13 @@ public class PetApi { }; } - Call call = getPetByIdCall(petId, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = getPetByIdCall(petId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for updatePet */ - private Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call updatePetCall(Pet body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -635,9 +632,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -668,7 +665,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - Call call = updatePetCall(body, null, null); + com.squareup.okhttp.Call call = updatePetCall(body, null, null); return apiClient.execute(call); } @@ -680,7 +677,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call updatePetAsync(Pet body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -701,12 +698,12 @@ public class PetApi { }; } - Call call = updatePetCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = updatePetCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for updatePetWithForm */ - private Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call updatePetWithFormCall(Long petId, String name, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -742,9 +739,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -779,7 +776,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { - Call call = updatePetWithFormCall(petId, name, status, null, null); + com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, null, null); return apiClient.execute(call); } @@ -793,7 +790,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call updatePetWithFormAsync(Long petId, String name, String status, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -814,12 +811,12 @@ public class PetApi { }; } - Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = updatePetWithFormCall(petId, name, status, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for uploadFile */ - private Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call uploadFileCall(Long petId, String additionalMetadata, File file, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'petId' is set @@ -855,9 +852,9 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -894,7 +891,7 @@ public class PetApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { - Call call = uploadFileCall(petId, additionalMetadata, file, null, null); + com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -909,7 +906,7 @@ public class PetApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call uploadFileAsync(Long petId, String additionalMetadata, File file, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -930,7 +927,7 @@ public class PetApi { }; } - Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = uploadFileCall(petId, additionalMetadata, file, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java index 2299101c41b..43c530ee964 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/StoreApi.java @@ -36,9 +36,6 @@ import io.swagger.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Interceptor; - import java.io.IOException; import io.swagger.client.model.Order; @@ -69,7 +66,7 @@ public class StoreApi { } /* Build call for deleteOrder */ - private Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call deleteOrderCall(String orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -101,9 +98,9 @@ public class StoreApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -134,7 +131,7 @@ public class StoreApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { - Call call = deleteOrderCall(orderId, null, null); + com.squareup.okhttp.Call call = deleteOrderCall(orderId, null, null); return apiClient.execute(call); } @@ -146,7 +143,7 @@ public class StoreApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call deleteOrderAsync(String orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -167,12 +164,12 @@ public class StoreApi { }; } - Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = deleteOrderCall(orderId, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for getInventory */ - private Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call getInventoryCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -198,9 +195,9 @@ public class StoreApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -231,7 +228,7 @@ public class StoreApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - Call call = getInventoryCall(null, null); + com.squareup.okhttp.Call call = getInventoryCall(null, null); Type localVarReturnType = new TypeToken>(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -243,7 +240,7 @@ public class StoreApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call getInventoryAsync(final ApiCallback> callback) throws ApiException { + public com.squareup.okhttp.Call getInventoryAsync(final ApiCallback> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -264,13 +261,13 @@ public class StoreApi { }; } - Call call = getInventoryCall(progressListener, progressRequestListener); + com.squareup.okhttp.Call call = getInventoryCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getOrderById */ - private Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call getOrderByIdCall(Long orderId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'orderId' is set @@ -302,9 +299,9 @@ public class StoreApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -337,7 +334,7 @@ public class StoreApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { - Call call = getOrderByIdCall(orderId, null, null); + com.squareup.okhttp.Call call = getOrderByIdCall(orderId, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -350,7 +347,7 @@ public class StoreApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call getOrderByIdAsync(Long orderId, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -371,13 +368,13 @@ public class StoreApi { }; } - Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = getOrderByIdCall(orderId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for placeOrder */ - private Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call placeOrderCall(Order body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -408,9 +405,9 @@ public class StoreApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -443,7 +440,7 @@ public class StoreApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - Call call = placeOrderCall(body, null, null); + com.squareup.okhttp.Call call = placeOrderCall(body, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -456,7 +453,7 @@ public class StoreApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call placeOrderAsync(Order body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -477,7 +474,7 @@ public class StoreApi { }; } - Call call = placeOrderCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = placeOrderCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java index 37026b8fb17..9a7054091a3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/UserApi.java @@ -36,9 +36,6 @@ import io.swagger.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Interceptor; - import java.io.IOException; import io.swagger.client.model.User; @@ -69,7 +66,7 @@ public class UserApi { } /* Build call for createUser */ - private Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call createUserCall(User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -100,9 +97,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -133,7 +130,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - Call call = createUserCall(body, null, null); + com.squareup.okhttp.Call call = createUserCall(body, null, null); return apiClient.execute(call); } @@ -145,7 +142,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call createUserAsync(User body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call createUserAsync(User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -166,12 +163,12 @@ public class UserApi { }; } - Call call = createUserCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = createUserCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for createUsersWithArrayInput */ - private Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call createUsersWithArrayInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -202,9 +199,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -235,7 +232,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - Call call = createUsersWithArrayInputCall(body, null, null); + com.squareup.okhttp.Call call = createUsersWithArrayInputCall(body, null, null); return apiClient.execute(call); } @@ -247,7 +244,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call createUsersWithArrayInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -268,12 +265,12 @@ public class UserApi { }; } - Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = createUsersWithArrayInputCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for createUsersWithListInput */ - private Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call createUsersWithListInputCall(List body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -304,9 +301,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -337,7 +334,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - Call call = createUsersWithListInputCall(body, null, null); + com.squareup.okhttp.Call call = createUsersWithListInputCall(body, null, null); return apiClient.execute(call); } @@ -349,7 +346,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call createUsersWithListInputAsync(List body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -370,12 +367,12 @@ public class UserApi { }; } - Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = createUsersWithListInputCall(body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for deleteUser */ - private Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call deleteUserCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'username' is set @@ -407,9 +404,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -440,7 +437,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { - Call call = deleteUserCall(username, null, null); + com.squareup.okhttp.Call call = deleteUserCall(username, null, null); return apiClient.execute(call); } @@ -452,7 +449,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call deleteUserAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -473,12 +470,12 @@ public class UserApi { }; } - Call call = deleteUserCall(username, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = deleteUserCall(username, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for getUserByName */ - private Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call getUserByNameCall(String username, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'username' is set @@ -510,9 +507,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -545,7 +542,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { - Call call = getUserByNameCall(username, null, null); + com.squareup.okhttp.Call call = getUserByNameCall(username, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -558,7 +555,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call getUserByNameAsync(String username, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -579,13 +576,13 @@ public class UserApi { }; } - Call call = getUserByNameCall(username, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = getUserByNameCall(username, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for loginUser */ - private Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call loginUserCall(String username, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'username' is set @@ -625,9 +622,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -662,7 +659,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { - Call call = loginUserCall(username, password, null, null); + com.squareup.okhttp.Call call = loginUserCall(username, password, null, null); Type localVarReturnType = new TypeToken(){}.getType(); return apiClient.execute(call, localVarReturnType); } @@ -676,7 +673,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call loginUserAsync(String username, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -697,13 +694,13 @@ public class UserApi { }; } - Call call = loginUserCall(username, password, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = loginUserCall(username, password, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for logoutUser */ - private Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call logoutUserCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; @@ -729,9 +726,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -760,7 +757,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse logoutUserWithHttpInfo() throws ApiException { - Call call = logoutUserCall(null, null); + com.squareup.okhttp.Call call = logoutUserCall(null, null); return apiClient.execute(call); } @@ -771,7 +768,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call logoutUserAsync(final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call logoutUserAsync(final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -792,12 +789,12 @@ public class UserApi { }; } - Call call = logoutUserCall(progressListener, progressRequestListener); + com.squareup.okhttp.Call call = logoutUserCall(progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } /* Build call for updateUser */ - private Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call updateUserCall(String username, User body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // verify the required parameter 'username' is set @@ -834,9 +831,9 @@ public class UserApi { localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new Interceptor() { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override - public com.squareup.okhttp.Response intercept(Interceptor.Chain chain) throws IOException { + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) @@ -869,7 +866,7 @@ public class UserApi { * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - Call call = updateUserCall(username, body, null, null); + com.squareup.okhttp.Call call = updateUserCall(username, body, null, null); return apiClient.execute(call); } @@ -882,7 +879,7 @@ public class UserApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call updateUserAsync(String username, User body, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; @@ -903,7 +900,7 @@ public class UserApi { }; } - Call call = updateUserCall(username, body, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = updateUserCall(username, body, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; } From 4ee483dcc028388119dd6650e7613fb0b78c9351 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 9 Jun 2016 18:23:19 +0800 Subject: [PATCH 46/67] fix okhttp pom to remove dependency on gradle, sbt test --- .../Java/libraries/okhttp-gson/pom.mustache | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index 241f1b308e6..d3080ee51ae 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -105,53 +105,6 @@ 1.7 - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - gradle-test - integration-test - - exec - - - gradle - - check - - - - - sbt-test - integration-test - - exec - - - sbt - - publishLocal - - - - - mvn-javadoc-test - integration-test - - exec - - - mvn - - javadoc:javadoc - - - - - From f3e368c7238fd6e262ce2d4c7be1713fed6110ce Mon Sep 17 00:00:00 2001 From: Newell Zhu Date: Thu, 9 Jun 2016 18:40:01 +0800 Subject: [PATCH 47/67] Add model & migrate support --- .../languages/Rails5ServerCodegen.java | 69 ++++++++------- .../main/resources/rails5/migrate.mustache | 15 ++++ .../src/main/resources/rails5/model.mustache | 12 +++ samples/server/petstore/rails5/README.md | 2 +- .../rails5/app/models/api_response.rb | 27 ++++++ .../petstore/rails5/app/models/category.rb | 27 ++++++ .../petstore/rails5/app/models/order.rb | 27 ++++++ .../server/petstore/rails5/app/models/pet.rb | 31 +++++++ .../server/petstore/rails5/app/models/tag.rb | 27 ++++++ .../server/petstore/rails5/app/models/user.rb | 27 ++++++ .../rails5/db/migrate/0_init_tables.rb | 84 +++++++++++++++++++ 11 files changed, 311 insertions(+), 37 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/rails5/migrate.mustache create mode 100644 modules/swagger-codegen/src/main/resources/rails5/model.mustache create mode 100644 samples/server/petstore/rails5/app/models/api_response.rb create mode 100644 samples/server/petstore/rails5/app/models/category.rb create mode 100644 samples/server/petstore/rails5/app/models/order.rb create mode 100644 samples/server/petstore/rails5/app/models/pet.rb create mode 100644 samples/server/petstore/rails5/app/models/tag.rb create mode 100644 samples/server/petstore/rails5/app/models/user.rb create mode 100644 samples/server/petstore/rails5/db/migrate/0_init_tables.rb diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Rails5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Rails5ServerCodegen.java index cbf77338ab3..4bb4c8e883c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Rails5ServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Rails5ServerCodegen.java @@ -1,5 +1,7 @@ package io.swagger.codegen.languages; +import java.text.SimpleDateFormat; +import java.util.Date; import com.fasterxml.jackson.core.JsonProcessingException; import io.swagger.codegen.CodegenConfig; @@ -24,6 +26,7 @@ import org.slf4j.LoggerFactory; public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(Rails5ServerCodegen.class); + private static final SimpleDateFormat MIGRATE_FILE_NAME_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); protected String gemName; protected String moduleName; @@ -57,12 +60,13 @@ public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig public Rails5ServerCodegen() { super(); - apiPackage = "app/controllers"; outputFolder = "generated-code" + File.separator + "rails5"; - - // no model - modelTemplateFiles.clear(); + apiPackage = "app/controllers"; apiTemplateFiles.put("controller.mustache", ".rb"); + + modelPackage = "app/models"; + modelTemplateFiles.put("model.mustache", ".rb"); + embeddedTemplateDir = templateDir = "rails5"; typeMapping.clear(); @@ -77,21 +81,21 @@ public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig "if", "not", "return", "undef", "yield") ); - languageSpecificPrimitives.add("int"); - languageSpecificPrimitives.add("array"); - languageSpecificPrimitives.add("map"); - languageSpecificPrimitives.add("string"); - languageSpecificPrimitives.add("DateTime"); - - typeMapping.put("long", "int"); - typeMapping.put("integer", "int"); - typeMapping.put("Array", "array"); - typeMapping.put("String", "string"); - typeMapping.put("List", "array"); - typeMapping.put("map", "map"); - //TODO binary should be mapped to byte array - // mapped to String as a workaround + typeMapping.put("string", "string"); + typeMapping.put("char", "string"); + typeMapping.put("int", "integer"); + typeMapping.put("integer", "integer"); + typeMapping.put("long", "integer"); + typeMapping.put("short", "integer"); + typeMapping.put("float", "float"); + typeMapping.put("double", "decimal"); + typeMapping.put("number", "float"); + typeMapping.put("date", "date"); + typeMapping.put("DateTime", "datetime"); + typeMapping.put("boolean", "boolean"); typeMapping.put("binary", "string"); + typeMapping.put("ByteArray", "string"); + typeMapping.put("UUID", "string"); // remove modelPackage and apiPackage added by default cliOptions.clear(); @@ -145,6 +149,7 @@ public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("secrets.yml", configFolder, "secrets.yml")); supportingFiles.add(new SupportingFile("spring.rb", configFolder, "spring.rb")); supportingFiles.add(new SupportingFile(".keep", migrateFolder, ".keep")); + supportingFiles.add(new SupportingFile("migrate.mustache", migrateFolder, "0_init_tables.rb")); supportingFiles.add(new SupportingFile("schema.rb", dbFolder, "schema.rb")); supportingFiles.add(new SupportingFile("seeds.rb", dbFolder, "seeds.rb")); supportingFiles.add(new SupportingFile(".keep", tasksFolder, ".keep")); @@ -204,24 +209,6 @@ public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig return super.getTypeDeclaration(p); } - @Override - public String getSwaggerType(Property p) { - String swaggerType = super.getSwaggerType(p); - String type = null; - if (typeMapping.containsKey(swaggerType)) { - type = typeMapping.get(swaggerType); - if (languageSpecificPrimitives.contains(type)) { - return type; - } - } else { - type = swaggerType; - } - if (type == null) { - return null; - } - return type; - } - @Override public String toDefaultValue(Property p) { return "null"; @@ -249,6 +236,16 @@ public class Rails5ServerCodegen extends DefaultCodegen implements CodegenConfig return name; } + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + String type = null; + if (typeMapping.containsKey(swaggerType)) { + return typeMapping.get(swaggerType); + } + return "string"; + } + @Override public String toParamName(String name) { // should be the same as variable name diff --git a/modules/swagger-codegen/src/main/resources/rails5/migrate.mustache b/modules/swagger-codegen/src/main/resources/rails5/migrate.mustache new file mode 100644 index 00000000000..508b0ce7ede --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/rails5/migrate.mustache @@ -0,0 +1,15 @@ +=begin +{{> info}} +=end + +class InitTables < ActiveRecord::Migration + def change{{#models}}{{#model}} + create_table :{{classFilename}}, id: false do |t|{{#vars}}{{#isContainer}} + t.string :{{name}}{{/isContainer}}{{^isContainer}} + t.{{datatype}} :{{{name}}}{{/isContainer}}{{/vars}} + + t.timestamps + end +{{/model}}{{/models}} + end +end diff --git a/modules/swagger-codegen/src/main/resources/rails5/model.mustache b/modules/swagger-codegen/src/main/resources/rails5/model.mustache new file mode 100644 index 00000000000..edfe9fac56c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/rails5/model.mustache @@ -0,0 +1,12 @@ +=begin +{{> info}} +=end + +{{#models}}{{#model}} +class {{classname}} < ApplicationRecord +{{#requiredVars}} + validate_presence_of :{{name}} +{{/requiredVars}}{{#vars}}{{#isListContainer}} + serialize :{{name}}, Array{{/isListContainer}}{{#isMapContainer}} + serialize :{{name}}, Hash{{/isMapContainer}}{{/vars}} +end{{/model}}{{/models}} diff --git a/samples/server/petstore/rails5/README.md b/samples/server/petstore/rails5/README.md index c5cb90075a6..841b82ad656 100644 --- a/samples/server/petstore/rails5/README.md +++ b/samples/server/petstore/rails5/README.md @@ -14,7 +14,7 @@ bundle install This sample was generated with the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. ``` -bin/rake db:create +bin/rake db:create db:migrate bin/rails s ``` diff --git a/samples/server/petstore/rails5/app/models/api_response.rb b/samples/server/petstore/rails5/app/models/api_response.rb new file mode 100644 index 00000000000..1ad59e6c792 --- /dev/null +++ b/samples/server/petstore/rails5/app/models/api_response.rb @@ -0,0 +1,27 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class ApiResponse < ApplicationRecord + +end diff --git a/samples/server/petstore/rails5/app/models/category.rb b/samples/server/petstore/rails5/app/models/category.rb new file mode 100644 index 00000000000..3adaa488309 --- /dev/null +++ b/samples/server/petstore/rails5/app/models/category.rb @@ -0,0 +1,27 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class Category < ApplicationRecord + +end diff --git a/samples/server/petstore/rails5/app/models/order.rb b/samples/server/petstore/rails5/app/models/order.rb new file mode 100644 index 00000000000..963eb8e18ed --- /dev/null +++ b/samples/server/petstore/rails5/app/models/order.rb @@ -0,0 +1,27 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class Order < ApplicationRecord + +end diff --git a/samples/server/petstore/rails5/app/models/pet.rb b/samples/server/petstore/rails5/app/models/pet.rb new file mode 100644 index 00000000000..da927b6260e --- /dev/null +++ b/samples/server/petstore/rails5/app/models/pet.rb @@ -0,0 +1,31 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class Pet < ApplicationRecord + validate_presence_of :name + validate_presence_of :photo_urls + + serialize :photo_urls, Array + serialize :tags, Array +end diff --git a/samples/server/petstore/rails5/app/models/tag.rb b/samples/server/petstore/rails5/app/models/tag.rb new file mode 100644 index 00000000000..096f132e2c2 --- /dev/null +++ b/samples/server/petstore/rails5/app/models/tag.rb @@ -0,0 +1,27 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class Tag < ApplicationRecord + +end diff --git a/samples/server/petstore/rails5/app/models/user.rb b/samples/server/petstore/rails5/app/models/user.rb new file mode 100644 index 00000000000..47f81df1089 --- /dev/null +++ b/samples/server/petstore/rails5/app/models/user.rb @@ -0,0 +1,27 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + + +class User < ApplicationRecord + +end diff --git a/samples/server/petstore/rails5/db/migrate/0_init_tables.rb b/samples/server/petstore/rails5/db/migrate/0_init_tables.rb new file mode 100644 index 00000000000..5fa060fb4dc --- /dev/null +++ b/samples/server/petstore/rails5/db/migrate/0_init_tables.rb @@ -0,0 +1,84 @@ +=begin +Swagger Petstore + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end + +class InitTables < ActiveRecord::Migration + def change + create_table :api_response, id: false do |t| + t.integer :code + t.string :type + t.string :message + + t.timestamps + end + + create_table :category, id: false do |t| + t.integer :id + t.string :name + + t.timestamps + end + + create_table :order, id: false do |t| + t.integer :id + t.integer :pet_id + t.integer :quantity + t.datetime :ship_date + t.string :status + t.boolean :complete + + t.timestamps + end + + create_table :pet, id: false do |t| + t.integer :id + t.string :category + t.string :name + t.string :photo_urls + t.string :tags + t.string :status + + t.timestamps + end + + create_table :tag, id: false do |t| + t.integer :id + t.string :name + + t.timestamps + end + + create_table :user, id: false do |t| + t.integer :id + t.string :username + t.string :first_name + t.string :last_name + t.string :email + t.string :password + t.string :phone + t.integer :user_status + + t.timestamps + end + + end +end From b27022749f85521c2ba012fae1682ed4bd350e26 Mon Sep 17 00:00:00 2001 From: Newell Zhu Date: Thu, 9 Jun 2016 18:40:25 +0800 Subject: [PATCH 48/67] Add debug support for rails5 --- bin/rails5-petstore-server.sh | 2 +- modules/swagger-codegen/src/main/resources/rails5/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/rails5-petstore-server.sh b/bin/rails5-petstore-server.sh index 28b3ca3069b..9997a83f6a7 100755 --- a/bin/rails5-petstore-server.sh +++ b/bin/rails5-petstore-server.sh @@ -25,7 +25,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DdebugSupportingFiles" ags="$@ generate -t modules/swagger-codegen/src/main/resources/rails5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l rails5 -o samples/server/petstore/rails5" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/rails5/README.md b/modules/swagger-codegen/src/main/resources/rails5/README.md index c5cb90075a6..841b82ad656 100644 --- a/modules/swagger-codegen/src/main/resources/rails5/README.md +++ b/modules/swagger-codegen/src/main/resources/rails5/README.md @@ -14,7 +14,7 @@ bundle install This sample was generated with the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. ``` -bin/rake db:create +bin/rake db:create db:migrate bin/rails s ``` From 3c252f264ce6ebec7b5fd7e7310b1494f85933fc Mon Sep 17 00:00:00 2001 From: cbornet Date: Thu, 9 Jun 2016 10:21:14 +0200 Subject: [PATCH 49/67] use joda in jersey1/jersey2 client sample --- bin/java-petstore-jersey2.sh | 4 +- bin/java-petstore.sh | 4 +- bin/windows/java-petstore.bat | 2 +- .../java/default/.swagger-codegen-ignore | 23 + samples/client/petstore/java/default/LICENSE | 201 +++++++++ .../default/docs/AdditionalPropertiesClass.md | 11 + .../petstore/java/default/docs/Animal.md | 1 + .../petstore/java/default/docs/ArrayTest.md | 12 + .../client/petstore/java/default/docs/Cat.md | 1 + .../client/petstore/java/default/docs/Dog.md | 1 + .../petstore/java/default/docs/FakeApi.md | 12 +- .../petstore/java/default/docs/FormatTest.md | 4 +- ...dPropertiesAndAdditionalPropertiesClass.md | 12 + .../client/petstore/java/default/docs/Name.md | 1 + .../petstore/java/default/docs/Order.md | 2 +- .../java/default/docs/ReadOnlyFirst.md | 11 + samples/client/petstore/java/default/gradlew | 0 .../java/default/petstore_profiling.output | 23 - samples/client/petstore/java/default/pom.xml | 4 +- .../java/io/swagger/client/ApiClient.java | 7 +- .../java/io/swagger/client/api/FakeApi.java | 9 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../model/AdditionalPropertiesClass.java | 97 +++++ .../java/io/swagger/client/model/Animal.java | 24 +- .../io/swagger/client/model/ArrayTest.java | 116 +++++ .../java/io/swagger/client/model/Cat.java | 22 +- .../java/io/swagger/client/model/Dog.java | 22 +- .../io/swagger/client/model/FormatTest.java | 19 +- ...ropertiesAndAdditionalPropertiesClass.java | 119 ++++++ .../java/io/swagger/client/model/Name.java | 14 +- .../java/io/swagger/client/model/Order.java | 10 +- .../swagger/client/model/ReadOnlyFirst.java | 84 ++++ .../java/io/swagger/client/ApiClientTest.java | 1 + .../io/swagger/client/api/PetApiTest.java | 401 ++++++++++++------ .../io/swagger/client/api/StoreApiTest.java | 154 ++++--- .../io/swagger/client/api/UserApiTest.java | 187 +++----- .../io/swagger/petstore/test/PetApiTest.java | 306 ------------- .../swagger/petstore/test/StoreApiTest.java | 100 ----- .../io/swagger/petstore/test/UserApiTest.java | 88 ---- .../client/petstore/java/jersey2/build.gradle | 2 +- .../petstore/java/jersey2/docs/FakeApi.md | 8 +- .../petstore/java/jersey2/docs/FormatTest.md | 4 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../petstore/java/jersey2/docs/Order.md | 2 +- samples/client/petstore/java/jersey2/gradlew | 0 .../client/petstore/java/jersey2/hello.txt | 1 - .../java/io/swagger/client/ApiClient.java | 7 +- .../java/io/swagger/client/ApiException.java | 2 +- .../java/io/swagger/client/Configuration.java | 2 +- .../src/main/java/io/swagger/client/JSON.java | 2 +- .../src/main/java/io/swagger/client/Pair.java | 2 +- .../java/io/swagger/client/StringUtil.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 7 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../java/io/swagger/client/api/StoreApi.java | 2 +- .../java/io/swagger/client/api/UserApi.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 2 +- .../io/swagger/client/auth/HttpBasicAuth.java | 2 +- .../java/io/swagger/client/auth/OAuth.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../java/io/swagger/client/model/Animal.java | 2 +- .../io/swagger/client/model/AnimalFarm.java | 2 +- .../io/swagger/client/model/ArrayTest.java | 2 +- .../java/io/swagger/client/model/Cat.java | 2 +- .../io/swagger/client/model/Category.java | 2 +- .../java/io/swagger/client/model/Dog.java | 2 +- .../io/swagger/client/model/EnumTest.java | 2 +- .../io/swagger/client/model/FormatTest.java | 21 +- ...ropertiesAndAdditionalPropertiesClass.java | 12 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../io/swagger/client/model/ModelReturn.java | 2 +- .../java/io/swagger/client/model/Name.java | 2 +- .../java/io/swagger/client/model/Order.java | 12 +- .../java/io/swagger/client/model/Pet.java | 2 +- .../swagger/client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../java/io/swagger/client/model/Tag.java | 2 +- .../java/io/swagger/client/model/User.java | 2 +- .../java/io/swagger/client/ApiClientTest.java | 1 + .../test/java/io/swagger/client/JSONTest.java | 21 +- .../io/swagger/client/api/PetApiTest.java | 383 +++++++++++------ .../io/swagger/client/api/StoreApiTest.java | 153 ++++--- .../io/swagger/client/api/UserApiTest.java | 187 +++----- .../io/swagger/petstore/test/PetApiTest.java | 288 ------------- .../swagger/petstore/test/StoreApiTest.java | 98 ----- .../io/swagger/petstore/test/UserApiTest.java | 88 ---- 87 files changed, 1714 insertions(+), 1750 deletions(-) create mode 100644 samples/client/petstore/java/default/.swagger-codegen-ignore create mode 100644 samples/client/petstore/java/default/LICENSE create mode 100644 samples/client/petstore/java/default/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/default/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/default/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/default/docs/ReadOnlyFirst.md mode change 100755 => 100644 samples/client/petstore/java/default/gradlew delete mode 100644 samples/client/petstore/java/default/petstore_profiling.output create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ReadOnlyFirst.java delete mode 100644 samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/UserApiTest.java mode change 100755 => 100644 samples/client/petstore/java/jersey2/gradlew delete mode 100644 samples/client/petstore/java/jersey2/hello.txt delete mode 100644 samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/UserApiTest.java diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index a715e7ff545..014af660cd8 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DdateLibrary=joda,hideGenerationTimestamp=true" +rm -rf samples/client/petstore/java/jersey2/src/main +find samples/client/petstore/java/jersey2 -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh index ed80c841df6..576798ee24b 100755 --- a/bin/java-petstore.sh +++ b/bin/java-petstore.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DdateLibrary=joda,hideGenerationTimestamp=true" +rm -rf samples/client/petstore/java/default/src/main +find samples/client/petstore/java/default -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/java-petstore.bat b/bin/windows/java-petstore.bat index 18544cbad36..02a81e1adbf 100755 --- a/bin/windows/java-petstore.bat +++ b/bin/windows/java-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java +set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java -DdateLibrary=joda,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/samples/client/petstore/java/default/.swagger-codegen-ignore b/samples/client/petstore/java/default/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/java/default/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/java/default/LICENSE b/samples/client/petstore/java/default/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/java/default/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/java/default/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/default/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..0437c4dd8cc --- /dev/null +++ b/samples/client/petstore/java/default/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ + +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Animal.md b/samples/client/petstore/java/default/docs/Animal.md index 3ecb7f991f3..b3f325c3524 100644 --- a/samples/client/petstore/java/default/docs/Animal.md +++ b/samples/client/petstore/java/default/docs/Animal.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **className** | **String** | | +**color** | **String** | | [optional] diff --git a/samples/client/petstore/java/default/docs/ArrayTest.md b/samples/client/petstore/java/default/docs/ArrayTest.md new file mode 100644 index 00000000000..9feee16427f --- /dev/null +++ b/samples/client/petstore/java/default/docs/ArrayTest.md @@ -0,0 +1,12 @@ + +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Cat.md b/samples/client/petstore/java/default/docs/Cat.md index 373af540c41..be6e56fa8ce 100644 --- a/samples/client/petstore/java/default/docs/Cat.md +++ b/samples/client/petstore/java/default/docs/Cat.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **className** | **String** | | +**color** | **String** | | [optional] **declawed** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/default/docs/Dog.md b/samples/client/petstore/java/default/docs/Dog.md index a1d638d3bad..71a7dbe809e 100644 --- a/samples/client/petstore/java/default/docs/Dog.md +++ b/samples/client/petstore/java/default/docs/Dog.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **className** | **String** | | +**color** | **String** | | [optional] **breed** | **String** | | [optional] diff --git a/samples/client/petstore/java/default/docs/FakeApi.md b/samples/client/petstore/java/default/docs/FakeApi.md index b4e5f34974a..0c1f55a0902 100644 --- a/samples/client/petstore/java/default/docs/FakeApi.md +++ b/samples/client/petstore/java/default/docs/FakeApi.md @@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None Long int64 = 789L; // Long | None Float _float = 3.4F; // Float | None byte[] binary = B; // byte[] | None -Date date = new Date(); // Date | None -Date dateTime = new Date(); // Date | None +LocalDate date = new LocalDate(); // LocalDate | None +DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -56,8 +56,8 @@ Name | Type | Description | Notes **int64** | **Long**| None | [optional] **_float** | **Float**| None | [optional] **binary** | **byte[]**| None | [optional] - **date** | **Date**| None | [optional] - **dateTime** | **Date**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] ### Return type @@ -70,6 +70,6 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 diff --git a/samples/client/petstore/java/default/docs/FormatTest.md b/samples/client/petstore/java/default/docs/FormatTest.md index dc2b559dad2..44de7d9511a 100644 --- a/samples/client/petstore/java/default/docs/FormatTest.md +++ b/samples/client/petstore/java/default/docs/FormatTest.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **string** | **String** | | [optional] **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | -**dateTime** | [**Date**](Date.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/default/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/default/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..e3487bcc501 --- /dev/null +++ b/samples/client/petstore/java/default/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ + +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/default/docs/Name.md b/samples/client/petstore/java/default/docs/Name.md index 5390a15e9cd..ce2fb4dee50 100644 --- a/samples/client/petstore/java/default/docs/Name.md +++ b/samples/client/petstore/java/default/docs/Name.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **name** | **Integer** | | **snakeCase** | **Integer** | | [optional] **property** | **String** | | [optional] +**_123Number** | **Integer** | | [optional] diff --git a/samples/client/petstore/java/default/docs/Order.md b/samples/client/petstore/java/default/docs/Order.md index 29ca3ddbc6b..a1089f5384e 100644 --- a/samples/client/petstore/java/default/docs/Order.md +++ b/samples/client/petstore/java/default/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**Date**](Date.md) | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/default/docs/ReadOnlyFirst.md b/samples/client/petstore/java/default/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..426b7cde95a --- /dev/null +++ b/samples/client/petstore/java/default/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ + +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**baz** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/default/gradlew b/samples/client/petstore/java/default/gradlew old mode 100755 new mode 100644 diff --git a/samples/client/petstore/java/default/petstore_profiling.output b/samples/client/petstore/java/default/petstore_profiling.output deleted file mode 100644 index 21562548765..00000000000 --- a/samples/client/petstore/java/default/petstore_profiling.output +++ /dev/null @@ -1,23 +0,0 @@ -# To run the profiling: -# mvn compile test-compile exec:java -Dexec.classpathScope=test -Dexec.mainClass="io.swagger.PetstoreProfiling" - -0: ADD PET => 0.987609128 -0: GET PET => 0.450873167 -0: UPDATE PET => 0.447611998 -0: DELETE PET => 0.397707664 -1: ADD PET => 0.395333121 -1: GET PET => 0.381760136 -1: UPDATE PET => 0.395245221 -1: DELETE PET => 0.384854324 -2: ADD PET => 0.400336227 -2: GET PET => 0.378959921 -2: UPDATE PET => 0.397619284 -2: DELETE PET => 0.383307393 -3: ADD PET => 0.385764805 -3: GET PET => 0.40218304 -3: UPDATE PET => 0.387887511 -3: DELETE PET => 0.398063489 -4: ADD PET => 0.384757488 -4: GET PET => 0.398719713 -4: UPDATE PET => 0.383319052 -4: DELETE PET => 0.408516644 diff --git a/samples/client/petstore/java/default/pom.xml b/samples/client/petstore/java/default/pom.xml index 2ea4060bc3a..0b24e120100 100644 --- a/samples/client/petstore/java/default/pom.xml +++ b/samples/client/petstore/java/default/pom.xml @@ -97,8 +97,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 1.7 + 1.7 diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java index 50c0e8db641..ba846404249 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java @@ -41,7 +41,7 @@ import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T15:55:38.841+08:00") + public class ApiClient { private Map defaultHeaderMap = new HashMap(); private String basePath = "http://petstore.swagger.io/v2"; @@ -76,12 +76,7 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); authentications.put("petstore_auth", new OAuth()); - authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); - authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("test_http_basic", new HttpBasicAuth()); - authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); - authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java index 40ee5e2774f..dc9faf57ea6 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,8 +8,9 @@ import io.swagger.client.Configuration; import io.swagger.client.model.*; import io.swagger.client.Pair; -import java.util.Date; +import org.joda.time.LocalDate; import java.math.BigDecimal; +import org.joda.time.DateTime; import java.util.ArrayList; @@ -54,7 +55,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -113,12 +114,12 @@ if (password != null) localVarFormParams.put("password", password); final String[] localVarAccepts = { - "application/xml", "application/json" + "application/xml; charset=utf-8", "application/json; charset=utf-8" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/xml; charset=utf-8", "application/json; charset=utf-8" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java index 0816f9a2961..50a6ecff737 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import io.swagger.client.model.*; import io.swagger.client.Pair; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.ModelApiResponse; +import java.io.File; import java.util.ArrayList; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..ccaba7709c4 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,97 @@ +package io.swagger.client.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + + private Map mapProperty = new HashMap(); + private Map> mapOfMapProperty = new HashMap>(); + + + /** + **/ + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("map_property") + public Map getMapProperty() { + return mapProperty; + } + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + + /** + **/ + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("map_of_map_property") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java index 365f0110b78..25c7d3e421c 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Animal.java @@ -14,6 +14,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { private String className = null; + private String color = "red"; /** @@ -33,6 +34,23 @@ public class Animal { } + /** + **/ + public Animal color(String color) { + this.color = color; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("color") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -42,12 +60,13 @@ public class Animal { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className); + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); } @Override public int hashCode() { - return Objects.hash(className); + return Objects.hash(className, color); } @Override @@ -56,6 +75,7 @@ public class Animal { sb.append("class Animal {\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ArrayTest.java new file mode 100644 index 00000000000..6c1eb23d8d0 --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ArrayTest.java @@ -0,0 +1,116 @@ +package io.swagger.client.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + + +/** + * ArrayTest + */ + +public class ArrayTest { + + private List arrayOfString = new ArrayList(); + private List> arrayArrayOfInteger = new ArrayList>(); + private List> arrayArrayOfModel = new ArrayList>(); + + + /** + **/ + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("array_of_string") + public List getArrayOfString() { + return arrayOfString; + } + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + /** + **/ + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("array_array_of_integer") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + /** + **/ + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("array_array_of_model") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java index 21c54aff204..5ef9e23bd96 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Cat.java @@ -15,6 +15,7 @@ import io.swagger.client.model.Animal; public class Cat extends Animal { private String className = null; + private String color = "red"; private Boolean declawed = null; @@ -35,6 +36,23 @@ public class Cat extends Animal { } + /** + **/ + public Cat color(String color) { + this.color = color; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("color") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + + /** **/ public Cat declawed(Boolean declawed) { @@ -62,13 +80,14 @@ public class Cat extends Animal { } Cat cat = (Cat) o; return Objects.equals(this.className, cat.className) && + Objects.equals(this.color, cat.color) && Objects.equals(this.declawed, cat.declawed) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(className, declawed, super.hashCode()); + return Objects.hash(className, color, declawed, super.hashCode()); } @Override @@ -77,6 +96,7 @@ public class Cat extends Animal { sb.append("class Cat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java index ed5581058c6..4b3cc947cc5 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Dog.java @@ -15,6 +15,7 @@ import io.swagger.client.model.Animal; public class Dog extends Animal { private String className = null; + private String color = "red"; private String breed = null; @@ -35,6 +36,23 @@ public class Dog extends Animal { } + /** + **/ + public Dog color(String color) { + this.color = color; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("color") + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + + /** **/ public Dog breed(String breed) { @@ -62,13 +80,14 @@ public class Dog extends Animal { } Dog dog = (Dog) o; return Objects.equals(this.className, dog.className) && + Objects.equals(this.color, dog.color) && Objects.equals(this.breed, dog.breed) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(className, breed, super.hashCode()); + return Objects.hash(className, color, breed, super.hashCode()); } @Override @@ -77,6 +96,7 @@ public class Dog extends Animal { sb.append("class Dog {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java index c01974880ae..79376150017 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/FormatTest.java @@ -6,7 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; /** @@ -24,8 +25,8 @@ public class FormatTest { private String string = null; private byte[] _byte = null; private byte[] binary = null; - private Date date = null; - private Date dateTime = null; + private LocalDate date = null; + private DateTime dateTime = null; private String uuid = null; private String password = null; @@ -195,34 +196,34 @@ public class FormatTest { /** **/ - public FormatTest date(Date date) { + public FormatTest date(LocalDate date) { this.date = date; return this; } @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ - public FormatTest dateTime(Date dateTime) { + public FormatTest dateTime(DateTime dateTime) { this.dateTime = dateTime; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("dateTime") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..2f0972bf41e --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,119 @@ +package io.swagger.client.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.Animal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.joda.time.DateTime; + + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + + private String uuid = null; + private DateTime dateTime = null; + private Map map = new HashMap(); + + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + this.uuid = uuid; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("dateTime") + public DateTime getDateTime() { + return dateTime; + } + public void setDateTime(DateTime dateTime) { + this.dateTime = dateTime; + } + + + /** + **/ + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("map") + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java index 60b26b55658..1ba2cc5e4a3 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Name.java @@ -17,6 +17,7 @@ public class Name { private Integer name = null; private Integer snakeCase = null; private String property = null; + private Integer _123Number = null; /** @@ -60,6 +61,13 @@ public class Name { } + @ApiModelProperty(example = "null", value = "") + @JsonProperty("123Number") + public Integer get123Number() { + return _123Number; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -71,12 +79,13 @@ public class Name { Name name = (Name) o; return Objects.equals(this.name, name.name) && Objects.equals(this.snakeCase, name.snakeCase) && - Objects.equals(this.property, name.property); + Objects.equals(this.property, name.property) && + Objects.equals(this._123Number, name._123Number); } @Override public int hashCode() { - return Objects.hash(name, snakeCase, property); + return Objects.hash(name, snakeCase, property, _123Number); } @Override @@ -87,6 +96,7 @@ public class Name { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java index ed5739592a3..cec651e73a6 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Order.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; /** @@ -18,7 +18,7 @@ public class Order { private Long id = null; private Long petId = null; private Integer quantity = null; - private Date shipDate = null; + private DateTime shipDate = null; /** * Order Status @@ -98,17 +98,17 @@ public class Order { /** **/ - public Order shipDate(Date shipDate) { + public Order shipDate(DateTime shipDate) { this.shipDate = shipDate; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..fdc3587df0e --- /dev/null +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -0,0 +1,84 @@ +package io.swagger.client.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + + private String bar = null; + private String baz = null; + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("bar") + public String getBar() { + return bar; + } + + + /** + **/ + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("baz") + public String getBaz() { + return baz; + } + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java index 47f004c283b..19b55257d0c 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/client/ApiClientTest.java @@ -111,6 +111,7 @@ public class ApiClientTest { } } + @Ignore("There is no more basic auth in petstore security definitions") @Test public void testSetUsernameAndPassword() { HttpBasicAuth auth = null; diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/PetApiTest.java index c25e0d8bfa2..e75a9c7e7da 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,155 +1,306 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; -import java.io.File; -import org.junit.Test; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.datatype.joda.*; +import io.swagger.TestUtils; + +import io.swagger.client.*; +import io.swagger.client.api.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; +import static org.junit.Assert.*; + public class PetApiTest { + private PetApi api; + private ObjectMapper mapper; - private final PetApi api = new PetApi(); - - - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void addPetTest() throws ApiException { - Pet body = null; - // api.addPet(body); - - // TODO: test validations + @Before + public void setup() { + api = new PetApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deletePetTest() throws ApiException { - Long petId = null; - String apiKey = null; - // api.deletePet(petId, apiKey); - // TODO: test validations - } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ @Test - public void findPetsByStatusTest() throws ApiException { - List status = null; - // List response = api.findPetsByStatus(status); + public void testApiClient() { + // the default api client is used + assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); - // TODO: test validations + ApiClient oldClient = api.getApiClient(); + + ApiClient newClient = new ApiClient(); + newClient.setBasePath("http://example.com"); + newClient.setDebugging(true); + + // set api client via constructor + api = new PetApi(newClient); + assertNotNull(api.getApiClient()); + assertEquals("http://example.com", api.getApiClient().getBasePath()); + assertTrue(api.getApiClient().isDebugging()); + + // set api client via setter method + api.setApiClient(oldClient); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void findPetsByTagsTest() throws ApiException { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testCreateAndGetPet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void getPetByIdTest() throws ApiException { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testCreateAndGetPetWithByteArray() throws Exception { + Pet pet = createRandomPet(); + byte[] bytes = serializeJson(pet).getBytes(); + api.addPetUsingByteArray(bytes); - // TODO: test validations + byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); + Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void updatePetTest() throws ApiException { - Pet body = null; - // api.updatePet(body); + public void testGetPetByIdInObject() throws Exception { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("pet " + pet.getId()); - // TODO: test validations + Category category = new Category(); + category.setId(TestUtils.nextId()); + category.setName("category " + category.getId()); + pet.setCategory(category); + + pet.setStatus(Pet.StatusEnum.PENDING); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); + pet.setPhotoUrls(photos); + + api.addPet(pet); + + InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); + assertEquals(pet.getId(), fetched.getId()); + assertEquals(pet.getName(), fetched.getName()); + + Object categoryObj = fetched.getCategory(); + assertNotNull(categoryObj); + assertTrue(categoryObj instanceof Map); + + Map categoryMap = (Map) categoryObj; + Object categoryIdObj = categoryMap.get("id"); + assertTrue(categoryIdObj instanceof Integer); + Integer categoryIdInt = (Integer) categoryIdObj; + assertEquals(category.getId(), Long.valueOf(categoryIdInt)); + assertEquals(category.getName(), categoryMap.get("name")); } - - /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + */ + @Test - public void updatePetWithFormTest() throws ApiException { - Long petId = null; - String name = null; - String status = null; - // api.updatePetWithForm(petId, name, status); + public void testUpdatePet() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); - // TODO: test validations + api.updatePet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void uploadFileTest() throws ApiException { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testFindPetsByStatus() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + api.updatePet(pet); + + List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); + } + + @Test + public void testFindPetsByTags() throws Exception { + Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet); + + List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + } + + @Test + public void testUpdatePetWithForm() throws Exception { + Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); + } + + @Test + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (ApiException e) { + assertEquals(404, e.getCode()); + } + } + + @Test + public void testUploadFile() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); + } + + @Test + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; + } + + private String serializeJson(Object o) { + if (mapper == null) { + mapper = createObjectMapper(); + } + try { + return mapper.writeValueAsString(o); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private T deserializeJson(String json, Class klass) { + if (mapper == null) { + mapper = createObjectMapper(); + } + try { + return mapper.readValue(json, klass); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private ObjectMapper createObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.registerModule(new JodaModule()); + return mapper; } - } diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/StoreApiTest.java index 31abbbeae4e..51779f265f0 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,83 +1,103 @@ package io.swagger.client.api; +import io.swagger.TestUtils; + import io.swagger.client.ApiException; -import io.swagger.client.model.Order; -import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import io.swagger.client.*; +import io.swagger.client.api.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.lang.reflect.Field; import java.util.Map; +import java.text.SimpleDateFormat; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for StoreApi - */ public class StoreApiTest { + StoreApi api = null; - private final StoreApi api = new StoreApi(); - - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deleteOrderTest() throws ApiException { - String orderId = null; - // api.deleteOrder(orderId); - - // TODO: test validations + @Before + public void setup() { + api = new StoreApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); + // set custom date format that is used by the petstore server + api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getInventoryTest() throws ApiException { - // Map response = api.getInventory(); - // TODO: test validations - } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ @Test - public void getOrderByIdTest() throws ApiException { - Long orderId = null; - // Order response = api.getOrderById(orderId); - - // TODO: test validations + public void testGetInventory() throws Exception { + Map inventory = api.getInventory(); + assertTrue(inventory.keySet().size() > 0); } - - /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void placeOrderTest() throws ApiException { - Order body = null; - // Order response = api.placeOrder(body); + public void testGetInventoryInObject() throws Exception { + Object inventoryObj = api.getInventoryInObject(); + assertTrue(inventoryObj instanceof Map); - // TODO: test validations + Map inventoryMap = (Map) inventoryObj; + assertTrue(inventoryMap.keySet().size() > 0); + + Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); + assertTrue(firstEntry.getKey() instanceof String); + assertTrue(firstEntry.getValue() instanceof Integer); + } + */ + + @Test + public void testPlaceOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); + } + + @Test + public void testDeleteOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(fetched.getId(), order.getId()); + + api.deleteOrder(String.valueOf(order.getId())); + + try { + api.getOrderById(order.getId()); + // fail("expected an error"); + } catch (ApiException e) { + // ok + } + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, TestUtils.nextId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/UserApiTest.java index 7e96762ff4e..c7fb92d2552 100644 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/default/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,149 +1,88 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.User; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import io.swagger.client.api.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.util.Arrays; + +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for UserApi - */ public class UserApiTest { + UserApi api = null; - private final UserApi api = new UserApi(); - - - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUserTest() throws ApiException { - User body = null; - // api.createUser(body); - - // TODO: test validations + @Before + public void setup() { + api = new UserApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUsersWithArrayInputTest() throws ApiException { - List body = null; - // api.createUsersWithArrayInput(body); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ @Test - public void createUsersWithListInputTest() throws ApiException { - List body = null; - // api.createUsersWithListInput(body); + public void testCreateUser() throws Exception { + User user = createUser(); - // TODO: test validations + api.createUser(user); + + User fetched = api.getUserByName(user.getUsername()); + assertEquals(user.getId(), fetched.getId()); } - - /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void deleteUserTest() throws ApiException { - String username = null; - // api.deleteUser(username); + public void testCreateUsersWithArray() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void getUserByNameTest() throws ApiException { - String username = null; - // User response = api.getUserByName(username); + public void testCreateUsersWithList() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void loginUserTest() throws ApiException { - String username = null; - String password = null; - // String response = api.loginUser(username, password); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user); - // TODO: test validations + String token = api.loginUser(user.getUsername(), user.getPassword()); + assertTrue(token.startsWith("logged in user session:")); } - - /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void logoutUserTest() throws ApiException { - // api.logoutUser(); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser(); } - - /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updateUserTest() throws ApiException { - String username = null; - User body = null; - // api.updateUser(username, body); - // TODO: test validations + private User createUser() { + User user = new User(); + user.setId(TestUtils.nextId()); + user.setUsername("fred" + user.getId()); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); + + return user; } - } diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index 9e927a69ba2..00000000000 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,306 +0,0 @@ -package io.swagger.petstore.test; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.joda.*; - -import io.swagger.TestUtils; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PetApiTest { - private PetApi api; - private ObjectMapper mapper; - - @Before - public void setup() { - api = new PetApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testApiClient() { - // the default api client is used - assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - - ApiClient oldClient = api.getApiClient(); - - ApiClient newClient = new ApiClient(); - newClient.setBasePath("http://example.com"); - newClient.setDebugging(true); - - // set api client via constructor - api = new PetApi(newClient); - assertNotNull(api.getApiClient()); - assertEquals("http://example.com", api.getApiClient().getBasePath()); - assertTrue(api.getApiClient().isDebugging()); - - // set api client via setter method - api.setApiClient(oldClient); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - /* - @Test - public void testCreateAndGetPetWithByteArray() throws Exception { - Pet pet = createRandomPet(); - byte[] bytes = serializeJson(pet).getBytes(); - api.addPetUsingByteArray(bytes); - - byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); - Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testGetPetByIdInObject() throws Exception { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("pet " + pet.getId()); - - Category category = new Category(); - category.setId(TestUtils.nextId()); - category.setName("category " + category.getId()); - pet.setCategory(category); - - pet.setStatus(Pet.StatusEnum.PENDING); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); - pet.setPhotoUrls(photos); - - api.addPet(pet); - - InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); - assertEquals(pet.getId(), fetched.getId()); - assertEquals(pet.getName(), fetched.getName()); - - Object categoryObj = fetched.getCategory(); - assertNotNull(categoryObj); - assertTrue(categoryObj instanceof Map); - - Map categoryMap = (Map) categoryObj; - Object categoryIdObj = categoryMap.get("id"); - assertTrue(categoryIdObj instanceof Integer); - Integer categoryIdInt = (Integer) categoryIdObj; - assertEquals(category.getId(), Long.valueOf(categoryIdInt)); - assertEquals(category.getName(), categoryMap.get("name")); - } - */ - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet); - - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - - api.updatePetWithForm(fetched.getId(), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (ApiException e) { - assertEquals(404, e.getCode()); - } - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } - - private String serializeJson(Object o) { - if (mapper == null) { - mapper = createObjectMapper(); - } - try { - return mapper.writeValueAsString(o); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private T deserializeJson(String json, Class klass) { - if (mapper == null) { - mapper = createObjectMapper(); - } - try { - return mapper.readValue(json, klass); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private ObjectMapper createObjectMapper() { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - mapper.registerModule(new JodaModule()); - return mapper; - } -} diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index 4b33d380f14..00000000000 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,100 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiException; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.lang.reflect.Field; -import java.util.Map; -import java.text.SimpleDateFormat; - -import org.junit.*; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new StoreApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - // set custom date format that is used by the petstore server - api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory(); - assertTrue(inventory.keySet().size() > 0); - } - - /* - @Test - public void testGetInventoryInObject() throws Exception { - Object inventoryObj = api.getInventoryInObject(); - assertTrue(inventoryObj instanceof Map); - - Map inventoryMap = (Map) inventoryObj; - assertTrue(inventoryMap.keySet().size() > 0); - - Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); - assertTrue(firstEntry.getKey() instanceof String); - assertTrue(firstEntry.getValue() instanceof Integer); - } - */ - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())); - - try { - api.getOrderById(order.getId()); - // fail("expected an error"); - } catch (ApiException e) { - // ok - } - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, TestUtils.nextId()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 195e5c1e861..00000000000 --- a/samples/client/petstore/java/default/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new UserApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user); - - User fetched = api.getUserByName(user.getUsername()); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - String token = api.loginUser(user.getUsername(), user.getPassword()); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred" + user.getId()); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2/build.gradle index 9c98d11c4cd..6574f746d05 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.0" + swagger_annotations_version = "1.5.8" jackson_version = "2.7.0" jersey_version = "2.22.2" jodatime_version = "2.9.3" diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index 8e15d4d1f69..0c1f55a0902 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None Long int64 = 789L; // Long | None Float _float = 3.4F; // Float | None byte[] binary = B; // byte[] | None -Date date = new Date(); // Date | None -Date dateTime = new Date(); // Date | None +LocalDate date = new LocalDate(); // LocalDate | None +DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -56,8 +56,8 @@ Name | Type | Description | Notes **int64** | **Long**| None | [optional] **_float** | **Float**| None | [optional] **binary** | **byte[]**| None | [optional] - **date** | **Date**| None | [optional] - **dateTime** | **Date**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey2/docs/FormatTest.md b/samples/client/petstore/java/jersey2/docs/FormatTest.md index dc2b559dad2..44de7d9511a 100644 --- a/samples/client/petstore/java/jersey2/docs/FormatTest.md +++ b/samples/client/petstore/java/jersey2/docs/FormatTest.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **string** | **String** | | [optional] **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | -**dateTime** | [**Date**](Date.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 00cc10ca9b3..e3487bcc501 100644 --- a/samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/jersey2/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] -**dateTime** | [**Date**](Date.md) | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2/docs/Order.md b/samples/client/petstore/java/jersey2/docs/Order.md index 29ca3ddbc6b..a1089f5384e 100644 --- a/samples/client/petstore/java/jersey2/docs/Order.md +++ b/samples/client/petstore/java/jersey2/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**Date**](Date.md) | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/jersey2/gradlew b/samples/client/petstore/java/jersey2/gradlew old mode 100755 new mode 100644 diff --git a/samples/client/petstore/java/jersey2/hello.txt b/samples/client/petstore/java/jersey2/hello.txt deleted file mode 100644 index 6769dd60bdf..00000000000 --- a/samples/client/petstore/java/jersey2/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java index bc43cfe670e..d82f0db0239 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java @@ -48,7 +48,7 @@ import io.swagger.client.auth.HttpBasicAuth; import io.swagger.client.auth.ApiKeyAuth; import io.swagger.client.auth.OAuth; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T17:22:31.147+08:00") + public class ApiClient { private Map defaultHeaderMap = new HashMap(); private String basePath = "http://petstore.swagger.io/v2"; @@ -85,12 +85,7 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); authentications.put("petstore_auth", new OAuth()); - authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); - authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("test_http_basic", new HttpBasicAuth()); - authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); - authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java index 00a3321d474..27395e86ba9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java @@ -3,7 +3,7 @@ package io.swagger.client; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java index bbfa1a1c4ee..19b0ebeae4e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java index f38b16d55ad..d6f725b2caa 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/JSON.java @@ -8,7 +8,7 @@ import java.text.DateFormat; import javax.ws.rs.ext.ContextResolver; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class JSON implements ContextResolver { private ObjectMapper mapper; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java index 863136c9ef6..d8d32210b10 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Pair { private String name = ""; private String value = ""; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java index 9bd7767e8a2..1383dd0decb 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java index e120b12d42c..ce4830a1f77 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,15 +7,16 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class FakeApi { private ApiClient apiClient; @@ -52,7 +53,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java index f09defffe3c..ad66598406d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java @@ -16,7 +16,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class PetApi { private ApiClient apiClient; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java index 36336fe8c0b..c0c9a166ad7 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/StoreApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class StoreApi { private ApiClient apiClient; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java index 42e08132830..7602f4e2ba9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/UserApi.java @@ -14,7 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class UserApi { private ApiClient apiClient; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6d5c20361ef..6882dbc41c0 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 8bc5686d3c1..64f2c887377 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -9,7 +9,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java index 140ee3d63c9..76d2917f24e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java @@ -5,7 +5,7 @@ import io.swagger.client.Pair; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 4c9d7b51a02..ccaba7709c4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class AdditionalPropertiesClass { private Map mapProperty = new HashMap(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java index 3506eb25298..25c7d3e421c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Animal.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Animal */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java index e035fb41d85..647e3a893e1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -10,7 +10,7 @@ import java.util.List; /** * AnimalFarm */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class AnimalFarm extends ArrayList { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java index 7b4d2bb3cc3..6c1eb23d8d0 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ArrayTest.java @@ -12,7 +12,7 @@ import java.util.List; /** * ArrayTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ArrayTest { private List arrayOfString = new ArrayList(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java index 19d57357959..5ef9e23bd96 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Cat */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Cat extends Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java index 5f8edb7f80f..c6cb703a89e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Category */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Category { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java index 2c01fa4f1a1..4b3cc947cc5 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.client.model.Animal; /** * Dog */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Dog extends Animal { private String className = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java index 08d5c3d617a..1c8657fd3ec 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/EnumTest.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; /** * EnumTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class EnumTest { diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java index 2f80a5dc972..79376150017 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/FormatTest.java @@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; /** * FormatTest */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class FormatTest { private Integer integer = null; @@ -24,8 +25,8 @@ public class FormatTest { private String string = null; private byte[] _byte = null; private byte[] binary = null; - private Date date = null; - private Date dateTime = null; + private LocalDate date = null; + private DateTime dateTime = null; private String uuid = null; private String password = null; @@ -195,34 +196,34 @@ public class FormatTest { /** **/ - public FormatTest date(Date date) { + public FormatTest date(LocalDate date) { this.date = date; return this; } @ApiModelProperty(example = "null", required = true, value = "") @JsonProperty("date") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ - public FormatTest dateTime(Date dateTime) { + public FormatTest dateTime(DateTime dateTime) { this.dateTime = dateTime; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("dateTime") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index c55c44aa4c7..2f0972bf41e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -6,20 +6,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; - private Date dateTime = null; + private DateTime dateTime = null; private Map map = new HashMap(); @@ -42,17 +42,17 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ - public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) { this.dateTime = dateTime; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("dateTime") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index 3a3014b87c0..b2809525c7f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Model200Response { private Integer name = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java index b8e916043e5..32fb86dd323 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ModelApiResponse */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ModelApiResponse { private Integer code = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java index 28df30b73f0..a076d16f964 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ModelReturn.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ModelReturn { private Integer _return = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java index 091e716d948..1ba2cc5e4a3 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Name.java @@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty; * Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Name { private Integer name = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java index 40c54de3071..cec651e73a6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Order.java @@ -6,19 +6,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; /** * Order */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Order { private Long id = null; private Long petId = null; private Integer quantity = null; - private Date shipDate = null; + private DateTime shipDate = null; /** * Order Status @@ -98,17 +98,17 @@ public class Order { /** **/ - public Order shipDate(Date shipDate) { + public Order shipDate(DateTime shipDate) { this.shipDate = shipDate; return this; } @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java index 2ec54dd8d8f..da8b76ad024 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; /** * Pet */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Pet { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 268c6adc65e..fdc3587df0e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class ReadOnlyFirst { private String bar = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java index 3b2003b6e47..24e57756cb2 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * SpecialModelName */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class SpecialModelName { private Long specialPropertyName = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java index 277e48fa0b2..9d3bdd8cb9e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * Tag */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class Tag { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java index d1f924eb2a8..f23553660de 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; /** * User */ -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00") + public class User { private Long id = null; diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java index 47f004c283b..19b55257d0c 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/ApiClientTest.java @@ -111,6 +111,7 @@ public class ApiClientTest { } } + @Ignore("There is no more basic auth in petstore security definitions") @Test public void testSetUsernameAndPassword() { HttpBasicAuth auth = null; diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/JSONTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/JSONTest.java index f10909ab9e7..9386b3d5236 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/JSONTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/JSONTest.java @@ -3,10 +3,10 @@ package io.swagger.client; import io.swagger.client.model.Order; import java.lang.Exception; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.TimeZone; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import org.junit.*; import static org.junit.Assert.*; @@ -23,26 +23,23 @@ public class JSONTest { @Test public void testDefaultDate() throws Exception { - final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + final DateTimeFormatter dateFormat = ISODateTimeFormat.dateTime(); final String dateStr = "2015-11-07T14:11:05.267Z"; - order.setShipDate(dateFormat.parse(dateStr)); + order.setShipDate(dateFormat.parseDateTime(dateStr)); String str = json.getContext(null).writeValueAsString(order); Order o = json.getContext(null).readValue(str, Order.class); - assertEquals(dateStr, dateFormat.format(o.getShipDate())); + assertEquals(dateStr, dateFormat.print(o.getShipDate())); } @Test public void testCustomDate() throws Exception { - final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); - dateFormat.setTimeZone(TimeZone.getTimeZone("GMT-2")); + final DateTimeFormatter dateFormat = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.forID("Etc/GMT+2")); final String dateStr = "2015-11-07T14:11:05-02:00"; - order.setShipDate(dateFormat.parse(dateStr)); + order.setShipDate(dateFormat.parseDateTime(dateStr)); - json.setDateFormat(dateFormat); String str = json.getContext(null).writeValueAsString(order); Order o = json.getContext(null).readValue(str, Order.class); - assertEquals(dateStr, dateFormat.format(o.getShipDate())); + assertEquals(dateStr, dateFormat.print(o.getShipDate())); } } \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/PetApiTest.java index c25e0d8bfa2..7f4d27c8b77 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,155 +1,288 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; -import java.io.File; -import org.junit.Test; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.TestUtils; + +import io.swagger.client.*; +import io.swagger.client.api.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; +import static org.junit.Assert.*; + public class PetApiTest { + PetApi api = null; - private final PetApi api = new PetApi(); - - - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void addPetTest() throws ApiException { - Pet body = null; - // api.addPet(body); - - // TODO: test validations + @Before + public void setup() { + api = new PetApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deletePetTest() throws ApiException { - Long petId = null; - String apiKey = null; - // api.deletePet(petId, apiKey); - // TODO: test validations - } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ @Test - public void findPetsByStatusTest() throws ApiException { - List status = null; - // List response = api.findPetsByStatus(status); + public void testApiClient() { + // the default api client is used + assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); - // TODO: test validations + ApiClient oldClient = api.getApiClient(); + + ApiClient newClient = new ApiClient(); + newClient.setBasePath("http://example.com"); + newClient.setDebugging(true); + + // set api client via constructor + api = new PetApi(newClient); + assertNotNull(api.getApiClient()); + assertEquals("http://example.com", api.getApiClient().getBasePath()); + assertTrue(api.getApiClient().isDebugging()); + + // set api client via setter method + api.setApiClient(oldClient); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void findPetsByTagsTest() throws ApiException { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testCreateAndGetPet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void getPetByIdTest() throws ApiException { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testCreateAndGetPetWithByteArray() throws Exception { + Pet pet = createRandomPet(); + byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes(); + api.addPetUsingByteArray(bytes); - // TODO: test validations + byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); + Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class, api.getApiClient()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void updatePetTest() throws ApiException { - Pet body = null; - // api.updatePet(body); + public void testGetPetByIdInObject() throws Exception { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("pet " + pet.getId()); - // TODO: test validations + Category category = new Category(); + category.setId(TestUtils.nextId()); + category.setName("category " + category.getId()); + pet.setCategory(category); + + pet.setStatus(Pet.StatusEnum.PENDING); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); + pet.setPhotoUrls(photos); + + api.addPet(pet); + + InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); + assertEquals(pet.getId(), fetched.getId()); + assertEquals(pet.getName(), fetched.getName()); + + Object categoryObj = fetched.getCategory(); + assertNotNull(categoryObj); + assertTrue(categoryObj instanceof Map); + + Map categoryMap = (Map) categoryObj; + Object categoryIdObj = categoryMap.get("id"); + assertTrue(categoryIdObj instanceof Integer); + Integer categoryIdInt = (Integer) categoryIdObj; + assertEquals(category.getId(), Long.valueOf(categoryIdInt)); + assertEquals(category.getName(), categoryMap.get("name")); } - - /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + */ + @Test - public void updatePetWithFormTest() throws ApiException { - Long petId = null; - String name = null; - String status = null; - // api.updatePetWithForm(petId, name, status); + public void testUpdatePet() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); - // TODO: test validations + api.updatePet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void uploadFileTest() throws ApiException { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testFindPetsByStatus() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + api.updatePet(pet); + + List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); + } + + @Test + public void testFindPetsByTags() throws Exception { + Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet); + + List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + } + + @Test + public void testUpdatePetWithForm() throws Exception { + Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); + } + + @Test + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (ApiException e) { + assertEquals(404, e.getCode()); + } + } + + @Test + public void testUploadFile() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); + } + + @Test + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; + } + + private String serializeJson(Object o, ApiClient apiClient) { + ObjectMapper mapper = apiClient.getJSON().getContext(null); + try { + return mapper.writeValueAsString(o); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private T deserializeJson(String json, Class klass, ApiClient apiClient) { + ObjectMapper mapper = apiClient.getJSON().getContext(null); + try { + return mapper.readValue(json, klass); + } catch (Exception e) { + throw new RuntimeException(e); + } } - } diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/StoreApiTest.java index 31abbbeae4e..3cc2442c64d 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,83 +1,100 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.Order; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.lang.reflect.Field; import java.util.Map; +import java.text.SimpleDateFormat; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for StoreApi - */ public class StoreApiTest { + StoreApi api = null; - private final StoreApi api = new StoreApi(); - - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deleteOrderTest() throws ApiException { - String orderId = null; - // api.deleteOrder(orderId); - - // TODO: test validations + @Before + public void setup() { + api = new StoreApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); + // set custom date format that is used by the petstore server + api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getInventoryTest() throws ApiException { - // Map response = api.getInventory(); - // TODO: test validations - } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ @Test - public void getOrderByIdTest() throws ApiException { - Long orderId = null; - // Order response = api.getOrderById(orderId); - - // TODO: test validations + public void testGetInventory() throws Exception { + Map inventory = api.getInventory(); + assertTrue(inventory.keySet().size() > 0); } - - /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void placeOrderTest() throws ApiException { - Order body = null; - // Order response = api.placeOrder(body); + public void testGetInventoryInObject() throws Exception { + Object inventoryObj = api.getInventoryInObject(); + assertTrue(inventoryObj instanceof Map); - // TODO: test validations + Map inventoryMap = (Map) inventoryObj; + assertTrue(inventoryMap.keySet().size() > 0); + + Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); + assertTrue(firstEntry.getKey() instanceof String); + assertTrue(firstEntry.getValue() instanceof Integer); + } + */ + + @Test + public void testPlaceOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); + } + + @Test + public void testDeleteOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(fetched.getId(), order.getId()); + + api.deleteOrder(String.valueOf(order.getId())); + + try { + api.getOrderById(order.getId()); + // fail("expected an error"); + } catch (ApiException e) { + // ok + } + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, TestUtils.nextId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/UserApiTest.java index 7e96762ff4e..c7fb92d2552 100644 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,149 +1,88 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.User; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import io.swagger.client.api.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.util.Arrays; + +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for UserApi - */ public class UserApiTest { + UserApi api = null; - private final UserApi api = new UserApi(); - - - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUserTest() throws ApiException { - User body = null; - // api.createUser(body); - - // TODO: test validations + @Before + public void setup() { + api = new UserApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUsersWithArrayInputTest() throws ApiException { - List body = null; - // api.createUsersWithArrayInput(body); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ @Test - public void createUsersWithListInputTest() throws ApiException { - List body = null; - // api.createUsersWithListInput(body); + public void testCreateUser() throws Exception { + User user = createUser(); - // TODO: test validations + api.createUser(user); + + User fetched = api.getUserByName(user.getUsername()); + assertEquals(user.getId(), fetched.getId()); } - - /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void deleteUserTest() throws ApiException { - String username = null; - // api.deleteUser(username); + public void testCreateUsersWithArray() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void getUserByNameTest() throws ApiException { - String username = null; - // User response = api.getUserByName(username); + public void testCreateUsersWithList() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void loginUserTest() throws ApiException { - String username = null; - String password = null; - // String response = api.loginUser(username, password); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user); - // TODO: test validations + String token = api.loginUser(user.getUsername(), user.getPassword()); + assertTrue(token.startsWith("logged in user session:")); } - - /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void logoutUserTest() throws ApiException { - // api.logoutUser(); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser(); } - - /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updateUserTest() throws ApiException { - String username = null; - User body = null; - // api.updateUser(username, body); - // TODO: test validations + private User createUser() { + User user = new User(); + user.setId(TestUtils.nextId()); + user.setUsername("fred" + user.getId()); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); + + return user; } - } diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index 51583853257..00000000000 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,288 +0,0 @@ -package io.swagger.petstore.test; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.swagger.TestUtils; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new PetApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testApiClient() { - // the default api client is used - assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - - ApiClient oldClient = api.getApiClient(); - - ApiClient newClient = new ApiClient(); - newClient.setBasePath("http://example.com"); - newClient.setDebugging(true); - - // set api client via constructor - api = new PetApi(newClient); - assertNotNull(api.getApiClient()); - assertEquals("http://example.com", api.getApiClient().getBasePath()); - assertTrue(api.getApiClient().isDebugging()); - - // set api client via setter method - api.setApiClient(oldClient); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - /* - @Test - public void testCreateAndGetPetWithByteArray() throws Exception { - Pet pet = createRandomPet(); - byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes(); - api.addPetUsingByteArray(bytes); - - byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); - Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class, api.getApiClient()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testGetPetByIdInObject() throws Exception { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("pet " + pet.getId()); - - Category category = new Category(); - category.setId(TestUtils.nextId()); - category.setName("category " + category.getId()); - pet.setCategory(category); - - pet.setStatus(Pet.StatusEnum.PENDING); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); - pet.setPhotoUrls(photos); - - api.addPet(pet); - - InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); - assertEquals(pet.getId(), fetched.getId()); - assertEquals(pet.getName(), fetched.getName()); - - Object categoryObj = fetched.getCategory(); - assertNotNull(categoryObj); - assertTrue(categoryObj instanceof Map); - - Map categoryMap = (Map) categoryObj; - Object categoryIdObj = categoryMap.get("id"); - assertTrue(categoryIdObj instanceof Integer); - Integer categoryIdInt = (Integer) categoryIdObj; - assertEquals(category.getId(), Long.valueOf(categoryIdInt)); - assertEquals(category.getName(), categoryMap.get("name")); - } - */ - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet); - - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - - api.updatePetWithForm(fetched.getId(), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (ApiException e) { - assertEquals(404, e.getCode()); - } - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } - - private String serializeJson(Object o, ApiClient apiClient) { - ObjectMapper mapper = apiClient.getJSON().getContext(null); - try { - return mapper.writeValueAsString(o); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private T deserializeJson(String json, Class klass, ApiClient apiClient) { - ObjectMapper mapper = apiClient.getJSON().getContext(null); - try { - return mapper.readValue(json, klass); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index 7ccbdf3f32b..00000000000 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.lang.reflect.Field; -import java.util.Map; -import java.text.SimpleDateFormat; - -import org.junit.*; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new StoreApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - // set custom date format that is used by the petstore server - api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory(); - assertTrue(inventory.keySet().size() > 0); - } - - /* - @Test - public void testGetInventoryInObject() throws Exception { - Object inventoryObj = api.getInventoryInObject(); - assertTrue(inventoryObj instanceof Map); - - Map inventoryMap = (Map) inventoryObj; - assertTrue(inventoryMap.keySet().size() > 0); - - Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); - assertTrue(firstEntry.getKey() instanceof String); - assertTrue(firstEntry.getValue() instanceof Integer); - } - */ - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())); - - try { - api.getOrderById(order.getId()); - // fail("expected an error"); - } catch (ApiException e) { - // ok - } - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, TestUtils.nextId()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 195e5c1e861..00000000000 --- a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new UserApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user); - - User fetched = api.getUserByName(user.getUsername()); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - String token = api.loginUser(user.getUsername(), user.getPassword()); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred" + user.getId()); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} From 61884211bbc5246dce9ccc50769f573c653a16a0 Mon Sep 17 00:00:00 2001 From: cbornet Date: Thu, 9 Jun 2016 18:09:02 +0200 Subject: [PATCH 50/67] add joda support to okhttp-gson and use it in the samples --- bin/java-petstore-okhttp-gson.sh | 4 +- ...gson.bat => java-petstore-okhttp-gson.bat} | 2 +- .../Java/libraries/okhttp-gson/JSON.mustache | 69 +++ .../okhttp-gson/build.gradle.mustache | 1 + .../libraries/okhttp-gson/build.sbt.mustache | 1 + .../Java/libraries/okhttp-gson/pom.mustache | 6 + .../petstore/java/okhttp-gson/build.gradle | 1 + .../petstore/java/okhttp-gson/build.sbt | 1 + .../petstore/java/okhttp-gson/docs/FakeApi.md | 8 +- .../java/okhttp-gson/docs/FormatTest.md | 4 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../petstore/java/okhttp-gson/docs/Order.md | 2 +- .../client/petstore/java/okhttp-gson/gradlew | 0 .../client/petstore/java/okhttp-gson/pom.xml | 53 +- .../java/io/swagger/client/ApiClient.java | 2 +- .../src/main/java/io/swagger/client/JSON.java | 69 +++ .../java/io/swagger/client/api/FakeApi.java | 11 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/FormatTest.java | 15 +- ...ropertiesAndAdditionalPropertiesClass.java | 8 +- .../java/io/swagger/client/model/Order.java | 8 +- .../test/java/io/swagger/client/JSONTest.java | 22 +- .../io/swagger/client/api/PetApiTest.java | 488 +++++++++++++----- .../io/swagger/client/api/StoreApiTest.java | 156 +++--- .../io/swagger/client/api/UserApiTest.java | 186 +++---- .../io/swagger/petstore/test/PetApiTest.java | 398 -------------- .../swagger/petstore/test/StoreApiTest.java | 104 ---- .../io/swagger/petstore/test/UserApiTest.java | 88 ---- 28 files changed, 714 insertions(+), 997 deletions(-) rename bin/windows/{java-petsore-okhttp-gson.bat => java-petstore-okhttp-gson.bat} (90%) mode change 100755 => 100644 samples/client/petstore/java/okhttp-gson/gradlew delete mode 100644 samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/UserApiTest.java diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index b62610b1eff..521c8ca4826 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DdateLibrary=joda,hideGenerationTimestamp=true" +rm -rf samples/client/petstore/java/okhttp-gson/src/main +find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/java-petsore-okhttp-gson.bat b/bin/windows/java-petstore-okhttp-gson.bat similarity index 90% rename from bin/windows/java-petsore-okhttp-gson.bat rename to bin/windows/java-petstore-okhttp-gson.bat index cc2b52e4fa1..e7c1dde982a 100755 --- a/bin/windows/java-petsore-okhttp-gson.bat +++ b/bin/windows/java-petstore-okhttp-gson.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java --library=okhttp-gson -DhideGenerationTimestamp=true +set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java --library=okhttp-gson -DdateLibrary=joda,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache index 8e92e16c0ad..b1be00ea985 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache @@ -12,12 +12,20 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; + public class JSON { private ApiClient apiClient; private Gson gson; @@ -31,6 +39,8 @@ public class JSON { this.apiClient = apiClient; gson = new GsonBuilder() .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); } @@ -143,3 +153,62 @@ class DateAdapter implements JsonSerializer, JsonDeserializer { } } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +/** + * Gson TypeAdapter for Joda LocalDate type + */ +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} + diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 4e7b0d1c395..d05d7746e89 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -98,5 +98,6 @@ dependencies { compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.6.2' + compile 'joda-time:joda-time:2.9.3' testCompile 'junit:junit:4.12' } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache index 4673864fdd6..1352db97988 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", "com.google.code.gson" % "gson" % "2.6.2", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index d3080ee51ae..b1ec0b62461 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -128,6 +128,11 @@ gson ${gson-version} + + joda-time + joda-time + ${jodatime-version} + @@ -141,6 +146,7 @@ 1.5.9 2.7.5 2.6.2 + 2.9.3 1.0.0 4.12 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index 57812871f64..d7c6b63ea75 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -98,5 +98,6 @@ dependencies { compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.6.2' + compile 'joda-time:joda-time:2.9.3' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson/build.sbt b/samples/client/petstore/java/okhttp-gson/build.sbt index bbfd5c01bab..01a1095f8a4 100644 --- a/samples/client/petstore/java/okhttp-gson/build.sbt +++ b/samples/client/petstore/java/okhttp-gson/build.sbt @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.squareup.okhttp" % "okhttp" % "2.7.5", "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", "com.google.code.gson" % "gson" % "2.6.2", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index 8e15d4d1f69..0c1f55a0902 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None Long int64 = 789L; // Long | None Float _float = 3.4F; // Float | None byte[] binary = B; // byte[] | None -Date date = new Date(); // Date | None -Date dateTime = new Date(); // Date | None +LocalDate date = new LocalDate(); // LocalDate | None +DateTime dateTime = new DateTime(); // DateTime | None String password = "password_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -56,8 +56,8 @@ Name | Type | Description | Notes **int64** | **Long**| None | [optional] **_float** | **Float**| None | [optional] **binary** | **byte[]**| None | [optional] - **date** | **Date**| None | [optional] - **dateTime** | **Date**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **DateTime**| None | [optional] **password** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md index dc2b559dad2..44de7d9511a 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FormatTest.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **string** | **String** | | [optional] **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] -**date** | [**Date**](Date.md) | | -**dateTime** | [**Date**](Date.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **uuid** | **String** | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/okhttp-gson/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-gson/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 00cc10ca9b3..e3487bcc501 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/okhttp-gson/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] -**dateTime** | [**Date**](Date.md) | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/okhttp-gson/docs/Order.md b/samples/client/petstore/java/okhttp-gson/docs/Order.md index 29ca3ddbc6b..a1089f5384e 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/Order.md +++ b/samples/client/petstore/java/okhttp-gson/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**Date**](Date.md) | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/okhttp-gson/gradlew b/samples/client/petstore/java/okhttp-gson/gradlew old mode 100755 new mode 100644 diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 0b84de7935e..a534184d824 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -105,53 +105,6 @@ 1.7 - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - gradle-test - integration-test - - exec - - - gradle - - check - - - - - sbt-test - integration-test - - exec - - - sbt - - publishLocal - - - - - mvn-javadoc-test - integration-test - - exec - - - mvn - - javadoc:javadoc - - - - - @@ -175,6 +128,11 @@ gson ${gson-version} + + joda-time + joda-time + ${jodatime-version} + @@ -188,6 +146,7 @@ 1.5.9 2.7.5 2.6.2 + 2.9.3 1.0.0 4.12 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index 34af59510c2..374a185a599 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -173,8 +173,8 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java index 0a3232fd91c..7e404e47a26 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java @@ -35,12 +35,20 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; + public class JSON { private ApiClient apiClient; private Gson gson; @@ -54,6 +62,8 @@ public class JSON { this.apiClient = apiClient; gson = new GsonBuilder() .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); } @@ -166,3 +176,62 @@ class DateAdapter implements JsonSerializer, JsonDeserializer { } } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +/** + * Gson TypeAdapter for Joda LocalDate type + */ +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index 2784add9c9c..e502060d682 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -38,8 +38,9 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; -import java.util.Date; +import org.joda.time.LocalDate; import java.math.BigDecimal; +import org.joda.time.DateTime; import java.lang.reflect.Type; import java.util.ArrayList; @@ -67,7 +68,7 @@ public class FakeApi { } /* Build call for testEndpointParameters */ - private com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call testEndpointParametersCall(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -169,7 +170,7 @@ public class FakeApi { * @param password None (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException { testEndpointParametersWithHttpInfo(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } @@ -191,7 +192,7 @@ public class FakeApi { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException { + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException { com.squareup.okhttp.Call call = testEndpointParametersCall(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password, null, null); return apiClient.execute(call); } @@ -215,7 +216,7 @@ public class FakeApi { * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call testEndpointParametersAsync(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index 765754a3b09..d453504215c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -39,8 +39,8 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; import io.swagger.client.model.Pet; -import java.io.File; import io.swagger.client.model.ModelApiResponse; +import java.io.File; import java.lang.reflect.Type; import java.util.ArrayList; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java index 11516b0c554..66c4203c94e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/FormatTest.java @@ -29,7 +29,8 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; import com.google.gson.annotations.SerializedName; @@ -57,9 +58,9 @@ public class FormatTest { @SerializedName("binary") private byte[] binary = null; @SerializedName("date") - private Date date = null; + private LocalDate date = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("uuid") private String uuid = null; @SerializedName("password") @@ -242,7 +243,7 @@ public class FormatTest { * @return date **/ @ApiModelProperty(required = true, value = "") - public Date getDate() { + public LocalDate getDate() { return date; } @@ -251,7 +252,7 @@ public class FormatTest { * * @param date date */ - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } @@ -260,7 +261,7 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } @@ -269,7 +270,7 @@ public class FormatTest { * * @param dateTime dateTime */ - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 470e8b94665..3c88142fc0a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -29,10 +29,10 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -44,7 +44,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @SerializedName("uuid") private String uuid = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("map") private Map map = new HashMap(); @@ -71,7 +71,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } @@ -80,7 +80,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * * @param dateTime dateTime */ - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java index 89f901ff678..681715f12ed 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Order.java @@ -28,7 +28,7 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -44,7 +44,7 @@ public class Order { @SerializedName("quantity") private Integer quantity = null; @SerializedName("shipDate") - private Date shipDate = null; + private DateTime shipDate = null; /** * Order Status */ @@ -134,7 +134,7 @@ public class Order { * @return shipDate **/ @ApiModelProperty(value = "") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } @@ -143,7 +143,7 @@ public class Order { * * @param shipDate shipDate */ - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/JSONTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/JSONTest.java index fdc2e4c7d4a..8dab64b289e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/JSONTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/JSONTest.java @@ -6,10 +6,10 @@ import io.swagger.client.model.Order; import java.lang.Exception; import java.lang.reflect.Type; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; +import org.joda.time.DateTimeZone; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import org.junit.*; import static org.junit.Assert.*; @@ -27,29 +27,25 @@ public class JSONTest { @Test public void testDefaultDate() throws Exception { - final DateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); - datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + final DateTimeFormatter datetimeFormat = ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC); final String dateStr = "2015-11-07T14:11:05.267Z"; - order.setShipDate(datetimeFormat.parse(dateStr)); + order.setShipDate(datetimeFormat.parseDateTime(dateStr)); String str = json.serialize(order); Type type = new TypeToken() { }.getType(); Order o = json.deserialize(str, type); - assertEquals(dateStr, datetimeFormat.format(o.getShipDate())); + assertEquals(dateStr, datetimeFormat.print(o.getShipDate())); } @Test public void testCustomDate() throws Exception { - final DateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); - datetimeFormat.setTimeZone(TimeZone.getTimeZone("GMT-2")); + final DateTimeFormatter datetimeFormat = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.forID("Etc/GMT+2")); final String dateStr = "2015-11-07T14:11:05-02:00"; - order.setShipDate(datetimeFormat.parse(dateStr)); + order.setShipDate(datetimeFormat.parseDateTime(dateStr)); - apiClient.setDatetimeFormat(datetimeFormat); - apiClient.setLenientDatetimeFormat(false); String str = json.serialize(order); Type type = new TypeToken() { }.getType(); Order o = json.deserialize(str, type); - assertEquals(dateStr, datetimeFormat.format(o.getShipDate())); + assertEquals(dateStr, datetimeFormat.print(o.getShipDate())); } } \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/PetApiTest.java index c25e0d8bfa2..8bfb7605093 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,155 +1,395 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; -import java.io.File; -import org.junit.Test; +import io.swagger.TestUtils; +import io.swagger.client.*; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.lang.reflect.Type; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; +import static org.junit.Assert.*; + public class PetApiTest { + PetApi api = null; - private final PetApi api = new PetApi(); - - - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void addPetTest() throws ApiException { - Pet body = null; - // api.addPet(body); - - // TODO: test validations + @Before + public void setup() { + api = new PetApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deletePetTest() throws ApiException { - Long petId = null; - String apiKey = null; - // api.deletePet(petId, apiKey); - // TODO: test validations - } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ @Test - public void findPetsByStatusTest() throws ApiException { - List status = null; - // List response = api.findPetsByStatus(status); + public void testApiClient() { + // the default api client is used + assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); - // TODO: test validations + ApiClient oldClient = api.getApiClient(); + + ApiClient newClient = new ApiClient(); + newClient.setBasePath("http://example.com"); + newClient.setDebugging(true); + + // set api client via constructor + api = new PetApi(newClient); + assertNotNull(api.getApiClient()); + assertEquals("http://example.com", api.getApiClient().getBasePath()); + assertTrue(api.getApiClient().isDebugging()); + + // set api client via setter method + api.setApiClient(oldClient); + assertNotNull(api.getApiClient()); + assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); + assertFalse(api.getApiClient().isDebugging()); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void findPetsByTagsTest() throws ApiException { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testCreateAndGetPet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void getPetByIdTest() throws ApiException { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testCreateAndGetPetWithByteArray() throws Exception { + Pet pet = createRandomPet(); + byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes(); + api.addPetUsingByteArray(bytes); - // TODO: test validations + byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); + Type type = new TypeToken(){}.getType(); + Pet fetched = deserializeJson(new String(fetchedBytes), type, api.getApiClient()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + */ + @Test - public void updatePetTest() throws ApiException { - Pet body = null; - // api.updatePet(body); + public void testCreateAndGetPetWithHttpInfo() throws Exception { + Pet pet = createRandomPet(); + api.addPetWithHttpInfo(pet); - // TODO: test validations + ApiResponse resp = api.getPetByIdWithHttpInfo(pet.getId()); + assertEquals(200, resp.getStatusCode()); + assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0)); + Pet fetched = resp.getData(); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void updatePetWithFormTest() throws ApiException { - Long petId = null; - String name = null; - String status = null; - // api.updatePetWithForm(petId, name, status); + public void testCreateAndGetPetAsync() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + // to store returned Pet or error message/exception + final Map result = new HashMap(); - // TODO: test validations + api.getPetByIdAsync(pet.getId(), new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("error", e.getMessage()); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + // the API call should be executed asynchronously, so result should be empty at the moment + assertTrue(result.isEmpty()); + + // wait for the asynchronous call to finish (at most 10 seconds) + final int maxTry = 10; + int tryCount = 1; + Pet fetched = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("error") != null) fail((String) result.get("error")); + if (result.get("pet") != null) { + fetched = (Pet) result.get("pet"); + break; + } + } while (result.isEmpty()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + + // test getting a nonexistent pet + result.clear(); + api.getPetByIdAsync(new Long(-10000), new ApiCallback() { + @Override + public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { + result.put("exception", e); + } + + @Override + public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { + result.put("pet", pet); + } + + @Override + public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + //empty + } + + @Override + public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + //empty + } + }); + // the API call should be executed asynchronously, so result should be empty at the moment + assertTrue(result.isEmpty()); + + // wait for the asynchronous call to finish (at most 10 seconds) + tryCount = 1; + ApiException exception = null; + do { + if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); + Thread.sleep(1000); + tryCount += 1; + if (result.get("pet") != null) fail("expected an error"); + if (result.get("exception") != null) { + exception = (ApiException) result.get("exception"); + break; + } + } while (result.isEmpty()); + assertNotNull(exception); + assertEquals(404, exception.getCode()); + assertEquals("Not Found", exception.getMessage()); + assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); } - - /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void uploadFileTest() throws ApiException { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testGetPetByIdInObject() throws Exception { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("pet " + pet.getId()); - // TODO: test validations + Category category = new Category(); + category.setId(TestUtils.nextId()); + category.setName("category " + category.getId()); + pet.setCategory(category); + + pet.setStatus(Pet.StatusEnum.PENDING); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); + pet.setPhotoUrls(photos); + + api.addPet(pet); + + InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); + assertEquals(pet.getId(), fetched.getId()); + assertEquals(pet.getName(), fetched.getName()); + + Object categoryObj = fetched.getCategory(); + assertNotNull(categoryObj); + assertTrue(categoryObj instanceof Map); + + Map categoryMap = (Map) categoryObj; + Object categoryIdObj = categoryMap.get("id"); + // NOTE: Gson parses integer value to double. + assertTrue(categoryIdObj instanceof Double); + Long categoryIdLong = ((Double) categoryIdObj).longValue(); + assertEquals(category.getId(), categoryIdLong); + assertEquals(category.getName(), categoryMap.get("name")); + } + */ + + @Test + public void testUpdatePet() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + + api.updatePet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); + } + + @Test + public void testFindPetsByStatus() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.PENDING); + + api.updatePet(pet); + + List pets = api.findPetsByStatus(Arrays.asList(new String[]{"pending"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); + + api.deletePet(pet.getId(), null); + } + + @Test + public void testFindPetsByTags() throws Exception { + Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet); + + List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); + + api.deletePet(pet.getId(), null); + } + + @Test + public void testUpdatePetWithForm() throws Exception { + Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); + } + + @Test + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (ApiException e) { + assertEquals(404, e.getCode()); + } + } + + @Test + public void testUploadFile() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); + + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); + } + + @Test + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; + } + + private String serializeJson(Object o, ApiClient apiClient) { + return apiClient.getJSON().serialize(o); + } + + private T deserializeJson(String json, Type type, ApiClient apiClient) { + return (T) apiClient.getJSON().deserialize(json, type); } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/StoreApiTest.java index 31abbbeae4e..491001cfce3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,83 +1,105 @@ package io.swagger.client.api; +import io.swagger.TestUtils; import io.swagger.client.ApiException; -import io.swagger.client.model.Order; -import org.junit.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.lang.reflect.Field; import java.util.Map; +import java.text.SimpleDateFormat; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for StoreApi - */ public class StoreApiTest { + StoreApi api = null; - private final StoreApi api = new StoreApi(); - - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deleteOrderTest() throws ApiException { - String orderId = null; - // api.deleteOrder(orderId); - - // TODO: test validations + @Before + public void setup() { + api = new StoreApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); + // set custom date format that is used by the petstore server + // Note: it would still work without this setting as okhttp-gson Java client supports + // various date formats by default (with lenientDatetimeFormat enabled), including + // the one used by petstore server + api.getApiClient().setDatetimeFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); + api.getApiClient().setLenientDatetimeFormat(false); } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getInventoryTest() throws ApiException { - // Map response = api.getInventory(); - // TODO: test validations - } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ @Test - public void getOrderByIdTest() throws ApiException { - Long orderId = null; - // Order response = api.getOrderById(orderId); - - // TODO: test validations + public void testGetInventory() throws Exception { + Map inventory = api.getInventory(); + assertTrue(inventory.keySet().size() > 0); } - - /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ + + /* @Test - public void placeOrderTest() throws ApiException { - Order body = null; - // Order response = api.placeOrder(body); + public void testGetInventoryInObject() throws Exception { + Object inventoryObj = api.getInventoryInObject(); + assertTrue(inventoryObj instanceof Map); - // TODO: test validations + Map inventoryMap = (Map) inventoryObj; + assertTrue(inventoryMap.keySet().size() > 0); + + Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); + assertTrue(firstEntry.getKey() instanceof String); + // NOTE: Gson parses integer value to double. + assertTrue(firstEntry.getValue() instanceof Double); + } + */ + + @Test + public void testPlaceOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); + } + + @Test + public void testDeleteOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); + + Order fetched = api.getOrderById(order.getId()); + assertEquals(fetched.getId(), order.getId()); + + api.deleteOrder(String.valueOf(order.getId())); + + try { + api.getOrderById(order.getId()); + // fail("expected an error"); + } catch (ApiException e) { + // ok + } + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, TestUtils.nextId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/UserApiTest.java index 7e96762ff4e..b47a146d737 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,149 +1,87 @@ package io.swagger.client.api; -import io.swagger.client.ApiException; -import io.swagger.client.model.User; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import io.swagger.client.auth.*; +import io.swagger.client.model.*; + +import java.util.Arrays; + +import org.junit.*; +import static org.junit.Assert.*; -/** - * API tests for UserApi - */ public class UserApiTest { + UserApi api = null; - private final UserApi api = new UserApi(); - - - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUserTest() throws ApiException { - User body = null; - // api.createUser(body); - - // TODO: test validations + @Before + public void setup() { + api = new UserApi(); + // setup authentication + ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); + apiKeyAuth.setApiKey("special-key"); } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUsersWithArrayInputTest() throws ApiException { - List body = null; - // api.createUsersWithArrayInput(body); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ @Test - public void createUsersWithListInputTest() throws ApiException { - List body = null; - // api.createUsersWithListInput(body); + public void testCreateUser() throws Exception { + User user = createUser(); - // TODO: test validations + api.createUser(user); + + User fetched = api.getUserByName(user.getUsername()); + assertEquals(user.getId(), fetched.getId()); } - - /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void deleteUserTest() throws ApiException { - String username = null; - // api.deleteUser(username); + public void testCreateUsersWithArray() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void getUserByNameTest() throws ApiException { - String username = null; - // User response = api.getUserByName(username); + public void testCreateUsersWithList() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void loginUserTest() throws ApiException { - String username = null; - String password = null; - // String response = api.loginUser(username, password); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user); - // TODO: test validations + String token = api.loginUser(user.getUsername(), user.getPassword()); + assertTrue(token.startsWith("logged in user session:")); } - - /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ + @Test - public void logoutUserTest() throws ApiException { - // api.logoutUser(); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser(); } - - /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updateUserTest() throws ApiException { - String username = null; - User body = null; - // api.updateUser(username, body); - // TODO: test validations + private User createUser() { + User user = new User(); + user.setId(TestUtils.nextId()); + user.setUsername("fred" + user.getId()); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); + + return user; } - } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index e378356d0d4..00000000000 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,398 +0,0 @@ -package io.swagger.petstore.test; - -import com.google.gson.reflect.TypeToken; - -import io.swagger.TestUtils; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new PetApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testApiClient() { - // the default api client is used - assertEquals(Configuration.getDefaultApiClient(), api.getApiClient()); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - - ApiClient oldClient = api.getApiClient(); - - ApiClient newClient = new ApiClient(); - newClient.setBasePath("http://example.com"); - newClient.setDebugging(true); - - // set api client via constructor - api = new PetApi(newClient); - assertNotNull(api.getApiClient()); - assertEquals("http://example.com", api.getApiClient().getBasePath()); - assertTrue(api.getApiClient().isDebugging()); - - // set api client via setter method - api.setApiClient(oldClient); - assertNotNull(api.getApiClient()); - assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath()); - assertFalse(api.getApiClient().isDebugging()); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - /* - @Test - public void testCreateAndGetPetWithByteArray() throws Exception { - Pet pet = createRandomPet(); - byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes(); - api.addPetUsingByteArray(bytes); - - byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId()); - Type type = new TypeToken(){}.getType(); - Pet fetched = deserializeJson(new String(fetchedBytes), type, api.getApiClient()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - */ - - @Test - public void testCreateAndGetPetWithHttpInfo() throws Exception { - Pet pet = createRandomPet(); - api.addPetWithHttpInfo(pet); - - ApiResponse resp = api.getPetByIdWithHttpInfo(pet.getId()); - assertEquals(200, resp.getStatusCode()); - assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0)); - Pet fetched = resp.getData(); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testCreateAndGetPetAsync() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - // to store returned Pet or error message/exception - final Map result = new HashMap(); - - api.getPetByIdAsync(pet.getId(), new ApiCallback() { - @Override - public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { - result.put("error", e.getMessage()); - } - - @Override - public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { - result.put("pet", pet); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - //empty - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - //empty - } - }); - // the API call should be executed asynchronously, so result should be empty at the moment - assertTrue(result.isEmpty()); - - // wait for the asynchronous call to finish (at most 10 seconds) - final int maxTry = 10; - int tryCount = 1; - Pet fetched = null; - do { - if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); - Thread.sleep(1000); - tryCount += 1; - if (result.get("error") != null) fail((String) result.get("error")); - if (result.get("pet") != null) { - fetched = (Pet) result.get("pet"); - break; - } - } while (result.isEmpty()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - - // test getting a nonexistent pet - result.clear(); - api.getPetByIdAsync(new Long(-10000), new ApiCallback() { - @Override - public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { - result.put("exception", e); - } - - @Override - public void onSuccess(Pet pet, int statusCode, Map> responseHeaders) { - result.put("pet", pet); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - //empty - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - //empty - } - }); - // the API call should be executed asynchronously, so result should be empty at the moment - assertTrue(result.isEmpty()); - - // wait for the asynchronous call to finish (at most 10 seconds) - tryCount = 1; - ApiException exception = null; - do { - if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds"); - Thread.sleep(1000); - tryCount += 1; - if (result.get("pet") != null) fail("expected an error"); - if (result.get("exception") != null) { - exception = (ApiException) result.get("exception"); - break; - } - } while (result.isEmpty()); - assertNotNull(exception); - assertEquals(404, exception.getCode()); - assertEquals("Not Found", exception.getMessage()); - assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0)); - } - - /* - @Test - public void testGetPetByIdInObject() throws Exception { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("pet " + pet.getId()); - - Category category = new Category(); - category.setId(TestUtils.nextId()); - category.setName("category " + category.getId()); - pet.setCategory(category); - - pet.setStatus(Pet.StatusEnum.PENDING); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1"}); - pet.setPhotoUrls(photos); - - api.addPet(pet); - - InlineResponse200 fetched = api.getPetByIdInObject(pet.getId()); - assertEquals(pet.getId(), fetched.getId()); - assertEquals(pet.getName(), fetched.getName()); - - Object categoryObj = fetched.getCategory(); - assertNotNull(categoryObj); - assertTrue(categoryObj instanceof Map); - - Map categoryMap = (Map) categoryObj; - Object categoryIdObj = categoryMap.get("id"); - // NOTE: Gson parses integer value to double. - assertTrue(categoryIdObj instanceof Double); - Long categoryIdLong = ((Double) categoryIdObj).longValue(); - assertEquals(category.getId(), categoryIdLong); - assertEquals(category.getName(), categoryMap.get("name")); - } - */ - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.PENDING); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(Arrays.asList(new String[]{"pending"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - - api.deletePet(pet.getId(), null); - } - - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet); - - List pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"})); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - - api.deletePet(pet.getId(), null); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - - api.updatePetWithForm(fetched.getId(), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (ApiException e) { - assertEquals(404, e.getCode()); - } - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath())); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } - - private String serializeJson(Object o, ApiClient apiClient) { - return apiClient.getJSON().serialize(o); - } - - private T deserializeJson(String json, Type type, ApiClient apiClient) { - return (T) apiClient.getJSON().deserialize(json, type); - } -} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index 0d1910dc1e7..00000000000 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,104 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; -import io.swagger.client.ApiException; - -import io.swagger.client.*; -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.lang.reflect.Field; -import java.util.Map; -import java.text.SimpleDateFormat; - -import org.junit.*; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new StoreApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - // set custom date format that is used by the petstore server - // Note: it would still work without this setting as okhttp-gson Java client supports - // various date formats by default (with lenientDatetimeFormat enabled), including - // the one used by petstore server - api.getApiClient().setDatetimeFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); - api.getApiClient().setLenientDatetimeFormat(false); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory(); - assertTrue(inventory.keySet().size() > 0); - } - - /* - @Test - public void testGetInventoryInObject() throws Exception { - Object inventoryObj = api.getInventoryInObject(); - assertTrue(inventoryObj instanceof Map); - - Map inventoryMap = (Map) inventoryObj; - assertTrue(inventoryMap.keySet().size() > 0); - - Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next(); - assertTrue(firstEntry.getKey() instanceof String); - // NOTE: Gson parses integer value to double. - assertTrue(firstEntry.getValue() instanceof Double); - } - */ - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())); - - try { - api.getOrderById(order.getId()); - // fail("expected an error"); - } catch (ApiException e) { - // ok - } - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, TestUtils.nextId()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 195e5c1e861..00000000000 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.api.*; -import io.swagger.client.auth.*; -import io.swagger.client.model.*; - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new UserApi(); - // setup authentication - ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key"); - apiKeyAuth.setApiKey("special-key"); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user); - - User fetched = api.getUserByName(user.getUsername()); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - String token = api.loginUser(user.getUsername(), user.getPassword()); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred" + user.getId()); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} From 2fe9cd2ba04cfdd5968493b203f5ddbed52c4120 Mon Sep 17 00:00:00 2001 From: cbornet Date: Thu, 9 Jun 2016 18:41:44 +0200 Subject: [PATCH 51/67] add joda support to retrofit 1 clients --- bin/java-petstore-retrofit.sh | 4 +- .../libraries/retrofit/ApiClient.mustache | 67 +++++ .../libraries/retrofit/build.gradle.mustache | 2 + .../libraries/retrofit/build.sbt.mustache | 1 + .../Java/libraries/retrofit/pom.mustache | 6 + .../petstore/java/retrofit/build.gradle | 2 + .../client/petstore/java/retrofit/build.sbt | 1 + samples/client/petstore/java/retrofit/gradlew | 0 samples/client/petstore/java/retrofit/pom.xml | 6 + .../java/io/swagger/client/ApiClient.java | 67 +++++ .../java/io/swagger/client/StringUtil.java | 27 +- .../java/io/swagger/client/api/FakeApi.java | 7 +- .../io/swagger/client/auth/OAuthFlow.java | 27 +- .../io/swagger/client/model/FormatTest.java | 15 +- ...ropertiesAndAdditionalPropertiesClass.java | 8 +- .../java/io/swagger/client/model/Order.java | 8 +- .../io/swagger/client/api/PetApiTest.java | 251 +++++++++++------- .../io/swagger/client/api/StoreApiTest.java | 113 ++++---- .../io/swagger/client/api/UserApiTest.java | 156 ++++------- .../io/swagger/petstore/test/PetApiTest.java | 191 ------------- .../swagger/petstore/test/StoreApiTest.java | 78 ------ .../io/swagger/petstore/test/UserApiTest.java | 86 ------ 22 files changed, 492 insertions(+), 631 deletions(-) mode change 100755 => 100644 samples/client/petstore/java/retrofit/gradlew delete mode 100644 samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java delete mode 100644 samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java delete mode 100644 samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/UserApiTest.java diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index db4001e4c9e..63ded78c549 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DdateLibrary=joda,hideGenerationTimestamp=true" +rm -rf samples/client/petstore/java/retrofit/src/main +find samples/client/petstore/java/retrofit -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache index 183fb5f27ce..c7b86b66b9c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache @@ -9,6 +9,10 @@ import java.util.Map; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import retrofit.RestAdapter; import retrofit.client.OkClient; @@ -22,6 +26,9 @@ import retrofit.mime.TypedOutput; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import com.squareup.okhttp.Interceptor; import com.squareup.okhttp.OkHttpClient; @@ -108,6 +115,8 @@ public class ApiClient { public void createDefaultAdapter() { Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); okClient = new OkHttpClient(); @@ -339,3 +348,61 @@ class GsonConverterWrapper implements Converter { } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.gradle.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.gradle.mustache index 6be9ba586f3..179bda3b8d8 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.gradle.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.gradle.mustache @@ -99,6 +99,7 @@ ext { retrofit_version = "1.9.0" swagger_annotations_version = "1.5.8" junit_version = "4.12" + jodatime_version = "2.9.3" } dependencies { @@ -106,5 +107,6 @@ dependencies { compile "com.squareup.retrofit:retrofit:$retrofit_version" compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "joda-time:joda-time:$jodatime_version" testCompile "junit:junit:$junit_version" } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache index 174cb829ab6..56f6cee13ab 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/build.sbt.mustache @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache index 9a917f19caf..c9991c230e5 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/pom.mustache @@ -127,6 +127,11 @@ okhttp ${okhttp-version} + + joda-time + joda-time + ${jodatime-version} + @@ -140,6 +145,7 @@ 1.5.8 1.9.0 2.7.5 + 2.9.3 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit/build.gradle b/samples/client/petstore/java/retrofit/build.gradle index 079d1240a39..401b362d172 100644 --- a/samples/client/petstore/java/retrofit/build.gradle +++ b/samples/client/petstore/java/retrofit/build.gradle @@ -99,6 +99,7 @@ ext { retrofit_version = "1.9.0" swagger_annotations_version = "1.5.8" junit_version = "4.12" + jodatime_version = "2.9.3" } dependencies { @@ -106,5 +107,6 @@ dependencies { compile "com.squareup.retrofit:retrofit:$retrofit_version" compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "joda-time:joda-time:$jodatime_version" testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/retrofit/build.sbt b/samples/client/petstore/java/retrofit/build.sbt index bb75af8c379..629c85c2bf3 100644 --- a/samples/client/petstore/java/retrofit/build.sbt +++ b/samples/client/petstore/java/retrofit/build.sbt @@ -13,6 +13,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) diff --git a/samples/client/petstore/java/retrofit/gradlew b/samples/client/petstore/java/retrofit/gradlew old mode 100755 new mode 100644 diff --git a/samples/client/petstore/java/retrofit/pom.xml b/samples/client/petstore/java/retrofit/pom.xml index 2fe5ddc8efc..ee6ce62988f 100644 --- a/samples/client/petstore/java/retrofit/pom.xml +++ b/samples/client/petstore/java/retrofit/pom.xml @@ -127,6 +127,11 @@ okhttp ${okhttp-version} + + joda-time + joda-time + ${jodatime-version} + @@ -140,6 +145,7 @@ 1.5.8 1.9.0 2.7.5 + 2.9.3 1.0.1 1.0.0 4.12 diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java index 6540997c319..fe5ad9b37fe 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java @@ -9,6 +9,10 @@ import java.util.Map; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import retrofit.RestAdapter; import retrofit.client.OkClient; @@ -22,6 +26,9 @@ import retrofit.mime.TypedOutput; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import com.squareup.okhttp.Interceptor; import com.squareup.okhttp.OkHttpClient; @@ -107,6 +114,8 @@ public class ApiClient { public void createDefaultAdapter() { Gson gson = new GsonBuilder() .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") + .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) .create(); okClient = new OkHttpClient(); @@ -338,3 +347,61 @@ class GsonConverterWrapper implements Converter { } } + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class DateTimeTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } +} + +/** + * Gson TypeAdapter for Joda DateTime type + */ +class LocalDateTypeAdapter extends TypeAdapter { + + private final DateTimeFormatter formatter = ISODateTimeFormat.date(); + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java index c6db75c3708..03c6c81e434 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,31 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T20:43:54.025+08:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index a77872ee5ba..02b97c10bf8 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -6,8 +6,9 @@ import retrofit.Callback; import retrofit.http.*; import retrofit.mime.*; +import org.joda.time.LocalDate; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +38,7 @@ public interface FakeApi { @FormUrlEncoded @POST("/fake") Void testEndpointParameters( - @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password ); /** @@ -62,6 +63,6 @@ public interface FakeApi { @FormUrlEncoded @POST("/fake") void testEndpointParameters( - @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") Date date, @Field("dateTime") Date dateTime, @Field("password") String password, Callback cb + @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password, Callback cb ); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java index 694335531fd..6063cf33f77 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/FormatTest.java @@ -4,7 +4,8 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Date; +import org.joda.time.DateTime; +import org.joda.time.LocalDate; import com.google.gson.annotations.SerializedName; @@ -42,10 +43,10 @@ public class FormatTest { private byte[] binary = null; @SerializedName("date") - private Date date = null; + private LocalDate date = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("uuid") private String uuid = null; @@ -156,20 +157,20 @@ public class FormatTest { /** **/ @ApiModelProperty(required = true, value = "") - public Date getDate() { + public LocalDate getDate() { return date; } - public void setDate(Date date) { + public void setDate(LocalDate date) { this.date = date; } /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4afc996440..cf7f73c705f 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -4,10 +4,10 @@ import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -21,7 +21,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { private String uuid = null; @SerializedName("dateTime") - private Date dateTime = null; + private DateTime dateTime = null; @SerializedName("map") private Map map = new HashMap(); @@ -39,10 +39,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ @ApiModelProperty(value = "") - public Date getDateTime() { + public DateTime getDateTime() { return dateTime; } - public void setDateTime(Date dateTime) { + public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java index 2f774c13834..569d1c0fe46 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Order.java @@ -3,7 +3,7 @@ package io.swagger.client.model; import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; import com.google.gson.annotations.SerializedName; @@ -23,7 +23,7 @@ public class Order { private Integer quantity = null; @SerializedName("shipDate") - private Date shipDate = null; + private DateTime shipDate = null; /** @@ -90,10 +90,10 @@ public class Order { /** **/ @ApiModelProperty(value = "") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/PetApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/PetApiTest.java index 39b4dc05ee0..70f8b5aa13f 100644 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/PetApiTest.java +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/PetApiTest.java @@ -1,137 +1,190 @@ package io.swagger.client.api; -import io.swagger.client.ApiClient; -import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; +import io.swagger.TestUtils; + +import io.swagger.client.*; +import io.swagger.client.CollectionFormats.*; +import io.swagger.client.model.*; + +import retrofit.RetrofitError; +import retrofit.mime.TypedFile; + +import java.io.BufferedWriter; import java.io.File; -import org.junit.Before; -import org.junit.Test; - +import java.io.FileWriter; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; -import java.util.Map; -/** - * API tests for PetApi - */ +import org.junit.*; +import static org.junit.Assert.*; + public class PetApiTest { - - private PetApi api; + PetApi api = null; @Before public void setup() { api = new ApiClient().createService(PetApi.class); } - - /** - * Add a new pet to the store - * - * - */ @Test - public void addPetTest() { - Pet body = null; - // Void response = api.addPet(body); + public void testCreateAndGetPet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Deletes a pet - * - * - */ + @Test - public void deletePetTest() { - Long petId = null; - String apiKey = null; - // Void response = api.deletePet(petId, apiKey); + public void testUpdatePet() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); - // TODO: test validations + api.updatePet(pet); + + Pet fetched = api.getPetById(pet.getId()); + assertNotNull(fetched); + assertEquals(pet.getId(), fetched.getId()); + assertNotNull(fetched.getCategory()); + assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - */ + @Test - public void findPetsByStatusTest() { - List status = null; - // List response = api.findPetsByStatus(status); + public void testFindPetsByStatus() throws Exception { + Pet pet = createRandomPet(); + pet.setName("programmer"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + api.updatePet(pet); + + List pets = api.findPetsByStatus(new CSVParams("available")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + + assertTrue(found); } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - */ + @Test - public void findPetsByTagsTest() { - List tags = null; - // List response = api.findPetsByTags(tags); + public void testFindPetsByTags() throws Exception { + Pet pet = createRandomPet(); + pet.setName("monster"); + pet.setStatus(Pet.StatusEnum.AVAILABLE); - // TODO: test validations + List tags = new ArrayList(); + Tag tag1 = new Tag(); + tag1.setName("friendly"); + tags.add(tag1); + pet.setTags(tags); + + api.updatePet(pet); + + List pets = api.findPetsByTags(new CSVParams("friendly")); + assertNotNull(pets); + + boolean found = false; + for (Pet fetched : pets) { + if (fetched.getId().equals(pet.getId())) { + found = true; + break; + } + } + assertTrue(found); } - - /** - * Find pet by ID - * - * Returns a single pet - */ + @Test - public void getPetByIdTest() { - Long petId = null; - // Pet response = api.getPetById(petId); + public void testUpdatePetWithForm() throws Exception { + Pet pet = createRandomPet(); + pet.setName("frank"); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + + api.updatePetWithForm(fetched.getId(), "furt", null); + Pet updated = api.getPetById(fetched.getId()); + + assertEquals(updated.getName(), "furt"); } - - /** - * Update an existing pet - * - * - */ + @Test - public void updatePetTest() { - Pet body = null; - // Void response = api.updatePet(body); + public void testDeletePet() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + Pet fetched = api.getPetById(pet.getId()); + api.deletePet(fetched.getId(), null); + + try { + fetched = api.getPetById(fetched.getId()); + fail("expected an error"); + } catch (RetrofitError e) { + assertEquals(404, e.getResponse().getStatus()); + } } - - /** - * Updates a pet in the store with form data - * - * - */ + @Test - public void updatePetWithFormTest() { - Long petId = null; - String name = null; - String status = null; - // Void response = api.updatePetWithForm(petId, name, status); + public void testUploadFile() throws Exception { + Pet pet = createRandomPet(); + api.addPet(pet); - // TODO: test validations + File file = new File("hello.txt"); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write("Hello world!"); + writer.close(); + + api.uploadFile(pet.getId(), "a test file", new TypedFile("text/plain", file)); } - - /** - * uploads an image - * - * - */ + @Test - public void uploadFileTest() { - Long petId = null; - String additionalMetadata = null; - File file = null; - // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + public void testEqualsAndHashCode() { + Pet pet1 = new Pet(); + Pet pet2 = new Pet(); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); - // TODO: test validations + pet2.setName("really-happy"); + pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertFalse(pet1.equals(pet2)); + assertFalse(pet2.equals(pet1)); + assertFalse(pet1.hashCode() == (pet2.hashCode())); + assertTrue(pet2.equals(pet2)); + assertTrue(pet2.hashCode() == pet2.hashCode()); + + pet1.setName("really-happy"); + pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); + assertTrue(pet1.equals(pet2)); + assertTrue(pet2.equals(pet1)); + assertTrue(pet1.hashCode() == pet2.hashCode()); + assertTrue(pet1.equals(pet1)); + assertTrue(pet1.hashCode() == pet1.hashCode()); + } + + private Pet createRandomPet() { + Pet pet = new Pet(); + pet.setId(TestUtils.nextId()); + pet.setName("gorilla"); + + Category category = new Category(); + category.setName("really-happy"); + + pet.setCategory(category); + pet.setStatus(Pet.StatusEnum.AVAILABLE); + List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); + pet.setPhotoUrls(photos); + + return pet; } - } diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/StoreApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/StoreApiTest.java index 1da787edf19..a290fadb847 100644 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/StoreApiTest.java @@ -1,77 +1,80 @@ package io.swagger.client.api; -import io.swagger.client.ApiClient; -import io.swagger.client.model.Order; -import org.junit.Before; -import org.junit.Test; +import io.swagger.TestUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import io.swagger.client.ApiClient; +import io.swagger.client.model.*; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import retrofit.RetrofitError; + +import java.lang.reflect.Field; import java.util.Map; -/** - * API tests for StoreApi - */ -public class StoreApiTest { +import org.junit.*; +import static org.junit.Assert.*; - private StoreApi api; +public class StoreApiTest { + StoreApi api = null; @Before public void setup() { api = new ApiClient().createService(StoreApi.class); } - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - */ @Test - public void deleteOrderTest() { - String orderId = null; - // Void response = api.deleteOrder(orderId); - - // TODO: test validations + public void testGetInventory() throws Exception { + Map inventory = api.getInventory(); + assertTrue(inventory.keySet().size() > 0); } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - */ + @Test - public void getInventoryTest() { - // Map response = api.getInventory(); + public void testPlaceOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); - // TODO: test validations + Order fetched = api.getOrderById(order.getId()); + assertEquals(order.getId(), fetched.getId()); + assertEquals(order.getPetId(), fetched.getPetId()); + assertEquals(order.getQuantity(), fetched.getQuantity()); + assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC)); } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - */ + @Test - public void getOrderByIdTest() { - Long orderId = null; - // Order response = api.getOrderById(orderId); + public void testDeleteOrder() throws Exception { + Order order = createOrder(); + api.placeOrder(order); - // TODO: test validations - } - - /** - * Place an order for a pet - * - * - */ - @Test - public void placeOrderTest() { - Order body = null; - // Order response = api.placeOrder(body); + Order fetched = api.getOrderById(order.getId()); + assertEquals(fetched.getId(), order.getId()); - // TODO: test validations + api.deleteOrder(String.valueOf(order.getId())); + + try { + api.getOrderById(order.getId()); + // fail("expected an error"); + } catch (RetrofitError e) { + // ok + } + } + + private Order createOrder() { + Order order = new Order(); + order.setPetId(new Long(200)); + order.setQuantity(new Integer(13)); + order.setShipDate(DateTime.now()); + order.setStatus(Order.StatusEnum.PLACED); + order.setComplete(true); + + try { + Field idField = Order.class.getDeclaredField("id"); + idField.setAccessible(true); + idField.set(order, TestUtils.nextId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return order; } - } diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/UserApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/UserApiTest.java index cd8553d8419..84fae0e990f 100644 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/UserApiTest.java +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/UserApiTest.java @@ -1,131 +1,85 @@ package io.swagger.client.api; +import io.swagger.TestUtils; + import io.swagger.client.ApiClient; -import io.swagger.client.model.User; -import org.junit.Before; -import org.junit.Test; +import io.swagger.client.model.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -/** - * API tests for UserApi - */ +import java.util.Arrays; + +import org.junit.*; +import static org.junit.Assert.*; + public class UserApiTest { - - private UserApi api; + UserApi api = null; @Before public void setup() { api = new ApiClient().createService(UserApi.class); } - - /** - * Create user - * - * This can only be done by the logged in user. - */ @Test - public void createUserTest() { - User body = null; - // Void response = api.createUser(body); + public void testCreateUser() throws Exception { + User user = createUser(); - // TODO: test validations + api.createUser(user); + + User fetched = api.getUserByName(user.getUsername()); + assertEquals(user.getId(), fetched.getId()); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithArrayInputTest() { - List body = null; - // Void response = api.createUsersWithArrayInput(body); + public void testCreateUsersWithArray() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Creates list of users with given input array - * - * - */ + @Test - public void createUsersWithListInputTest() { - List body = null; - // Void response = api.createUsersWithListInput(body); + public void testCreateUsersWithList() throws Exception { + User user1 = createUser(); + user1.setUsername("user" + user1.getId()); + User user2 = createUser(); + user2.setUsername("user" + user2.getId()); - // TODO: test validations + api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); + + User fetched = api.getUserByName(user1.getUsername()); + assertEquals(user1.getId(), fetched.getId()); } - - /** - * Delete user - * - * This can only be done by the logged in user. - */ + @Test - public void deleteUserTest() { - String username = null; - // Void response = api.deleteUser(username); + public void testLoginUser() throws Exception { + User user = createUser(); + api.createUser(user); - // TODO: test validations + String token = api.loginUser(user.getUsername(), user.getPassword()); + assertTrue(token.startsWith("logged in user session:")); } - - /** - * Get user by user name - * - * - */ + @Test - public void getUserByNameTest() { - String username = null; - // User response = api.getUserByName(username); - - // TODO: test validations + public void logoutUser() throws Exception { + api.logoutUser(); } - - /** - * Logs user into the system - * - * - */ - @Test - public void loginUserTest() { - String username = null; - String password = null; - // String response = api.loginUser(username, password); - // TODO: test validations - } - - /** - * Logs out current logged in user session - * - * - */ - @Test - public void logoutUserTest() { - // Void response = api.logoutUser(); + private User createUser() { + User user = new User(); + user.setId(TestUtils.nextId()); + user.setUsername("fred" + user.getId()); + user.setFirstName("Fred"); + user.setLastName("Meyer"); + user.setEmail("fred@fredmeyer.com"); + user.setPassword("xxXXxx"); + user.setPhone("408-867-5309"); + user.setUserStatus(123); - // TODO: test validations + return user; } - - /** - * Updated user - * - * This can only be done by the logged in user. - */ - @Test - public void updateUserTest() { - String username = null; - User body = null; - // Void response = api.updateUser(username, body); - - // TODO: test validations - } - } diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java deleted file mode 100644 index 9fa93650d54..00000000000 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/PetApiTest.java +++ /dev/null @@ -1,191 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.*; -import io.swagger.client.CollectionFormats.*; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import retrofit.RetrofitError; -import retrofit.mime.TypedFile; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.junit.*; -import static org.junit.Assert.*; - -public class PetApiTest { - PetApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(PetApi.class); - } - - @Test - public void testCreateAndGetPet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testUpdatePet() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - - api.updatePet(pet); - - Pet fetched = api.getPetById(pet.getId()); - assertNotNull(fetched); - assertEquals(pet.getId(), fetched.getId()); - assertNotNull(fetched.getCategory()); - assertEquals(fetched.getCategory().getName(), pet.getCategory().getName()); - } - - @Test - public void testFindPetsByStatus() throws Exception { - Pet pet = createRandomPet(); - pet.setName("programmer"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - api.updatePet(pet); - - List pets = api.findPetsByStatus(new CSVParams("available")); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - - assertTrue(found); - } - - @Test - public void testFindPetsByTags() throws Exception { - Pet pet = createRandomPet(); - pet.setName("monster"); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - - List tags = new ArrayList(); - Tag tag1 = new Tag(); - tag1.setName("friendly"); - tags.add(tag1); - pet.setTags(tags); - - api.updatePet(pet); - - List pets = api.findPetsByTags(new CSVParams("friendly")); - assertNotNull(pets); - - boolean found = false; - for (Pet fetched : pets) { - if (fetched.getId().equals(pet.getId())) { - found = true; - break; - } - } - assertTrue(found); - } - - @Test - public void testUpdatePetWithForm() throws Exception { - Pet pet = createRandomPet(); - pet.setName("frank"); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - - api.updatePetWithForm(fetched.getId(), "furt", null); - Pet updated = api.getPetById(fetched.getId()); - - assertEquals(updated.getName(), "furt"); - } - - @Test - public void testDeletePet() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - Pet fetched = api.getPetById(pet.getId()); - api.deletePet(fetched.getId(), null); - - try { - fetched = api.getPetById(fetched.getId()); - fail("expected an error"); - } catch (RetrofitError e) { - assertEquals(404, e.getResponse().getStatus()); - } - } - - @Test - public void testUploadFile() throws Exception { - Pet pet = createRandomPet(); - api.addPet(pet); - - File file = new File("hello.txt"); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("Hello world!"); - writer.close(); - - api.uploadFile(pet.getId(), "a test file", new TypedFile("text/plain", file)); - } - - @Test - public void testEqualsAndHashCode() { - Pet pet1 = new Pet(); - Pet pet2 = new Pet(); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - - pet2.setName("really-happy"); - pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertFalse(pet1.equals(pet2)); - assertFalse(pet2.equals(pet1)); - assertFalse(pet1.hashCode() == (pet2.hashCode())); - assertTrue(pet2.equals(pet2)); - assertTrue(pet2.hashCode() == pet2.hashCode()); - - pet1.setName("really-happy"); - pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"})); - assertTrue(pet1.equals(pet2)); - assertTrue(pet2.equals(pet1)); - assertTrue(pet1.hashCode() == pet2.hashCode()); - assertTrue(pet1.equals(pet1)); - assertTrue(pet1.hashCode() == pet1.hashCode()); - } - - private Pet createRandomPet() { - Pet pet = new Pet(); - pet.setId(TestUtils.nextId()); - pet.setName("gorilla"); - - Category category = new Category(); - category.setName("really-happy"); - - pet.setCategory(category); - pet.setStatus(Pet.StatusEnum.AVAILABLE); - List photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}); - pet.setPhotoUrls(photos); - - return pet; - } -} diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java deleted file mode 100644 index c823245355a..00000000000 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/StoreApiTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - -import retrofit.RetrofitError; - -import java.lang.reflect.Field; -import java.util.Map; - -import org.junit.*; -import static org.junit.Assert.*; - -public class StoreApiTest { - StoreApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(StoreApi.class); - } - - @Test - public void testGetInventory() throws Exception { - Map inventory = api.getInventory(); - assertTrue(inventory.keySet().size() > 0); - } - - @Test - public void testPlaceOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(order.getId(), fetched.getId()); - assertEquals(order.getPetId(), fetched.getPetId()); - assertEquals(order.getQuantity(), fetched.getQuantity()); - } - - @Test - public void testDeleteOrder() throws Exception { - Order order = createOrder(); - api.placeOrder(order); - - Order fetched = api.getOrderById(order.getId()); - assertEquals(fetched.getId(), order.getId()); - - api.deleteOrder(String.valueOf(order.getId())); - - try { - api.getOrderById(order.getId()); - // fail("expected an error"); - } catch (RetrofitError e) { - // ok - } - } - - private Order createOrder() { - Order order = new Order(); - order.setPetId(new Long(200)); - order.setQuantity(new Integer(13)); - order.setShipDate(new java.util.Date()); - order.setStatus(Order.StatusEnum.PLACED); - order.setComplete(true); - - try { - Field idField = Order.class.getDeclaredField("id"); - idField.setAccessible(true); - idField.set(order, TestUtils.nextId()); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return order; - } -} diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/UserApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/UserApiTest.java deleted file mode 100644 index 9b949445cc3..00000000000 --- a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/petstore/test/UserApiTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package io.swagger.petstore.test; - -import io.swagger.TestUtils; - -import io.swagger.client.ApiClient; -import io.swagger.client.api.*; -import io.swagger.client.model.*; - - -import java.util.Arrays; - -import org.junit.*; -import static org.junit.Assert.*; - -public class UserApiTest { - UserApi api = null; - - @Before - public void setup() { - api = new ApiClient().createService(UserApi.class); - } - - @Test - public void testCreateUser() throws Exception { - User user = createUser(); - - api.createUser(user); - - User fetched = api.getUserByName(user.getUsername()); - assertEquals(user.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithArray() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testCreateUsersWithList() throws Exception { - User user1 = createUser(); - user1.setUsername("user" + user1.getId()); - User user2 = createUser(); - user2.setUsername("user" + user2.getId()); - - api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})); - - User fetched = api.getUserByName(user1.getUsername()); - assertEquals(user1.getId(), fetched.getId()); - } - - @Test - public void testLoginUser() throws Exception { - User user = createUser(); - api.createUser(user); - - String token = api.loginUser(user.getUsername(), user.getPassword()); - assertTrue(token.startsWith("logged in user session:")); - } - - @Test - public void logoutUser() throws Exception { - api.logoutUser(); - } - - private User createUser() { - User user = new User(); - user.setId(TestUtils.nextId()); - user.setUsername("fred" + user.getId()); - user.setFirstName("Fred"); - user.setLastName("Meyer"); - user.setEmail("fred@fredmeyer.com"); - user.setPassword("xxXXxx"); - user.setPhone("408-867-5309"); - user.setUserStatus(123); - - return user; - } -} From d8eb708e23c7ac1d2b512e8a351d4fae0010ed2d Mon Sep 17 00:00:00 2001 From: cbornet Date: Thu, 9 Jun 2016 21:59:45 +0200 Subject: [PATCH 52/67] add joda support to spring-boot and use it in sample --- bin/springboot-petstore-server.sh | 4 +++- .../JavaSpringBoot/generatedAnnotation.mustache | 2 +- .../src/main/resources/JavaSpringBoot/pom.mustache | 9 +++++++++ .../JavaSpringBoot/swaggerDocumentationConfig.mustache | 2 ++ samples/server/petstore/springboot/pom.xml | 9 +++++++++ .../src/main/java/io/swagger/api/ApiException.java | 2 +- .../src/main/java/io/swagger/api/ApiOriginFilter.java | 2 +- .../main/java/io/swagger/api/ApiResponseMessage.java | 2 +- .../main/java/io/swagger/api/NotFoundException.java | 2 +- .../src/main/java/io/swagger/api/PetApi.java | 2 +- .../src/main/java/io/swagger/api/PetApiController.java | 2 +- .../src/main/java/io/swagger/api/StoreApi.java | 2 +- .../main/java/io/swagger/api/StoreApiController.java | 2 +- .../src/main/java/io/swagger/api/UserApi.java | 2 +- .../main/java/io/swagger/api/UserApiController.java | 2 +- .../configuration/SwaggerDocumentationConfig.java | 4 +++- .../src/main/java/io/swagger/model/Category.java | 2 +- .../main/java/io/swagger/model/ModelApiResponse.java | 2 +- .../src/main/java/io/swagger/model/Order.java | 10 +++++----- .../springboot/src/main/java/io/swagger/model/Pet.java | 2 +- .../springboot/src/main/java/io/swagger/model/Tag.java | 2 +- .../src/main/java/io/swagger/model/User.java | 2 +- 22 files changed, 47 insertions(+), 23 deletions(-) diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 83d810ba595..1655952525a 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-petstore-server.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot -DdateLibrary=joda,hideGenerationTimestamp=true" +rm -rf samples/server/petstore/springboot/src/main +find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache index 49110fc1ad9..a47b6faa85b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache @@ -1 +1 @@ -@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file +{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache index ab4449ee580..53c3652cb45 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pom.mustache @@ -50,5 +50,14 @@ springfox-swagger-ui ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + joda-time + joda-time + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache index 1af646a6908..970739e1b97 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache @@ -34,6 +34,8 @@ public class SwaggerDocumentationConfig { .select() .apis(RequestHandlerSelectors.basePackage("{{apiPackage}}")) .build() + .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class) + .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class) .apiInfo(apiInfo()); } diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml index 139b3da9ab4..0002871db8f 100644 --- a/samples/server/petstore/springboot/pom.xml +++ b/samples/server/petstore/springboot/pom.xml @@ -50,5 +50,14 @@ springfox-swagger-ui ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + joda-time + joda-time + \ No newline at end of file diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java index 9da33ef61cf..7fa61c50d24 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java index a62f9cf5a04..f0f62dc7206 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java index 96257d752b8..33f95878e54 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java index dbc07fc4545..295109d7fc4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { 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 08c6882eb46..bb63b7e11d6 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 @@ -23,7 +23,7 @@ import java.util.List; import static org.springframework.http.MediaType.*; @Api(value = "pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public interface PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { 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 64e90944464..ec3bbf3e747 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 @@ -21,7 +21,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class PetApiController implements PetApi { public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index 901d46bee81..2fb7585dbdd 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -22,7 +22,7 @@ import java.util.List; import static org.springframework.http.MediaType.*; @Api(value = "store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public interface StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java index 04178b670f4..92de5eb86b4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class StoreApiController implements StoreApi { public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index da170f5eb3e..3877be4e8ad 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -22,7 +22,7 @@ import java.util.List; import static org.springframework.http.MediaType.*; @Api(value = "user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public interface UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index 8af34d5d47a..f855d358ea5 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; @Controller -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class UserApiController implements UserApi { public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { // do some magic! diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 9dcf5890183..282773a2d30 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -13,7 +13,7 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class SwaggerDocumentationConfig { ApiInfo apiInfo() { @@ -34,6 +34,8 @@ public class SwaggerDocumentationConfig { .select() .apis(RequestHandlerSelectors.basePackage("io.swagger.api")) .build() + .directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class) + .directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class) .apiInfo(apiInfo()); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index da5fcf8299c..d7aa14a8c75 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class Category { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index 0f5c4078ae9..50163623706 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index ae7fbc45add..941bfe67c2f 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import org.joda.time.DateTime; import io.swagger.annotations.*; import com.fasterxml.jackson.annotation.JsonProperty; @@ -13,13 +13,13 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class Order { private Long id = null; private Long petId = null; private Integer quantity = null; - private Date shipDate = null; + private DateTime shipDate = null; public enum StatusEnum { placed, approved, delivered, }; @@ -64,10 +64,10 @@ public class Order { **/ @ApiModelProperty(value = "") @JsonProperty("shipDate") - public Date getShipDate() { + public DateTime getShipDate() { return shipDate; } - public void setShipDate(Date shipDate) { + public void setShipDate(DateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index de7615f484d..aabffb593e4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class Pet { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 174ff984fc3..e9ef2ca5704 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class Tag { private Long id = null; diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index e22fd5071d5..76ac713c8ee 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-06-06T14:29:50.468+02:00") + public class User { private Long id = null; From b418719804d92b4532c7554a021c7eb035f2057b Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 10 Jun 2016 14:30:32 +0800 Subject: [PATCH 53/67] update sample, update shell script with messages about removing files --- bin/java-petstore-jersey2.sh | 1 + bin/java-petstore.sh | 1 + .../java/io/swagger/client/ApiClient.java | 2 +- .../java/io/swagger/client/ApiException.java | 132 +++++++++++------- .../java/io/swagger/client/Configuration.java | 59 ++++++-- .../src/main/java/io/swagger/client/Pair.java | 25 ++++ .../java/io/swagger/client/StringUtil.java | 25 ++++ .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 25 ++++ .../swagger/client/auth/Authentication.java | 34 ++++- .../io/swagger/client/auth/HttpBasicAuth.java | 25 ++++ .../java/io/swagger/client/auth/OAuth.java | 25 ++++ .../io/swagger/client/auth/OAuthFlow.java | 27 +++- .../java/io/swagger/client/ApiClient.java | 2 +- .../java/io/swagger/client/ApiException.java | 132 +++++++++++------- .../java/io/swagger/client/Configuration.java | 59 ++++++-- .../src/main/java/io/swagger/client/Pair.java | 25 ++++ .../java/io/swagger/client/StringUtil.java | 25 ++++ .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/auth/ApiKeyAuth.java | 25 ++++ .../swagger/client/auth/Authentication.java | 34 ++++- .../io/swagger/client/auth/HttpBasicAuth.java | 25 ++++ .../java/io/swagger/client/auth/OAuth.java | 25 ++++ .../io/swagger/client/auth/OAuthFlow.java | 27 +++- 26 files changed, 628 insertions(+), 140 deletions(-) diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index 014af660cd8..335652f79bb 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -28,6 +28,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DdateLibrary=joda,hideGenerationTimestamp=true" +echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2/src/main find samples/client/petstore/java/jersey2 -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh index 576798ee24b..b2773945ea2 100755 --- a/bin/java-petstore.sh +++ b/bin/java-petstore.sh @@ -28,6 +28,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DdateLibrary=joda,hideGenerationTimestamp=true" +echo "Removing files and folders under samples/client/petstore/java/default/src/main" rm -rf samples/client/petstore/java/default/src/main find samples/client/petstore/java/default -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java index ba846404249..0d7898329d0 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java @@ -75,8 +75,8 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java index 27395e86ba9..600bb507f09 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiException.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; import java.util.Map; @@ -5,65 +30,74 @@ import java.util.List; public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; - public ApiException() {} + public ApiException() {} - public ApiException(Throwable throwable) { - super(throwable); - } + public ApiException(Throwable throwable) { + super(throwable); + } - public ApiException(String message) { - super(message); - } + public ApiException(String message) { + super(message); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(int code, String message) { - super(message); - this.code = code; - } + public ApiException(int code, String message) { + super(message); + this.code = code; + } - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public int getCode() { - return code; - } + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } - /** - * Get the HTTP response headers. - */ - public Map> getResponseHeaders() { - return responseHeaders; - } + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } - /** - * Get the HTTP response body. - */ - public String getResponseBody() { - return responseBody; - } + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java index 19b0ebeae4e..cbdadd6262d 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Configuration.java @@ -1,22 +1,51 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java index d8d32210b10..4b44c415812 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/Pair.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java index 1383dd0decb..03c6c81e434 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/StringUtil.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java index dc9faf57ea6..18ec9428c16 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/FakeApi.java @@ -9,8 +9,8 @@ import io.swagger.client.model.*; import io.swagger.client.Pair; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java index 50a6ecff737..0816f9a2961 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import io.swagger.client.model.*; import io.swagger.client.Pair; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6882dbc41c0..6ba15566b60 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/Authentication.java index 98b1a6900b9..a063a6998b5 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/Authentication.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; @@ -6,6 +31,11 @@ import java.util.Map; import java.util.List; public interface Authentication { - /** Apply authentication settings to header and query params. */ - void applyToParams(List queryParams, Map headerParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); } diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 64f2c887377..5895370e4d4 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java index 76d2917f24e..8802ebc92c8 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java index d82f0db0239..a2607bfd516 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiClient.java @@ -84,8 +84,8 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java index 27395e86ba9..600bb507f09 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/ApiException.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; import java.util.Map; @@ -5,65 +30,74 @@ import java.util.List; public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; - public ApiException() {} + public ApiException() {} - public ApiException(Throwable throwable) { - super(throwable); - } + public ApiException(Throwable throwable) { + super(throwable); + } - public ApiException(String message) { - super(message); - } + public ApiException(String message) { + super(message); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } - public ApiException(int code, String message) { - super(message); - this.code = code; - } + public ApiException(int code, String message) { + super(message); + this.code = code; + } - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } - public int getCode() { - return code; - } + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } - /** - * Get the HTTP response headers. - */ - public Map> getResponseHeaders() { - return responseHeaders; - } + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } - /** - * Get the HTTP response body. - */ - public String getResponseBody() { - return responseBody; - } + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java index 19b0ebeae4e..cbdadd6262d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Configuration.java @@ -1,22 +1,51 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java index d8d32210b10..4b44c415812 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/Pair.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java index 1383dd0decb..03c6c81e434 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/StringUtil.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java index ce4830a1f77..b8b499c4dee 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -8,8 +8,8 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java index ad66598406d..ab85c4ac394 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/PetApi.java @@ -8,8 +8,8 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 6882dbc41c0..6ba15566b60 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/Authentication.java index 98b1a6900b9..a063a6998b5 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/Authentication.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; @@ -6,6 +31,11 @@ import java.util.Map; import java.util.List; public interface Authentication { - /** Apply authentication settings to header and query params. */ - void applyToParams(List queryParams, Map headerParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); } diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 64f2c887377..5895370e4d4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java index 76d2917f24e..8802ebc92c8 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuth.java @@ -1,3 +1,28 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; import io.swagger.client.Pair; diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} From 3f51ff3314cc1dca318ac1c2fa7db4953c5e0048 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 10 Jun 2016 16:34:59 +0800 Subject: [PATCH 54/67] add wording about removing files and folders in the output folder --- bin/java-petstore-retrofit.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index 63ded78c549..0866cdfa580 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -28,6 +28,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DdateLibrary=joda,hideGenerationTimestamp=true" +echo "Removing files and folders under samples/client/petstore/java/retrofit/src/main" rm -rf samples/client/petstore/java/retrofit/src/main find samples/client/petstore/java/retrofit -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags From a33eb3132e8cdaf3b1b7f42575c68c7f60e9a476 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 10 Jun 2016 17:01:27 +0800 Subject: [PATCH 55/67] add message about rmeoving files/folders under output folder --- bin/springboot-petstore-server.sh | 1 + .../springboot/src/main/java/io/swagger/Swagger2SpringBoot.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 1655952525a..9e79d42cc86 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-petstore-server.sh @@ -28,6 +28,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot -DdateLibrary=joda,hideGenerationTimestamp=true" +echo "Removing files and folders under samples/server/petstore/springboot/src/main" rm -rf samples/server/petstore/springboot/src/main find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java b/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java index 2cc65db2b81..4317ba2f1a6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/Swagger2SpringBoot.java @@ -33,4 +33,4 @@ public class Swagger2SpringBoot implements CommandLineRunner { } } -} \ No newline at end of file +} From 0f3569e982a912bc51da4552daed3775c132a148 Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 10 Jun 2016 12:17:36 +0200 Subject: [PATCH 56/67] set joda as default dateLibrary for java codegens that support it Fix #3087 --- bin/java-petstore-feign.sh | 2 +- bin/java-petstore-jersey2.sh | 2 +- bin/java-petstore-okhttp-gson.sh | 2 +- bin/java-petstore-retrofit.sh | 2 +- bin/java-petstore-retrofit2.sh | 2 +- bin/java-petstore-retrofit2rx.sh | 2 +- bin/java-petstore.sh | 2 +- bin/springboot-petstore-server.sh | 2 +- .../AbstractJavaJAXRSServerCodegen.java | 1 + .../languages/GroovyClientCodegen.java | 1 + .../codegen/languages/JavaClientCodegen.java | 3 ++- .../languages/JavaInflectorServerCodegen.java | 1 + .../languages/JavaResteasyServerCodegen.java | 1 + .../languages/SpringMVCServerCodegen.java | 1 + .../petstore/java/okhttp-gson/hello.txt | 1 - .../client/petstore/java/retrofit/hello.txt | 1 - .../java/io/swagger/client/StringUtil.java | 27 ++++++++++++++++++- .../io/swagger/client/auth/OAuthFlow.java | 27 ++++++++++++++++++- .../java/io/swagger/client/StringUtil.java | 27 ++++++++++++++++++- .../io/swagger/client/auth/OAuthFlow.java | 27 ++++++++++++++++++- 20 files changed, 119 insertions(+), 15 deletions(-) delete mode 100644 samples/client/petstore/java/okhttp-gson/hello.txt delete mode 100644 samples/client/petstore/java/retrofit/hello.txt diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index 40dbc592f7e..61c4621a1f6 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index 335652f79bb..0850bdbb4f4 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DhideGenerationTimestamp=true" echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2/src/main diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index 521c8ca4826..492cd5ff4a4 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true" rm -rf samples/client/petstore/java/okhttp-gson/src/main find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} + diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index 0866cdfa580..3b370fde7dd 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DhideGenerationTimestamp=true" echo "Removing files and folders under samples/client/petstore/java/retrofit/src/main" rm -rf samples/client/petstore/java/retrofit/src/main diff --git a/bin/java-petstore-retrofit2.sh b/bin/java-petstore-retrofit2.sh index 14175ce72a2..8cf9468c3a1 100755 --- a/bin/java-petstore-retrofit2.sh +++ b/bin/java-petstore-retrofit2.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 -DdateLibrary=joda" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore-retrofit2rx.sh b/bin/java-petstore-retrofit2rx.sh index c62da51daa8..af62352c03f 100755 --- a/bin/java-petstore-retrofit2rx.sh +++ b/bin/java-petstore-retrofit2rx.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true,dateLibrary=joda" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true,hideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh index b2773945ea2..be6472d7aad 100755 --- a/bin/java-petstore.sh +++ b/bin/java-petstore.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true" echo "Removing files and folders under samples/client/petstore/java/default/src/main" rm -rf samples/client/petstore/java/default/src/main diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 9e79d42cc86..7fe3ac60e53 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-petstore-server.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot -DdateLibrary=joda,hideGenerationTimestamp=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l springboot -o samples/server/petstore/springboot -DhideGenerationTimestamp=true" echo "Removing files and folders under samples/server/petstore/springboot/src/main" rm -rf samples/server/petstore/springboot/src/main diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java index 27f435250a0..fbb2831ab8b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -26,6 +26,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen { public AbstractJavaJAXRSServerCodegen() { super(); + dateLibrary = "legacy"; apiTestTemplateFiles.clear(); // TODO: add test template } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java index 1ed9604fbf4..5b26662531f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java @@ -27,6 +27,7 @@ public class GroovyClientCodegen extends JavaClientCodegen { configPackage = "io.swagger.configuration"; invokerPackage = "io.swagger.api"; artifactId = "swagger-spring-mvc-server"; + dateLibrary = "legacy"; additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.GROUP_ID, groupId); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 16c9f9ae12b..c80bb0ed23f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -30,7 +30,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String RETROFIT_1 = "retrofit"; public static final String RETROFIT_2 = "retrofit2"; - protected String dateLibrary = "default"; + protected String dateLibrary = "joda"; protected String invokerPackage = "io.swagger.client"; protected String groupId = "io.swagger"; protected String artifactId = "swagger-java-client"; @@ -128,6 +128,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { Map dateOptions = new HashMap(); dateOptions.put("java8", "Java 8 native"); dateOptions.put("joda", "Joda"); + dateOptions.put("legacy", "Legacy java.util.Date"); dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java index bb32ee9ab8d..8a08bf758a3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java @@ -29,6 +29,7 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen { embeddedTemplateDir = templateDir = "JavaInflector"; invokerPackage = "io.swagger.handler"; artifactId = "swagger-inflector-server"; + dateLibrary = "legacy"; apiPackage = System.getProperty("swagger.codegen.inflector.apipackage", "io.swagger.handler"); modelPackage = System.getProperty("swagger.codegen.inflector.modelpackage", "io.swagger.model"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java index 5717c902740..4c13fd50f0b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java @@ -34,6 +34,7 @@ public class JavaResteasyServerCodegen extends JavaClientCodegen implements Code apiTestTemplateFiles.clear(); // TODO: add test template apiPackage = "io.swagger.api"; modelPackage = "io.swagger.model"; + dateLibrary = "legacy"; additionalProperties.put("title", title); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java index 18b2f872d56..47c67a4ec6d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java @@ -25,6 +25,7 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen configPackage = "io.swagger.configuration"; invokerPackage = "io.swagger.api"; artifactId = "swagger-spring-mvc-server"; + dateLibrary = "legacy"; additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.GROUP_ID, groupId); diff --git a/samples/client/petstore/java/okhttp-gson/hello.txt b/samples/client/petstore/java/okhttp-gson/hello.txt deleted file mode 100644 index 6769dd60bdf..00000000000 --- a/samples/client/petstore/java/okhttp-gson/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit/hello.txt b/samples/client/petstore/java/retrofit/hello.txt deleted file mode 100644 index 6769dd60bdf..00000000000 --- a/samples/client/petstore/java/retrofit/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java index 344f523df41..03c6c81e434 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,31 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-08T18:45:27.896+02:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java index 391c1c016c6..03c6c81e434 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/StringUtil.java @@ -1,6 +1,31 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-08T18:44:17.529+02:00") + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} From 196930cf493c90b72d43b69e76530dd8a2ab72a5 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Fri, 10 Jun 2016 08:10:12 -0400 Subject: [PATCH 57/67] [csharp] Include ExceptionFactory property on IApiAccessor interface --- .../src/main/resources/csharp/IApiAccessor.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/csharp/IApiAccessor.mustache b/modules/swagger-codegen/src/main/resources/csharp/IApiAccessor.mustache index 22db465efaa..df236b8f8c8 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/IApiAccessor.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/IApiAccessor.mustache @@ -24,5 +24,10 @@ namespace {{packageName}}.Client /// /// The base path String GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } } } From c209cb25efbb37277abddde15fa354c7ce946f3d Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Fri, 10 Jun 2016 08:10:50 -0400 Subject: [PATCH 58/67] [csharp] Regenerate petstore client --- .../csharp/SwaggerClient/IO.Swagger.sln | 10 +- .../petstore/csharp/SwaggerClient/README.md | 16 +- .../csharp/SwaggerClient/docs/FakeApi.md | 6 +- .../csharp/SwaggerClient/docs/FormatTest.md | 2 +- .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../src/IO.Swagger/Api/FakeApi.cs | 56 ++++-- .../src/IO.Swagger/Api/PetApi.cs | 166 +++++++++++------- .../src/IO.Swagger/Api/StoreApi.cs | 94 ++++++---- .../src/IO.Swagger/Api/UserApi.cs | 166 +++++++++++------- .../src/IO.Swagger/Client/ApiClient.cs | 22 ++- .../src/IO.Swagger/Client/Configuration.cs | 11 ++ .../src/IO.Swagger/Client/ExceptionFactory.cs | 7 + .../src/IO.Swagger/Client/IApiAccessor.cs | 5 + .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/FormatTest.cs | 4 +- 15 files changed, 370 insertions(+), 199 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index c0a42faae52..740ca6561ac 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{C81D6286-7BA5-4920-8591-F59169CCE4A4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{EE727567-9CAF-4258-AA0E-FDF89487D7D6}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{C81D6286-7BA5-4920-8591-F59169CCE4A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{C81D6286-7BA5-4920-8591-F59169CCE4A4}.Debug|Any CPU.Build.0 = Debug|Any CPU -{C81D6286-7BA5-4920-8591-F59169CCE4A4}.Release|Any CPU.ActiveCfg = Release|Any CPU -{C81D6286-7BA5-4920-8591-F59169CCE4A4}.Release|Any CPU.Build.0 = Release|Any CPU +{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.Build.0 = Debug|Any CPU +{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU +{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index d9dcb59b2da..c94e740d7b3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-29T17:27:36.037+08:00 +- Build date: 2016-06-10T08:07:39.769-04:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -54,7 +54,7 @@ namespace Example { var apiInstance = new FakeApi(); - var number = 3.4; // double? | None + var number = 3.4; // decimal? | None var _double = 1.2; // double? | None var _string = _string_example; // string | None var _byte = B; // byte[] | None @@ -138,12 +138,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -153,3 +147,9 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index e4325274999..cc24d4dfa07 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -8,7 +8,7 @@ Method | HTTP request | Description # **TestEndpointParameters** -> void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) +> void TestEndpointParameters (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -30,7 +30,7 @@ namespace Example { var apiInstance = new FakeApi(); - var number = 3.4; // double? | None + var number = 3.4; // decimal? | None var _double = 1.2; // double? | None var _string = _string_example; // string | None var _byte = B; // byte[] | None @@ -61,7 +61,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **double?**| None | + **number** | **decimal?**| None | **_double** | **double?**| None | **_string** | **string**| None | **_byte** | **byte[]**| None | diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md index 7ddfad04d05..1d366bd7cab 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FormatTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **Integer** | **int?** | | [optional] **Int32** | **int?** | | [optional] **Int64** | **long?** | | [optional] -**Number** | **double?** | | +**Number** | **decimal?** | | **_Float** | **float?** | | [optional] **_Double** | **double?** | | [optional] **_String** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 4e4b161e255..2cc0dd9525c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -86,7 +86,7 @@ limitations under the License. - {C81D6286-7BA5-4920-8591-F59169CCE4A4} + {EE727567-9CAF-4258-AA0E-FDF89487D7D6} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 00ce83ef910..973771809a2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -55,7 +55,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// - void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + void TestEndpointParameters (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -77,7 +77,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// ApiResponse of Object(void) - ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + ApiResponse TestEndpointParametersWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -100,7 +100,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of void - System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -122,7 +122,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of ApiResponse - System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); + System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null); #endregion Asynchronous Operations } @@ -131,6 +131,8 @@ namespace IO.Swagger.Api /// public partial class FakeApi : IFakeApi { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// /// Initializes a new instance of the class. /// @@ -139,6 +141,8 @@ namespace IO.Swagger.Api { this.Configuration = new Configuration(new ApiClient(basePath)); + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -159,6 +163,8 @@ namespace IO.Swagger.Api else this.Configuration = configuration; + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -191,6 +197,22 @@ namespace IO.Swagger.Api /// An instance of the Configuration public Configuration Configuration {get; set;} + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// /// Gets the default header. /// @@ -230,7 +252,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// - public void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public void TestEndpointParameters (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { TestEndpointParametersWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); } @@ -252,7 +274,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// ApiResponse of Object(void) - public ApiResponse TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public ApiResponse TestEndpointParametersWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { // verify the required parameter 'number' is set if (number == null) @@ -315,10 +337,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestEndpointParameters", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -343,7 +366,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of void - public async System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); @@ -366,7 +389,7 @@ namespace IO.Swagger.Api /// None (optional) /// None (optional) /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) + public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null) { // verify the required parameter 'number' is set if (number == null) @@ -429,10 +452,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestEndpointParameters", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs index e147d33cceb..abf5a0595b2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs @@ -402,6 +402,8 @@ namespace IO.Swagger.Api /// public partial class PetApi : IPetApi { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// /// Initializes a new instance of the class. /// @@ -410,6 +412,8 @@ namespace IO.Swagger.Api { this.Configuration = new Configuration(new ApiClient(basePath)); + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -430,6 +434,8 @@ namespace IO.Swagger.Api else this.Configuration = configuration; + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -462,6 +468,22 @@ namespace IO.Swagger.Api /// An instance of the Configuration public Configuration Configuration {get; set;} + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// /// Gets the default header. /// @@ -557,10 +579,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling AddPet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling AddPet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("AddPet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -642,10 +665,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling AddPet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling AddPet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("AddPet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -720,10 +744,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeletePet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeletePet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeletePet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -799,10 +824,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeletePet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeletePet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeletePet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -875,10 +901,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByStatus: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByStatus: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FindPetsByStatus", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -952,10 +979,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByStatus: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByStatus: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FindPetsByStatus", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1028,10 +1056,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByTags: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByTags: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FindPetsByTags", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1105,10 +1134,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByTags: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindPetsByTags: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FindPetsByTags", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1181,10 +1211,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetPetById: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetPetById: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetPetById", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1257,10 +1288,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetPetById: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetPetById: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetPetById", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1341,10 +1373,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdatePet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdatePet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdatePet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1426,10 +1459,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdatePet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdatePet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdatePet", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1508,10 +1542,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdatePetWithForm: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdatePetWithForm: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1591,10 +1626,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdatePetWithForm: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdatePetWithForm: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1673,10 +1709,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFile", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1756,10 +1793,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFile", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs index ed5dd54ec40..3fbbe71b8ca 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs @@ -210,6 +210,8 @@ namespace IO.Swagger.Api /// public partial class StoreApi : IStoreApi { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// /// Initializes a new instance of the class. /// @@ -218,6 +220,8 @@ namespace IO.Swagger.Api { this.Configuration = new Configuration(new ApiClient(basePath)); + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -238,6 +242,8 @@ namespace IO.Swagger.Api else this.Configuration = configuration; + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -270,6 +276,22 @@ namespace IO.Swagger.Api /// An instance of the Configuration public Configuration Configuration {get; set;} + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// /// Gets the default header. /// @@ -350,10 +372,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeleteOrder: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeleteOrder: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteOrder", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -420,10 +443,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeleteOrder: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeleteOrder: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteOrder", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -489,10 +513,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetInventory: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetInventory: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetInventory", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -558,10 +583,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetInventory: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetInventory: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetInventory", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -628,10 +654,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetOrderById: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetOrderById: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetOrderById", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -699,10 +726,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetOrderById: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetOrderById: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetOrderById", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -776,10 +804,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling PlaceOrder: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling PlaceOrder: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("PlaceOrder", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -854,10 +883,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling PlaceOrder: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling PlaceOrder: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("PlaceOrder", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs index 6cb5bee041c..6fb6244264e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs @@ -386,6 +386,8 @@ namespace IO.Swagger.Api /// public partial class UserApi : IUserApi { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// /// Initializes a new instance of the class. /// @@ -394,6 +396,8 @@ namespace IO.Swagger.Api { this.Configuration = new Configuration(new ApiClient(basePath)); + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -414,6 +418,8 @@ namespace IO.Swagger.Api else this.Configuration = configuration; + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + // ensure API client has configuration ready if (Configuration.ApiClient.Configuration == null) { @@ -446,6 +452,22 @@ namespace IO.Swagger.Api /// An instance of the Configuration public Configuration Configuration {get; set;} + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// /// Gets the default header. /// @@ -533,10 +555,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -610,10 +633,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -686,10 +710,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithArrayInput: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithArrayInput: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -763,10 +788,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithArrayInput: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithArrayInput: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -839,10 +865,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithListInput: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithListInput: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -916,10 +943,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithListInput: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling CreateUsersWithListInput: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -985,10 +1013,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeleteUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeleteUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1055,10 +1084,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling DeleteUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling DeleteUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("DeleteUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1125,10 +1155,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetUserByName: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetUserByName: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetUserByName", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1196,10 +1227,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetUserByName: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetUserByName: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("GetUserByName", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1272,10 +1304,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling LoginUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling LoginUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("LoginUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1349,10 +1382,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling LoginUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling LoginUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("LoginUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), @@ -1412,10 +1446,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling LogoutUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling LogoutUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("LogoutUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1476,10 +1511,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling LogoutUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling LogoutUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("LogoutUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1558,10 +1594,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdateUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdateUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, @@ -1641,10 +1678,11 @@ namespace IO.Swagger.Api int localVarStatusCode = (int) localVarResponse.StatusCode; - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling UpdateUser: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling UpdateUser: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UpdateUser", localVarResponse); + if (exception != null) throw exception; + } return new ApiResponse(localVarStatusCode, diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs index 4331456ceaa..c5a2de83da1 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs @@ -36,15 +36,28 @@ using RestSharp; namespace IO.Swagger.Client { /// - /// API client is mainly responible for making the HTTP call to the API backend. + /// API client is mainly responsible for making the HTTP call to the API backend. /// - public class ApiClient + public partial class ApiClient { private JsonSerializerSettings serializerSettings = new JsonSerializerSettings { ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor }; + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(IRestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(IRestRequest request, IRestResponse response); + /// /// Initializes a new instance of the class /// with default configuration and base path (http://petstore.swagger.io/v2). @@ -177,7 +190,10 @@ namespace IO.Swagger.Client // set user agent RestClient.UserAgent = Configuration.UserAgent; + InterceptRequest(request); var response = RestClient.Execute(request); + InterceptResponse(request, response); + return (Object) response; } /// @@ -202,7 +218,9 @@ namespace IO.Swagger.Client var request = PrepareRequest( path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams, contentType); + InterceptRequest(request); var response = await RestClient.ExecuteTaskAsync(request); + InterceptResponse(request, response); return (Object)response; } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs index 451f6d61354..533b994dab2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs @@ -101,6 +101,17 @@ namespace IO.Swagger.Client /// Configuration. public static Configuration Default = new Configuration(); + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + int status = (int) response.StatusCode; + if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); + if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); + return null; + }; + /// /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs new file mode 100644 index 00000000000..24e5fad478f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs @@ -0,0 +1,7 @@ +using System; +using RestSharp; + +namespace IO.Swagger.Client +{ + public delegate Exception ExceptionFactory(string methodName, IRestResponse response); +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs index 1c91ef50003..65ff8bef73b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IApiAccessor.cs @@ -45,5 +45,10 @@ namespace IO.Swagger.Client /// /// The base path String GetBasePath(); + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 20fdb3385e1..a484b5b5026 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {C81D6286-7BA5-4920-8591-F59169CCE4A4} + {EE727567-9CAF-4258-AA0E-FDF89487D7D6} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index eb1a6a8924b..5e50732ee0b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -60,7 +60,7 @@ namespace IO.Swagger.Model /// DateTime. /// Uuid. /// Password (required). - public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) + public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, decimal? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null) { // to ensure "Number" is required (not null) if (Number == null) @@ -128,7 +128,7 @@ namespace IO.Swagger.Model /// Gets or Sets Number /// [DataMember(Name="number", EmitDefaultValue=false)] - public double? Number { get; set; } + public decimal? Number { get; set; } /// /// Gets or Sets _Float /// From d924a1411bf0037731f1807fb8f9d82ce17197ad Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 10 Jun 2016 21:58:16 +0800 Subject: [PATCH 59/67] remove debugging flag, add batch file for rails5 generator --- bin/rails5-petstore-server.sh | 2 +- bin/windows/rails5-petstore-server.bat | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 bin/windows/rails5-petstore-server.bat diff --git a/bin/rails5-petstore-server.sh b/bin/rails5-petstore-server.sh index 9997a83f6a7..28b3ca3069b 100755 --- a/bin/rails5-petstore-server.sh +++ b/bin/rails5-petstore-server.sh @@ -25,7 +25,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DdebugSupportingFiles" +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -t modules/swagger-codegen/src/main/resources/rails5 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l rails5 -o samples/server/petstore/rails5" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/rails5-petstore-server.bat b/bin/windows/rails5-petstore-server.bat new file mode 100755 index 00000000000..a0316279784 --- /dev/null +++ b/bin/windows/rails5-petstore-server.bat @@ -0,0 +1,10 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -t modules\swagger-codegen\src\main\resources\rails5 -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l rails5 -o samples\server\petstore\rails5\ + +java %JAVA_OPTS% -jar %executable% %ags% From 7de95c52c1e047d9ae3adb9f01f7e27fdb586963 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 10 Jun 2016 22:43:56 +0800 Subject: [PATCH 60/67] add apache 2.0 license to perl api client --- .../main/resources/perl/ApiClient.mustache | 6 + .../main/resources/perl/ApiFactory.mustache | 6 + .../src/main/resources/perl/AutoDoc.mustache | 6 + .../main/resources/perl/BaseObject.mustache | 6 + .../resources/perl/Configuration.mustache | 6 + .../src/main/resources/perl/Role.mustache | 6 + .../src/main/resources/perl/api.mustache | 17 +- .../src/main/resources/perl/api_test.mustache | 19 +- .../src/main/resources/perl/object.mustache | 9 +- .../main/resources/perl/object_test.mustache | 7 +- .../petstore/perl/.swagger-codegen-ignore | 23 ++ samples/client/petstore/perl/LICENSE | 201 +++++++++++++ samples/client/petstore/perl/README.md | 52 +++- .../perl/docs/AdditionalPropertiesClass.md | 16 ++ samples/client/petstore/perl/docs/Animal.md | 1 + .../client/petstore/perl/docs/AnimalFarm.md | 14 + .../client/petstore/perl/docs/ArrayTest.md | 17 ++ samples/client/petstore/perl/docs/Cat.md | 1 + samples/client/petstore/perl/docs/Dog.md | 1 + .../client/petstore/perl/docs/EnumClass.md | 14 + samples/client/petstore/perl/docs/EnumTest.md | 17 ++ samples/client/petstore/perl/docs/FakeApi.md | 79 ++++++ .../client/petstore/perl/docs/FormatTest.md | 7 +- ...dPropertiesAndAdditionalPropertiesClass.md | 17 ++ samples/client/petstore/perl/docs/Name.md | 2 + samples/client/petstore/perl/docs/PetApi.md | 200 ++----------- .../petstore/perl/docs/ReadOnlyFirst.md | 16 ++ samples/client/petstore/perl/docs/StoreApi.md | 136 +-------- samples/client/petstore/perl/git_push.sh | 4 +- .../perl/lib/WWW/SwaggerClient/ApiClient.pm | 31 ++ .../perl/lib/WWW/SwaggerClient/ApiFactory.pm | 31 ++ .../lib/WWW/SwaggerClient/Configuration.pm | 31 ++ .../perl/lib/WWW/SwaggerClient/FakeApi.pm | 264 ++++++++++++++++++ .../Object/AdditionalPropertiesClass.pm | 198 +++++++++++++ .../lib/WWW/SwaggerClient/Object/Animal.pm | 78 +++++- .../WWW/SwaggerClient/Object/AnimalFarm.pm | 182 ++++++++++++ .../WWW/SwaggerClient/Object/ApiResponse.pm | 65 ++++- .../lib/WWW/SwaggerClient/Object/ArrayTest.pm | 207 ++++++++++++++ .../perl/lib/WWW/SwaggerClient/Object/Cat.pm | 74 ++++- .../lib/WWW/SwaggerClient/Object/Category.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/Object/Dog.pm | 74 ++++- .../lib/WWW/SwaggerClient/Object/EnumClass.pm | 182 ++++++++++++ .../lib/WWW/SwaggerClient/Object/EnumTest.pm | 207 ++++++++++++++ .../WWW/SwaggerClient/Object/FormatTest.pm | 74 ++++- ...dPropertiesAndAdditionalPropertiesClass.pm | 207 ++++++++++++++ .../SwaggerClient/Object/Model200Response.pm | 65 ++++- .../WWW/SwaggerClient/Object/ModelReturn.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/Object/Name.pm | 87 +++++- .../lib/WWW/SwaggerClient/Object/Order.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/Object/Pet.pm | 65 ++++- .../WWW/SwaggerClient/Object/ReadOnlyFirst.pm | 198 +++++++++++++ .../SwaggerClient/Object/SpecialModelName.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/Object/Tag.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/Object/User.pm | 65 ++++- .../perl/lib/WWW/SwaggerClient/PetApi.pm | 42 ++- .../perl/lib/WWW/SwaggerClient/Role.pm | 35 ++- .../lib/WWW/SwaggerClient/Role/AutoDoc.pm | 31 ++ .../perl/lib/WWW/SwaggerClient/StoreApi.pm | 42 ++- .../perl/lib/WWW/SwaggerClient/UserApi.pm | 42 ++- .../perl/t/AdditionalPropertiesClassTest.t | 17 ++ .../client/petstore/perl/t/AnimalFarmTest.t | 17 ++ .../client/petstore/perl/t/ArrayTestTest.t | 17 ++ .../client/petstore/perl/t/EnumClassTest.t | 17 ++ samples/client/petstore/perl/t/EnumTestTest.t | 17 ++ samples/client/petstore/perl/t/FakeApiTest.t | 52 ++++ ...opertiesAndAdditionalPropertiesClassTest.t | 17 ++ .../petstore/perl/t/ReadOnlyFirstTest.t | 17 ++ 67 files changed, 3562 insertions(+), 417 deletions(-) create mode 100644 samples/client/petstore/perl/.swagger-codegen-ignore create mode 100644 samples/client/petstore/perl/LICENSE create mode 100644 samples/client/petstore/perl/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/perl/docs/AnimalFarm.md create mode 100644 samples/client/petstore/perl/docs/ArrayTest.md create mode 100644 samples/client/petstore/perl/docs/EnumClass.md create mode 100644 samples/client/petstore/perl/docs/EnumTest.md create mode 100644 samples/client/petstore/perl/docs/FakeApi.md create mode 100644 samples/client/petstore/perl/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/perl/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AdditionalPropertiesClass.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AnimalFarm.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumClass.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumTest.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm create mode 100644 samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ReadOnlyFirst.pm create mode 100644 samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t create mode 100644 samples/client/petstore/perl/t/AnimalFarmTest.t create mode 100644 samples/client/petstore/perl/t/ArrayTestTest.t create mode 100644 samples/client/petstore/perl/t/EnumClassTest.t create mode 100644 samples/client/petstore/perl/t/EnumTestTest.t create mode 100644 samples/client/petstore/perl/t/FakeApiTest.t create mode 100644 samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t create mode 100644 samples/client/petstore/perl/t/ReadOnlyFirstTest.t diff --git a/modules/swagger-codegen/src/main/resources/perl/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/perl/ApiClient.mustache index 401a33eddad..4da9f8fb41e 100644 --- a/modules/swagger-codegen/src/main/resources/perl/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/ApiClient.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package {{moduleName}}::ApiClient; use strict; diff --git a/modules/swagger-codegen/src/main/resources/perl/ApiFactory.mustache b/modules/swagger-codegen/src/main/resources/perl/ApiFactory.mustache index ef5f322a014..cbda8660c20 100644 --- a/modules/swagger-codegen/src/main/resources/perl/ApiFactory.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/ApiFactory.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package {{moduleName}}::ApiFactory; use strict; diff --git a/modules/swagger-codegen/src/main/resources/perl/AutoDoc.mustache b/modules/swagger-codegen/src/main/resources/perl/AutoDoc.mustache index 3c10c2450fe..2d5eb5208cf 100644 --- a/modules/swagger-codegen/src/main/resources/perl/AutoDoc.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/AutoDoc.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package {{moduleName}}::Role::AutoDoc; use List::MoreUtils qw(uniq); diff --git a/modules/swagger-codegen/src/main/resources/perl/BaseObject.mustache b/modules/swagger-codegen/src/main/resources/perl/BaseObject.mustache index 9f262543acd..80ecda42a4d 100644 --- a/modules/swagger-codegen/src/main/resources/perl/BaseObject.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/BaseObject.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/modules/swagger-codegen/src/main/resources/perl/Configuration.mustache b/modules/swagger-codegen/src/main/resources/perl/Configuration.mustache index e0ed9bf3295..500d816b178 100644 --- a/modules/swagger-codegen/src/main/resources/perl/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/Configuration.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package {{moduleName}}::Configuration; use strict; diff --git a/modules/swagger-codegen/src/main/resources/perl/Role.mustache b/modules/swagger-codegen/src/main/resources/perl/Role.mustache index fb343ccb890..0c8c1a0375b 100644 --- a/modules/swagger-codegen/src/main/resources/perl/Role.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/Role.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package {{moduleName}}::Role; use utf8; diff --git a/modules/swagger-codegen/src/main/resources/perl/api.mustache b/modules/swagger-codegen/src/main/resources/perl/api.mustache index d7ece2d1e65..3ac7f435908 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api.mustache @@ -1,21 +1,8 @@ -# -# Copyright 2016 SmartBear Software -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +{{>partial_license}} # # NOTE: This class is auto generated by the swagger code generator program. # Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen # package {{moduleName}}::{{classname}}; diff --git a/modules/swagger-codegen/src/main/resources/perl/api_test.mustache b/modules/swagger-codegen/src/main/resources/perl/api_test.mustache index 98d1e9cce99..6ae0a8b286a 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api_test.mustache @@ -1,21 +1,8 @@ -# -# Copyright 2016 SmartBear Software -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +{{>partial_license}} # # NOTE: This class is auto generated by Swagger Codegen -# Please update the test case below to test the API endpoints. +# Please update the test cases below to test the API endpoints. +# Ref: https://github.com/swagger-api/swagger-codegen # use Test::More tests => 1; #TODO update number of test cases use Test::Exception; diff --git a/modules/swagger-codegen/src/main/resources/perl/object.mustache b/modules/swagger-codegen/src/main/resources/perl/object.mustache index 126c6409c7f..bb19479c61d 100644 --- a/modules/swagger-codegen/src/main/resources/perl/object.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/object.mustache @@ -1,3 +1,9 @@ +{{>partial_license}} +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# {{#models}} {{#model}} package {{moduleName}}::Object::{{classname}}; @@ -19,7 +25,8 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # #{{description}} # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # {{>BaseObject}} diff --git a/modules/swagger-codegen/src/main/resources/perl/object_test.mustache b/modules/swagger-codegen/src/main/resources/perl/object_test.mustache index dd76f9ac2d7..08ea9200a0a 100644 --- a/modules/swagger-codegen/src/main/resources/perl/object_test.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/object_test.mustache @@ -1,6 +1,9 @@ +{{>partial_license}} +# # NOTE: This class is auto generated by the Swagger Codegen -# Please update the test case below to test the model. - +# Please update the test cases below to test the model. +# Ref: https://github.com/swagger-api/swagger-codegen +# use Test::More tests => 2; use Test::Exception; diff --git a/samples/client/petstore/perl/.swagger-codegen-ignore b/samples/client/petstore/perl/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/perl/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/perl/LICENSE b/samples/client/petstore/perl/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/perl/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index a4c5c47558a..5e12d98f02f 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -2,7 +2,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # VERSION @@ -10,7 +10,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-13T22:41:41.133+08:00 +- Build date: 2016-06-10T22:39:40.931+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen ## A note on Moose @@ -223,6 +223,7 @@ Each of these calls returns a hashref with various useful pieces of information. To load the API packages: ```perl +use WWW::SwaggerClient::FakeApi; use WWW::SwaggerClient::PetApi; use WWW::SwaggerClient::StoreApi; use WWW::SwaggerClient::UserApi; @@ -231,17 +232,24 @@ use WWW::SwaggerClient::UserApi; To load the models: ```perl +use WWW::SwaggerClient::Object::AdditionalPropertiesClass; use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::AnimalFarm; use WWW::SwaggerClient::Object::ApiResponse; +use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; +use WWW::SwaggerClient::Object::EnumClass; +use WWW::SwaggerClient::Object::EnumTest; use WWW::SwaggerClient::Object::FormatTest; +use WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::Order; use WWW::SwaggerClient::Object::Pet; +use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::SpecialModelName; use WWW::SwaggerClient::Object::Tag; use WWW::SwaggerClient::Object::User; @@ -256,22 +264,30 @@ use lib 'lib'; use strict; use warnings; # load the API package +use WWW::SwaggerClient::FakeApi; use WWW::SwaggerClient::PetApi; use WWW::SwaggerClient::StoreApi; use WWW::SwaggerClient::UserApi; # load the models +use WWW::SwaggerClient::Object::AdditionalPropertiesClass; use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::AnimalFarm; use WWW::SwaggerClient::Object::ApiResponse; +use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; +use WWW::SwaggerClient::Object::EnumClass; +use WWW::SwaggerClient::Object::EnumTest; use WWW::SwaggerClient::Object::FormatTest; +use WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::Order; use WWW::SwaggerClient::Object::Pet; +use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::SpecialModelName; use WWW::SwaggerClient::Object::Tag; use WWW::SwaggerClient::Object::User; @@ -279,17 +295,25 @@ use WWW::SwaggerClient::Object::User; # for displaying the API response data use Data::Dumper; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $body = WWW::SwaggerClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $number = 3.4; # Number | None +my $double = 1.2; # double | None +my $string = 'string_example'; # string | None +my $byte = 'B'; # string | None +my $integer = 56; # int | None +my $int32 = 56; # int | None +my $int64 = 789; # int | None +my $float = 3.4; # double | None +my $binary = 'B'; # string | None +my $date = DateTime->from_epoch(epoch => str2time('2013-10-20')); # DateTime | None +my $date_time = DateTime->from_epoch(epoch => str2time('2013-10-20T19:20:30+01:00')); # DateTime | None +my $password = 'password_example'; # string | None eval { - $api_instance->add_pet(body => $body); + $api_instance->test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password); }; if ($@) { - warn "Exception when calling PetApi->add_pet: $@\n"; + warn "Exception when calling FakeApi->test_endpoint_parameters: $@\n"; } ``` @@ -300,6 +324,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status @@ -323,17 +348,24 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR MODELS + - [WWW::SwaggerClient::Object::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - [WWW::SwaggerClient::Object::Animal](docs/Animal.md) + - [WWW::SwaggerClient::Object::AnimalFarm](docs/AnimalFarm.md) - [WWW::SwaggerClient::Object::ApiResponse](docs/ApiResponse.md) + - [WWW::SwaggerClient::Object::ArrayTest](docs/ArrayTest.md) - [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md) - [WWW::SwaggerClient::Object::Dog](docs/Dog.md) + - [WWW::SwaggerClient::Object::EnumClass](docs/EnumClass.md) + - [WWW::SwaggerClient::Object::EnumTest](docs/EnumTest.md) - [WWW::SwaggerClient::Object::FormatTest](docs/FormatTest.md) + - [WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::SwaggerClient::Object::Name](docs/Name.md) - [WWW::SwaggerClient::Object::Order](docs/Order.md) - [WWW::SwaggerClient::Object::Pet](docs/Pet.md) + - [WWW::SwaggerClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md) - [WWW::SwaggerClient::Object::Tag](docs/Tag.md) - [WWW::SwaggerClient::Object::User](docs/User.md) @@ -351,7 +383,7 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - **write:pets**: modify pets in your account - **read:pets**: read your pets diff --git a/samples/client/petstore/perl/docs/AdditionalPropertiesClass.md b/samples/client/petstore/perl/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..ab590075a14 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# WWW::SwaggerClient::Object::AdditionalPropertiesClass + +## Load the model package +```perl +use WWW::SwaggerClient::Object::AdditionalPropertiesClass; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_property** | **HASH[string,string]** | | [optional] +**map_of_map_property** | **HASH[string,HASH[string,string]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/Animal.md b/samples/client/petstore/perl/docs/Animal.md index d243a90905d..38cc8ac0690 100644 --- a/samples/client/petstore/perl/docs/Animal.md +++ b/samples/client/petstore/perl/docs/Animal.md @@ -9,6 +9,7 @@ use WWW::SwaggerClient::Object::Animal; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **string** | | +**color** | **string** | | [optional] [default to 'red'] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/AnimalFarm.md b/samples/client/petstore/perl/docs/AnimalFarm.md new file mode 100644 index 00000000000..18848e9c0ba --- /dev/null +++ b/samples/client/petstore/perl/docs/AnimalFarm.md @@ -0,0 +1,14 @@ +# WWW::SwaggerClient::Object::AnimalFarm + +## Load the model package +```perl +use WWW::SwaggerClient::Object::AnimalFarm; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/ArrayTest.md b/samples/client/petstore/perl/docs/ArrayTest.md new file mode 100644 index 00000000000..635c26a893a --- /dev/null +++ b/samples/client/petstore/perl/docs/ArrayTest.md @@ -0,0 +1,17 @@ +# WWW::SwaggerClient::Object::ArrayTest + +## Load the model package +```perl +use WWW::SwaggerClient::Object::ArrayTest; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_of_string** | **ARRAY[string]** | | [optional] +**array_array_of_integer** | **ARRAY[ARRAY[int]]** | | [optional] +**array_array_of_model** | **ARRAY[ARRAY[ReadOnlyFirst]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/Cat.md b/samples/client/petstore/perl/docs/Cat.md index 978e4202394..0539f73e502 100644 --- a/samples/client/petstore/perl/docs/Cat.md +++ b/samples/client/petstore/perl/docs/Cat.md @@ -9,6 +9,7 @@ use WWW::SwaggerClient::Object::Cat; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **string** | | +**color** | **string** | | [optional] [default to 'red'] **declawed** | **boolean** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/Dog.md b/samples/client/petstore/perl/docs/Dog.md index 16e399c3aae..16d3972d2b5 100644 --- a/samples/client/petstore/perl/docs/Dog.md +++ b/samples/client/petstore/perl/docs/Dog.md @@ -9,6 +9,7 @@ use WWW::SwaggerClient::Object::Dog; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **string** | | +**color** | **string** | | [optional] [default to 'red'] **breed** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/EnumClass.md b/samples/client/petstore/perl/docs/EnumClass.md new file mode 100644 index 00000000000..c4e40dbf06b --- /dev/null +++ b/samples/client/petstore/perl/docs/EnumClass.md @@ -0,0 +1,14 @@ +# WWW::SwaggerClient::Object::EnumClass + +## Load the model package +```perl +use WWW::SwaggerClient::Object::EnumClass; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/EnumTest.md b/samples/client/petstore/perl/docs/EnumTest.md new file mode 100644 index 00000000000..0c3416150e1 --- /dev/null +++ b/samples/client/petstore/perl/docs/EnumTest.md @@ -0,0 +1,17 @@ +# WWW::SwaggerClient::Object::EnumTest + +## Load the model package +```perl +use WWW::SwaggerClient::Object::EnumTest; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **string** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **double** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md new file mode 100644 index 00000000000..94c13795a10 --- /dev/null +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -0,0 +1,79 @@ +# WWW::SwaggerClient::FakeApi + +## Load the API package +```perl +use WWW::SwaggerClient::Object::FakeApi; +``` + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + +# **test_endpoint_parameters** +> test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```perl +use Data::Dumper; + +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $number = 3.4; # Number | None +my $double = 1.2; # double | None +my $string = 'string_example'; # string | None +my $byte = 'B'; # string | None +my $integer = 56; # int | None +my $int32 = 56; # int | None +my $int64 = 789; # int | None +my $float = 3.4; # double | None +my $binary = 'B'; # string | None +my $date = DateTime->from_epoch(epoch => str2time('2013-10-20')); # DateTime | None +my $date_time = DateTime->from_epoch(epoch => str2time('2013-10-20T19:20:30+01:00')); # DateTime | None +my $password = 'password_example'; # string | None + +eval { + $api_instance->test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password); +}; +if ($@) { + warn "Exception when calling FakeApi->test_endpoint_parameters: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **Number**| None | + **double** | **double**| None | + **string** | **string**| None | + **byte** | **string**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **binary** | **string**| None | [optional] + **date** | **DateTime**| None | [optional] + **date_time** | **DateTime**| None | [optional] + **password** | **string**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/perl/docs/FormatTest.md b/samples/client/petstore/perl/docs/FormatTest.md index 60cd71ac61f..9ba3aeaf17b 100644 --- a/samples/client/petstore/perl/docs/FormatTest.md +++ b/samples/client/petstore/perl/docs/FormatTest.md @@ -15,11 +15,12 @@ Name | Type | Description | Notes **float** | **double** | | [optional] **double** | **double** | | [optional] **string** | **string** | | [optional] -**byte** | **string** | | [optional] +**byte** | **string** | | **binary** | **string** | | [optional] -**date** | **DateTime** | | [optional] +**date** | **DateTime** | | **date_time** | **DateTime** | | [optional] -**password** | **string** | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] +**password** | **string** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/perl/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..28bf101a8a1 --- /dev/null +++ b/samples/client/petstore/perl/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```perl +use WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | [**UUID**](UUID.md) | | [optional] +**date_time** | **DateTime** | | [optional] +**map** | [**HASH[string,Animal]**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/Name.md b/samples/client/petstore/perl/docs/Name.md index 7109642a08b..1407fb99bcb 100644 --- a/samples/client/petstore/perl/docs/Name.md +++ b/samples/client/petstore/perl/docs/Name.md @@ -10,6 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **int** | | **snake_case** | **int** | | [optional] +**property** | **string** | | [optional] +**_123_number** | **int** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 829dc3a08ef..c2f4e2ce4ee 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -10,13 +10,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -51,7 +48,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -64,53 +61,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **add_pet_using_byte_array** -> add_pet_using_byte_array(body => $body) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```perl -use Data::Dumper; - -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $body = WWW::SwaggerClient::Object::string->new(); # string | Pet object in the form of byte array - -eval { - $api_instance->add_pet_using_byte_array(body => $body); -}; -if ($@) { - warn "Exception when calling PetApi->add_pet_using_byte_array: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **string**| Pet object in the form of byte array | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -158,7 +109,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -177,7 +128,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $status = (); # ARRAY[string] | Status values that need to be considered for query +my $status = (); # ARRAY[string] | Status values that need to be considered for filter eval { my $result = $api_instance->find_pets_by_status(status => $status); @@ -192,7 +143,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for filter | ### Return type @@ -205,7 +156,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,7 +165,7 @@ Name | Type | Description | Notes Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```perl @@ -239,7 +190,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | [optional] + **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | ### Return type @@ -252,7 +203,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -261,7 +212,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```perl @@ -271,11 +222,9 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # uncomment below to setup prefix (e.g. Bearer) for API key, if needed #$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched +my $pet_id = 789; # int | ID of pet to return eval { my $result = $api_instance->get_pet_by_id(pet_id => $pet_id); @@ -290,7 +239,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet to return | ### Return type @@ -298,114 +247,12 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_pet_by_id_in_object** -> InlineResponse200 get_pet_by_id_in_object(pet_id => $pet_id) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched - -eval { - my $result = $api_instance->get_pet_by_id_in_object(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->get_pet_by_id_in_object: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **pet_pet_idtesting_byte_arraytrue_get** -> string pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id) - -Fake endpoint to test byte array return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched - -eval { - my $result = $api_instance->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -**string** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -438,7 +285,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -451,7 +298,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -470,7 +317,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 'pet_id_example'; # string | ID of pet that needs to be updated +my $pet_id = 789; # int | ID of pet that needs to be updated my $name = 'name_example'; # string | Updated name of the pet my $status = 'status_example'; # string | Updated status of the pet @@ -486,7 +333,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **string**| ID of pet that needs to be updated | + **pet_id** | **int**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -501,12 +348,12 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) +> ApiResponse upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) uploads an image @@ -525,7 +372,8 @@ my $additional_metadata = 'additional_metadata_example'; # string | Additional d my $file = '/path/to/file.txt'; # File | file to upload eval { - $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); + my $result = $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); + print Dumper($result); }; if ($@) { warn "Exception when calling PetApi->upload_file: $@\n"; @@ -542,7 +390,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -551,7 +399,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/ReadOnlyFirst.md b/samples/client/petstore/perl/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..51f643016bc --- /dev/null +++ b/samples/client/petstore/perl/docs/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# WWW::SwaggerClient::Object::ReadOnlyFirst + +## Load the model package +```perl +use WWW::SwaggerClient::Object::ReadOnlyFirst; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **string** | | [optional] +**baz** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index c5eb55a3f12..f0681b47167 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -10,9 +10,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet @@ -56,60 +54,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **find_orders_by_status** -> ARRAY[Order] find_orders_by_status(status => $status) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: test_api_client_id -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "Bearer"; -# Configure API key authorization: test_api_client_secret -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "Bearer"; - -my $api_instance = WWW::SwaggerClient::StoreApi->new(); -my $status = 'status_example'; # string | Status value that needs to be considered for query - -eval { - my $result = $api_instance->find_orders_by_status(status => $status); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->find_orders_by_status: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**ARRAY[Order]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -154,52 +99,7 @@ This endpoint does not need any parameter. ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_inventory_in_object** -> object get_inventory_in_object() - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "Bearer"; - -my $api_instance = WWW::SwaggerClient::StoreApi->new(); - -eval { - my $result = $api_instance->get_inventory_in_object(); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->get_inventory_in_object: $@\n"; -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**object** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,17 +114,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```perl use Data::Dumper; -# Configure API key authorization: test_api_key_header -$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "Bearer"; -# Configure API key authorization: test_api_key_query -$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "Bearer"; - my $api_instance = WWW::SwaggerClient::StoreApi->new(); -my $order_id = 'order_id_example'; # string | ID of pet that needs to be fetched +my $order_id = 789; # int | ID of pet that needs to be fetched eval { my $result = $api_instance->get_order_by_id(order_id => $order_id); @@ -239,7 +130,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| ID of pet that needs to be fetched | + **order_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -247,12 +138,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -267,15 +158,6 @@ Place an order for a pet ```perl use Data::Dumper; -# Configure API key authorization: test_api_client_id -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "Bearer"; -# Configure API key authorization: test_api_client_secret -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. Bearer) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "Bearer"; - my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $body = WWW::SwaggerClient::Object::Order->new(); # Order | order placed for purchasing the pet @@ -292,7 +174,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -300,12 +182,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/git_push.sh b/samples/client/petstore/perl/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/perl/git_push.sh +++ b/samples/client/petstore/perl/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm index 3dfa6633ee5..9b990cd26b0 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::ApiClient; use strict; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiFactory.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiFactory.pm index 0ffd5498420..daf6735e804 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiFactory.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiFactory.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::ApiFactory; use strict; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Configuration.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Configuration.pm index 150db4cfac2..e99ca4df5fa 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Configuration.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Configuration.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Configuration; use strict; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm new file mode 100644 index 00000000000..905690756bb --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm @@ -0,0 +1,264 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::FakeApi; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use Exporter; +use Carp qw( croak ); +use Log::Any qw($log); + +use WWW::SwaggerClient::ApiClient; +use WWW::SwaggerClient::Configuration; + +use base "Class::Data::Inheritable"; + +__PACKAGE__->mk_classdata('method_documentation' => {}); + +sub new { + my $class = shift; + my (%self) = ( + 'api_client' => WWW::SwaggerClient::ApiClient->instance, + @_ + ); + + #my $self = { + # #api_client => $options->{api_client} + # api_client => $default_api_client + #}; + + bless \%self, $class; + +} + + +# +# test_endpoint_parameters +# +# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +# +# @param Number $number None (required) +# @param double $double None (required) +# @param string $string None (required) +# @param string $byte None (required) +# @param int $integer None (optional) +# @param int $int32 None (optional) +# @param int $int64 None (optional) +# @param double $float None (optional) +# @param string $binary None (optional) +# @param DateTime $date None (optional) +# @param DateTime $date_time None (optional) +# @param string $password None (optional) +{ + my $params = { + 'number' => { + data_type => 'Number', + description => 'None', + required => '1', + }, + 'double' => { + data_type => 'double', + description => 'None', + required => '1', + }, + 'string' => { + data_type => 'string', + description => 'None', + required => '1', + }, + 'byte' => { + data_type => 'string', + description => 'None', + required => '1', + }, + 'integer' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'int32' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'int64' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'float' => { + data_type => 'double', + description => 'None', + required => '0', + }, + 'binary' => { + data_type => 'string', + description => 'None', + required => '0', + }, + 'date' => { + data_type => 'DateTime', + description => 'None', + required => '0', + }, + 'date_time' => { + data_type => 'DateTime', + description => 'None', + required => '0', + }, + 'password' => { + data_type => 'string', + description => 'None', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ test_endpoint_parameters } = { + summary => 'Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ', + params => $params, + returns => undef, + }; +} +# @return void +# +sub test_endpoint_parameters { + my ($self, %args) = @_; + + # verify the required parameter 'number' is set + unless (exists $args{'number'}) { + croak("Missing the required parameter 'number' when calling test_endpoint_parameters"); + } + + # verify the required parameter 'double' is set + unless (exists $args{'double'}) { + croak("Missing the required parameter 'double' when calling test_endpoint_parameters"); + } + + # verify the required parameter 'string' is set + unless (exists $args{'string'}) { + croak("Missing the required parameter 'string' when calling test_endpoint_parameters"); + } + + # verify the required parameter 'byte' is set + unless (exists $args{'byte'}) { + croak("Missing the required parameter 'byte' when calling test_endpoint_parameters"); + } + + # parse inputs + my $_resource_path = '/fake'; + $_resource_path =~ s/{format}/json/; # default format to json + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('application/xml; charset=utf-8', 'application/json; charset=utf-8'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/xml; charset=utf-8', 'application/json; charset=utf-8'); + + # form params + if ( exists $args{'integer'} ) { + $form_params->{'integer'} = $self->{api_client}->to_form_value($args{'integer'}); + } + + # form params + if ( exists $args{'int32'} ) { + $form_params->{'int32'} = $self->{api_client}->to_form_value($args{'int32'}); + } + + # form params + if ( exists $args{'int64'} ) { + $form_params->{'int64'} = $self->{api_client}->to_form_value($args{'int64'}); + } + + # form params + if ( exists $args{'number'} ) { + $form_params->{'number'} = $self->{api_client}->to_form_value($args{'number'}); + } + + # form params + if ( exists $args{'float'} ) { + $form_params->{'float'} = $self->{api_client}->to_form_value($args{'float'}); + } + + # form params + if ( exists $args{'double'} ) { + $form_params->{'double'} = $self->{api_client}->to_form_value($args{'double'}); + } + + # form params + if ( exists $args{'string'} ) { + $form_params->{'string'} = $self->{api_client}->to_form_value($args{'string'}); + } + + # form params + if ( exists $args{'byte'} ) { + $form_params->{'byte'} = $self->{api_client}->to_form_value($args{'byte'}); + } + + # form params + if ( exists $args{'binary'} ) { + $form_params->{'binary'} = $self->{api_client}->to_form_value($args{'binary'}); + } + + # form params + if ( exists $args{'date'} ) { + $form_params->{'date'} = $self->{api_client}->to_form_value($args{'date'}); + } + + # form params + if ( exists $args{'date_time'} ) { + $form_params->{'dateTime'} = $self->{api_client}->to_form_value($args{'date_time'}); + } + + # form params + if ( exists $args{'password'} ) { + $form_params->{'password'} = $self->{api_client}->to_form_value($args{'password'}); + } + + my $_body_data; + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + return; +} + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AdditionalPropertiesClass.pm new file mode 100644 index 00000000000..76c1f19543c --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AdditionalPropertiesClass.pm @@ -0,0 +1,198 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::AdditionalPropertiesClass; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesClass', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'map_property' => { + datatype => 'HASH[string,string]', + base_name => 'map_property', + description => '', + format => '', + read_only => '', + }, + 'map_of_map_property' => { + datatype => 'HASH[string,HASH[string,string]]', + base_name => 'map_of_map_property', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'map_property' => 'HASH[string,string]', + 'map_of_map_property' => 'HASH[string,HASH[string,string]]' +} ); + +__PACKAGE__->attribute_map( { + 'map_property' => 'map_property', + 'map_of_map_property' => 'map_of_map_property' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm index eb1b10034e9..443701ce326 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Animal.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Animal; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); @@ -110,14 +173,23 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, }); __PACKAGE__->swagger_types( { - 'class_name' => 'string' + 'class_name' => 'string', + 'color' => 'string' } ); __PACKAGE__->attribute_map( { - 'class_name' => 'className' + 'class_name' => 'className', + 'color' => 'color' } ); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AnimalFarm.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AnimalFarm.pm new file mode 100644 index 00000000000..32424c88e52 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/AnimalFarm.pm @@ -0,0 +1,182 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::AnimalFarm; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AnimalFarm', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->swagger_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm index 9203da585b7..d1ee5704703 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ApiResponse.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::ApiResponse; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm new file mode 100644 index 00000000000..fa169ba4674 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm @@ -0,0 +1,207 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::ArrayTest; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'ArrayTest', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'array_of_string' => { + datatype => 'ARRAY[string]', + base_name => 'array_of_string', + description => '', + format => '', + read_only => '', + }, + 'array_array_of_integer' => { + datatype => 'ARRAY[ARRAY[int]]', + base_name => 'array_array_of_integer', + description => '', + format => '', + read_only => '', + }, + 'array_array_of_model' => { + datatype => 'ARRAY[ARRAY[ReadOnlyFirst]]', + base_name => 'array_array_of_model', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'array_of_string' => 'ARRAY[string]', + 'array_array_of_integer' => 'ARRAY[ARRAY[int]]', + 'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]' +} ); + +__PACKAGE__->attribute_map( { + 'array_of_string' => 'array_of_string', + 'array_array_of_integer' => 'array_array_of_integer', + 'array_array_of_model' => 'array_array_of_model' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm index 41e542afd9f..16d524d0c2d 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Cat.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Cat; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); @@ -110,6 +173,13 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, 'declawed' => { datatype => 'boolean', base_name => 'declawed', @@ -121,11 +191,13 @@ __PACKAGE__->method_documentation({ __PACKAGE__->swagger_types( { 'class_name' => 'string', + 'color' => 'string', 'declawed' => 'boolean' } ); __PACKAGE__->attribute_map( { 'class_name' => 'className', + 'color' => 'color', 'declawed' => 'declawed' } ); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Category.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Category.pm index 2d49d6a99b8..30b83ba1e65 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Category.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Category.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Category; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm index 6ac41e2a9ff..4964f4dd97e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Dog.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Dog; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); @@ -110,6 +173,13 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, 'breed' => { datatype => 'string', base_name => 'breed', @@ -121,11 +191,13 @@ __PACKAGE__->method_documentation({ __PACKAGE__->swagger_types( { 'class_name' => 'string', + 'color' => 'string', 'breed' => 'string' } ); __PACKAGE__->attribute_map( { 'class_name' => 'className', + 'color' => 'color', 'breed' => 'breed' } ); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumClass.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumClass.pm new file mode 100644 index 00000000000..89ad6d8cc71 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumClass.pm @@ -0,0 +1,182 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::EnumClass; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'EnumClass', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->swagger_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumTest.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumTest.pm new file mode 100644 index 00000000000..d1806d2b803 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/EnumTest.pm @@ -0,0 +1,207 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::EnumTest; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'EnumTest', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'enum_string' => { + datatype => 'string', + base_name => 'enum_string', + description => '', + format => '', + read_only => '', + }, + 'enum_integer' => { + datatype => 'int', + base_name => 'enum_integer', + description => '', + format => '', + read_only => '', + }, + 'enum_number' => { + datatype => 'double', + base_name => 'enum_number', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'enum_string' => 'string', + 'enum_integer' => 'int', + 'enum_number' => 'double' +} ); + +__PACKAGE__->attribute_map( { + 'enum_string' => 'enum_string', + 'enum_integer' => 'enum_integer', + 'enum_number' => 'enum_number' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm index 725c290b11d..c5779fbe5b9 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/FormatTest.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::FormatTest; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); @@ -180,6 +243,13 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'uuid' => { + datatype => 'UUID', + base_name => 'uuid', + description => '', + format => '', + read_only => '', + }, 'password' => { datatype => 'string', base_name => 'password', @@ -201,6 +271,7 @@ __PACKAGE__->swagger_types( { 'binary' => 'string', 'date' => 'DateTime', 'date_time' => 'DateTime', + 'uuid' => 'UUID', 'password' => 'string' } ); @@ -216,6 +287,7 @@ __PACKAGE__->attribute_map( { 'binary' => 'binary', 'date' => 'date', 'date_time' => 'dateTime', + 'uuid' => 'uuid', 'password' => 'password' } ); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm new file mode 100644 index 00000000000..50a42581c27 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm @@ -0,0 +1,207 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'MixedPropertiesAndAdditionalPropertiesClass', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'uuid' => { + datatype => 'UUID', + base_name => 'uuid', + description => '', + format => '', + read_only => '', + }, + 'date_time' => { + datatype => 'DateTime', + base_name => 'dateTime', + description => '', + format => '', + read_only => '', + }, + 'map' => { + datatype => 'HASH[string,Animal]', + base_name => 'map', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'uuid' => 'UUID', + 'date_time' => 'DateTime', + 'map' => 'HASH[string,Animal]' +} ); + +__PACKAGE__->attribute_map( { + 'uuid' => 'uuid', + 'date_time' => 'dateTime', + 'map' => 'map' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Model200Response.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Model200Response.pm index d64f9497753..7bb7cce1a6e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Model200Response.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Model200Response.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Model200Response; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # #Model for testing model name starting with number # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ModelReturn.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ModelReturn.pm index 682d26d7436..09af2a0884b 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ModelReturn.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ModelReturn.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::ModelReturn; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # #Model for testing reserved words # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Name.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Name.pm index b5a58e0d5fa..50d950fb29a 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Name.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Name.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Name; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # #Model for testing model name same as property name # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); @@ -117,16 +180,34 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'property' => { + datatype => 'string', + base_name => 'property', + description => '', + format => '', + read_only => '', + }, + '_123_number' => { + datatype => 'int', + base_name => '123Number', + description => '', + format => '', + read_only => '', + }, }); __PACKAGE__->swagger_types( { 'name' => 'int', - 'snake_case' => 'int' + 'snake_case' => 'int', + 'property' => 'string', + '_123_number' => 'int' } ); __PACKAGE__->attribute_map( { 'name' => 'name', - 'snake_case' => 'snake_case' + 'snake_case' => 'snake_case', + 'property' => 'property', + '_123_number' => '123Number' } ); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Order.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Order.pm index 6590dba2293..c8fef7564cb 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Order.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Order.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Order; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Pet.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Pet.pm index 50334ab062a..e63f9a4a75a 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Pet.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Pet.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Pet; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ReadOnlyFirst.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ReadOnlyFirst.pm new file mode 100644 index 00000000000..45141fdd1ca --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ReadOnlyFirst.pm @@ -0,0 +1,198 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::ReadOnlyFirst; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'ReadOnlyFirst', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'bar' => { + datatype => 'string', + base_name => 'bar', + description => '', + format => '', + read_only => '', + }, + 'baz' => { + datatype => 'string', + base_name => 'baz', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'bar' => 'string', + 'baz' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'bar' => 'bar', + 'baz' => 'baz' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/SpecialModelName.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/SpecialModelName.pm index 5666b39c07b..e051fd994b6 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/SpecialModelName.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/SpecialModelName.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::SpecialModelName; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Tag.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Tag.pm index b60ccc4a005..250a23c6870 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Tag.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/Tag.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::Tag; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/User.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/User.pm index 8b0555d8aaa..b5c5fcc6e7e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/User.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/User.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Object::User; require 5.6.0; @@ -17,9 +48,41 @@ use base ("Class::Accessor", "Class::Data::Inheritable"); # # # -#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen # +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# __PACKAGE__->mk_classdata('attribute_map' => {}); __PACKAGE__->mk_classdata('swagger_types' => {}); __PACKAGE__->mk_classdata('method_documentation' => {}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm index fd1b4092302..ecb7d70bf5b 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm @@ -1,21 +1,33 @@ -# -# Copyright 2016 SmartBear Software -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + # # NOTE: This class is auto generated by the swagger code generator program. # Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen # package WWW::SwaggerClient::PetApi; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index e72b12a22b8..cc146cb1890 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Role; use utf8; @@ -37,7 +68,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-04-13T22:41:41.133+08:00', + generated_date => '2016-06-10T22:39:40.931+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +134,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-04-13T22:41:41.133+08:00 +=item Build date: 2016-06-10T22:39:40.931+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role/AutoDoc.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role/AutoDoc.pm index d57c96c1798..55e8af85228 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role/AutoDoc.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role/AutoDoc.pm @@ -1,3 +1,34 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# package WWW::SwaggerClient::Role::AutoDoc; use List::MoreUtils qw(uniq); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm index 16a4f13cb1e..f29c64ec1a1 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm @@ -1,21 +1,33 @@ -# -# Copyright 2016 SmartBear Software -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + # # NOTE: This class is auto generated by the swagger code generator program. # Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen # package WWW::SwaggerClient::StoreApi; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm index 75f56f56293..b6b5252e93e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm @@ -1,21 +1,33 @@ -# -# Copyright 2016 SmartBear Software -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=end comment + +=cut + # # NOTE: This class is auto generated by the swagger code generator program. # Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen # package WWW::SwaggerClient::UserApi; diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t new file mode 100644 index 00000000000..03aa037413f --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesClassTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::AdditionalPropertiesClass'); + +my $instance = WWW::SwaggerClient::Object::AdditionalPropertiesClass->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::AdditionalPropertiesClass'); + diff --git a/samples/client/petstore/perl/t/AnimalFarmTest.t b/samples/client/petstore/perl/t/AnimalFarmTest.t new file mode 100644 index 00000000000..4c795259eec --- /dev/null +++ b/samples/client/petstore/perl/t/AnimalFarmTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::AnimalFarm'); + +my $instance = WWW::SwaggerClient::Object::AnimalFarm->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::AnimalFarm'); + diff --git a/samples/client/petstore/perl/t/ArrayTestTest.t b/samples/client/petstore/perl/t/ArrayTestTest.t new file mode 100644 index 00000000000..3873ad59787 --- /dev/null +++ b/samples/client/petstore/perl/t/ArrayTestTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::ArrayTest'); + +my $instance = WWW::SwaggerClient::Object::ArrayTest->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::ArrayTest'); + diff --git a/samples/client/petstore/perl/t/EnumClassTest.t b/samples/client/petstore/perl/t/EnumClassTest.t new file mode 100644 index 00000000000..c1843e3bab4 --- /dev/null +++ b/samples/client/petstore/perl/t/EnumClassTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::EnumClass'); + +my $instance = WWW::SwaggerClient::Object::EnumClass->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::EnumClass'); + diff --git a/samples/client/petstore/perl/t/EnumTestTest.t b/samples/client/petstore/perl/t/EnumTestTest.t new file mode 100644 index 00000000000..6a72a3da4f7 --- /dev/null +++ b/samples/client/petstore/perl/t/EnumTestTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::EnumTest'); + +my $instance = WWW::SwaggerClient::Object::EnumTest->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::EnumTest'); + diff --git a/samples/client/petstore/perl/t/FakeApiTest.t b/samples/client/petstore/perl/t/FakeApiTest.t new file mode 100644 index 00000000000..e57a0e5a048 --- /dev/null +++ b/samples/client/petstore/perl/t/FakeApiTest.t @@ -0,0 +1,52 @@ +# +# Copyright 2016 SmartBear Software +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# NOTE: This class is auto generated by Swagger Codegen +# Please update the test case below to test the API endpoints. +# +use Test::More tests => 1; #TODO update number of test cases +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + +use_ok('WWW::SwaggerClient::FakeApi'); + +my $api = WWW::SwaggerClient::FakeApi->new(); +isa_ok($api, 'WWW::SwaggerClient::FakeApi'); + +# +# test_endpoint_parameters test +# +{ + my $number = undef; # replace NULL with a proper value + my $double = undef; # replace NULL with a proper value + my $string = undef; # replace NULL with a proper value + my $byte = undef; # replace NULL with a proper value + my $integer = undef; # replace NULL with a proper value + my $int32 = undef; # replace NULL with a proper value + my $int64 = undef; # replace NULL with a proper value + my $float = undef; # replace NULL with a proper value + my $binary = undef; # replace NULL with a proper value + my $date = undef; # replace NULL with a proper value + my $date_time = undef; # replace NULL with a proper value + my $password = undef; # replace NULL with a proper value + my $result = $api->test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password); +} + + +1; diff --git a/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t b/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t new file mode 100644 index 00000000000..b6f764e8210 --- /dev/null +++ b/samples/client/petstore/perl/t/MixedPropertiesAndAdditionalPropertiesClassTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass'); + +my $instance = WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass'); + diff --git a/samples/client/petstore/perl/t/ReadOnlyFirstTest.t b/samples/client/petstore/perl/t/ReadOnlyFirstTest.t new file mode 100644 index 00000000000..9c35358bee1 --- /dev/null +++ b/samples/client/petstore/perl/t/ReadOnlyFirstTest.t @@ -0,0 +1,17 @@ +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test case below to test the model. + +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::ReadOnlyFirst'); + +my $instance = WWW::SwaggerClient::Object::ReadOnlyFirst->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::ReadOnlyFirst'); + From 1221a8350474e3e27e3ba081fe34b5d1e5478f2b Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 11 Jun 2016 10:35:50 +0800 Subject: [PATCH 61/67] add python ci --- .travis.yml | 1 + pom.xml | 13 +++++++++++++ samples/client/petstore/python/Makefile | 4 ++-- samples/client/petstore/python/pom.xml | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea9cf505b82..eae1588454c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ before_install: # required when sudo: required for the Ruby petstore tests - gem install bundler - npm install -g typescript + - pip install virtualenv install: diff --git a/pom.xml b/pom.xml index af8c8544e81..40ebc9bb85f 100644 --- a/pom.xml +++ b/pom.xml @@ -522,6 +522,18 @@ samples/client/petstore/typescript-node/npm + + python-client + + + env + java + + + + samples/client/petstore/python + + ruby-client @@ -557,6 +569,7 @@ + samples/client/petstore/python samples/client/petstore/ruby samples/client/petstore/typescript-fetch/tests/default samples/client/petstore/typescript-fetch/builds/default diff --git a/samples/client/petstore/python/Makefile b/samples/client/petstore/python/Makefile index 0f65e0c6ac3..52033cee703 100644 --- a/samples/client/petstore/python/Makefile +++ b/samples/client/petstore/python/Makefile @@ -15,7 +15,7 @@ clean: find . -name "__pycache__" -delete test: clean - bash ./test.sh + bash ./test_python2.sh test-all: clean - bash ./test-all.sh + bash ./test_python2_and_3.sh diff --git a/samples/client/petstore/python/pom.xml b/samples/client/petstore/python/pom.xml index 147938617d2..6eaa49eaea9 100644 --- a/samples/client/petstore/python/pom.xml +++ b/samples/client/petstore/python/pom.xml @@ -1,6 +1,6 @@ 4.0.0 - com.wordnik + io.swagger PythonPetstoreClientTests pom 1.0-SNAPSHOT @@ -35,7 +35,7 @@ make - test + test-all From 661aa25c3dfa628212caf045c8da52e6940810e6 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 11 Jun 2016 10:38:22 +0800 Subject: [PATCH 62/67] sudo to install virtualenv --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eae1588454c..1a0be745a6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: # required when sudo: required for the Ruby petstore tests - gem install bundler - npm install -g typescript - - pip install virtualenv + - sudo pip install virtualenv install: From bc04ebed94ea8036cb3bef86835dc482a57e5778 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 11 Jun 2016 23:44:48 +0800 Subject: [PATCH 63/67] add mono script to nunit test csharp client --- .gitignore | 1 + .../languages/CSharpClientCodegen.java | 2 ++ .../main/resources/csharp/api_test.mustache | 8 +++--- .../resources/csharp/compile-mono.sh.mustache | 5 ++++ .../main/resources/csharp/model_test.mustache | 8 ++++-- .../resources/csharp/mono_nunit_test.mustache | 28 +++++++++++++++++++ .../resources/csharp/packages.config.mustache | 2 +- .../csharp/packages_test.config.mustache | 4 +-- .../csharp/SwaggerClient/IO.Swagger.sln | 10 +++---- .../petstore/csharp/SwaggerClient/README.md | 14 +++++----- .../petstore/csharp/SwaggerClient/build.sh | 5 ++++ .../csharp/SwaggerClient/mono_nunit_test.sh | 25 +++++++++++++++++ .../IO.Swagger.Test/IO.Swagger.Test.csproj | 2 +- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- 14 files changed, 92 insertions(+), 24 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache create mode 100644 samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh diff --git a/.gitignore b/.gitignore index 5eba3895f59..3118eafbcfd 100644 --- a/.gitignore +++ b/.gitignore @@ -112,6 +112,7 @@ samples/client/petstore/csharp/SwaggerClient/bin samples/client/petstore/csharp/SwaggerClient/obj/Debug/ samples/client/petstore/csharp/SwaggerClient/bin/Debug/ samples/client/petstore/csharp/SwaggerClient/packages +samples/client/petstore/csharp/SwaggerClient/TestResult.xml # Python *.pyc diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index 7546d89e968..ef3baedd78e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -238,6 +238,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); + // shell script to run the nunit test + supportingFiles.add(new SupportingFile("mono_nunit_test.mustache", "", "mono_nunit_test.sh")); // copy package.config to nuget's standard location for project-level installs supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config")); diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index cc487fb681e..84904b8c08b 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -61,12 +61,12 @@ namespace {{packageName}}.Test [Test] public void {{operationId}}Test() { - // TODO: add unit test for the method '{{operationId}}' + // TODO uncomment below to test the method '{{operationId}}' {{#allParams}} - {{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value + //{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value {{/allParams}} - {{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} + //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}//Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} } {{/operation}}{{/operations}} } diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache index f93437eb0c8..2d3e96b9677 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache @@ -2,14 +2,19 @@ frameworkVersion={{targetFrameworkNuget}} netfx=${frameworkVersion#net} +echo "[INFO] Target framework: ${frameworkVersion}" + +echo "[INFO] Download nuget and packages" wget -nc https://nuget.org/nuget.exe; mozroots --import --sync mono nuget.exe install src/{{packageName}}/packages.config -o packages; mkdir -p bin; +echo "[INFO] Copy DLLs to the 'bin' folder" cp packages/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; +echo "[INFO] Run 'mcs' to build bin/{{{packageName}}}.dll" mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ System.Runtime.Serialization.dll \ diff --git a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache index f9dd3c08efc..6fcc4672b32 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache @@ -33,7 +33,8 @@ namespace {{packageName}}.Test [SetUp] public void Init() { - instance = new {{classname}}(); + // TODO uncomment below to create an instance of {{classname}} + //instance = new {{classname}}(); } /// @@ -51,7 +52,8 @@ namespace {{packageName}}.Test [Test] public void {{classname}}InstanceTest() { - Assert.IsInstanceOf<{{classname}}> (instance, "instance is a {{classname}}"); + // TODO uncomment below to test "IsInstanceOf" {{classname}} + //Assert.IsInstanceOf<{{classname}}> (instance, "variable 'instance' is a {{classname}}"); } {{#vars}} @@ -61,7 +63,7 @@ namespace {{packageName}}.Test [Test] public void {{name}}Test() { - // TODO: unit test for the property '{{name}}' + // TODO unit test for the property '{{name}}' } {{/vars}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache new file mode 100644 index 00000000000..33b960ac82b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +wget -nc https://nuget.org/nuget.exe +mozroots --import --sync + +echo "[INFO] remove bin/Debug/SwaggerClientTest.dll" +rm src/IO.Swagger.Test/bin/Debug/{{{packageName}}}.Test.dll 2> /dev/null + +echo "[INFO] install NUnit runners via NuGet" +wget -nc https://nuget.org/nuget.exe +mozroots --import --sync +mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages + +echo "[INFO] Copy DLLs to the 'bin' folder" +# for project {{{packageName}}} +cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll src/{{{packageName}}}/bin/Debug/Newtonsoft.Json.dll +cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll src/{{{packageName}}}/bin/Debug/RestSharp.dll +cp packages/NUnit.2.6.4/lib/nunit.framework.dll src/{{{packageName}}}/bin/Debug/nunit.framework.dll +# for project {{{packageName}}}.Test +cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll src/{{{packageName}}}.Test/bin/Debug/Newtonsoft.Json.dll +cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll src/{{{packageName}}}.Test/bin/Debug/RestSharp.dll +cp packages/NUnit.2.6.4/lib/nunit.framework.dll src/{{{packageName}}}.Test/bin/Debug/nunit.framework.dll + +echo "[INFO] Install NUnit runners via NuGet" +mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages + +echo "[INFO] build the solution and run the unit test" +xbuild {{{packageName}}}.sln && \ + mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache index bd4428e687e..d9e5dea7d9f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache @@ -1,5 +1,5 @@ - + diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache index 5464714bcef..7e6f4575391 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache @@ -1,6 +1,6 @@ - + - + diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 740ca6561ac..dc645198f38 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{EE727567-9CAF-4258-AA0E-FDF89487D7D6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7B057377-44BA-47A5-AC6B-70EEB6034E6F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Debug|Any CPU.Build.0 = Debug|Any CPU -{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU -{EE727567-9CAF-4258-AA0E-FDF89487D7D6}.Release|Any CPU.Build.0 = Release|Any CPU +{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Debug|Any CPU.Build.0 = Debug|Any CPU +{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Release|Any CPU.ActiveCfg = Release|Any CPU +{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index c94e740d7b3..38d36d71493 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-06-10T08:07:39.769-04:00 +- Build date: 2016-06-11T23:10:58.942+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -138,6 +138,12 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ### petstore_auth - **Type**: OAuth @@ -147,9 +153,3 @@ Class | Method | HTTP request | Description - write:pets: modify pets in your account - read:pets: read your pets -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - diff --git a/samples/client/petstore/csharp/SwaggerClient/build.sh b/samples/client/petstore/csharp/SwaggerClient/build.sh index 159673fd60c..88180f68398 100644 --- a/samples/client/petstore/csharp/SwaggerClient/build.sh +++ b/samples/client/petstore/csharp/SwaggerClient/build.sh @@ -2,14 +2,19 @@ frameworkVersion=net45 netfx=${frameworkVersion#net} +echo "[INFO] Target framework: ${frameworkVersion}" + +echo "[INFO] Download nuget and packages" wget -nc https://nuget.org/nuget.exe; mozroots --import --sync mono nuget.exe install src/IO.Swagger/packages.config -o packages; mkdir -p bin; +echo "[INFO] Copy DLLs to the 'bin' folder" cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; +echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll" mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\ bin/RestSharp.dll,\ System.Runtime.Serialization.dll \ diff --git a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh new file mode 100644 index 00000000000..e2be7882f39 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +wget -nc https://nuget.org/nuget.exe; +mozroots --import --sync + +echo "[INFO] remove bin/Debug/SwaggerClientTest.dll" +rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null + +echo "[INFO] install NUnit runners via NuGet" +wget -nc https://nuget.org/nuget.exe; +mozroots --import --sync +mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages; + +echo "[INFO] Copy DLLs to the 'bin' folder" +# for project IO.Swagger +cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll src/IO.Swagger/bin/Debug/Newtonsoft.Json.dll +cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll src/IO.Swagger/bin/Debug/RestSharp.dll +cp packages/NUnit.2.6.3/lib/nunit.framework.dll src/IO.Swagger/bin/Debug/nunit.framework.dll +# for project IO.Swagger.Test +cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll src/IO.Swagger.Test/bin/Debug/Newtonsoft.Json.dll +cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll src/IO.Swagger.Test/bin/Debug/RestSharp.dll +cp packages/NUnit.2.6.3/lib/nunit.framework.dll src/IO.Swagger.Test/bin/Debug/nunit.framework.dll + +echo "[INFO] build the solution and run the unit test" +xbuild IO.Swagger.sln && \ + mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/debug/IO.Swagger.Test.dll diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 2cc0dd9525c..2ba51f5afa6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -86,7 +86,7 @@ limitations under the License. - {EE727567-9CAF-4258-AA0E-FDF89487D7D6} + {7B057377-44BA-47A5-AC6B-70EEB6034E6F} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index a484b5b5026..9164a6b3fb0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {EE727567-9CAF-4258-AA0E-FDF89487D7D6} + {7B057377-44BA-47A5-AC6B-70EEB6034E6F} Library Properties Swagger Library From 4b6d372bffbf871bb3e1d7241122533fa49178ed Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 12 Jun 2016 00:39:56 +0800 Subject: [PATCH 64/67] update C# json to 8.0.3 --- .../src/main/resources/csharp/Project.mustache | 8 ++++---- .../main/resources/csharp/TestProject.mustache | 16 ++++++++-------- .../resources/csharp/mono_nunit_test.mustache | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache index a8e18ea91ac..7a4c741ca4a 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache @@ -71,10 +71,10 @@ limitations under the License. - $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache index 2866dcb0601..07448f9cfef 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache @@ -71,10 +71,10 @@ limitations under the License. - $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll @@ -83,10 +83,10 @@ limitations under the License. {{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll - {{binRelativePath}}\NUnit.2.6.3\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + {{binRelativePath}}\NUnit.2.6.4\lib\nunit.framework.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache index 33b960ac82b..32eabefe317 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache @@ -23,6 +23,6 @@ cp packages/NUnit.2.6.4/lib/nunit.framework.dll src/{{{packageName}}}.Test/bin/D echo "[INFO] Install NUnit runners via NuGet" mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages -echo "[INFO] build the solution and run the unit test" +echo "[INFO] Build the solution and run the unit test" xbuild {{{packageName}}}.sln && \ mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll From 6ddf34ce8aa7047591b97182e9da7c7e59e0a11d Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 12 Jun 2016 01:56:31 +0800 Subject: [PATCH 65/67] update nunit to 3.2.1 --- .../resources/csharp/TestProject.mustache | 8 +++---- .../main/resources/csharp/api_test.mustache | 3 ++- .../resources/csharp/compile-mono.sh.mustache | 2 +- .../main/resources/csharp/compile.mustache | 2 +- .../main/resources/csharp/model_test.mustache | 7 ++++--- .../resources/csharp/mono_nunit_test.mustache | 14 ++----------- .../csharp/packages_test.config.mustache | 2 +- .../csharp/SwaggerClient/IO.Swagger.sln | 10 ++++----- .../petstore/csharp/SwaggerClient/README.md | 2 +- .../petstore/csharp/SwaggerClient/build.bat | 2 +- .../petstore/csharp/SwaggerClient/build.sh | 2 +- .../csharp/SwaggerClient/mono_nunit_test.sh | 21 +++++++------------ .../IO.Swagger.Test/IO.Swagger.Test.csproj | 18 ++++++++-------- .../src/IO.Swagger.Test/packages.config | 4 ++-- .../src/IO.Swagger/IO.Swagger.csproj | 10 ++++----- .../src/IO.Swagger/packages.config | 2 +- 16 files changed, 47 insertions(+), 62 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache index 07448f9cfef..f01a7e25dbb 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/TestProject.mustache @@ -83,10 +83,10 @@ limitations under the License. {{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - {{binRelativePath}}\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll + {{binRelativePath}}\NUnit.3.2.1\lib\nunit.framework.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index 84904b8c08b..4a4c2f98952 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -51,7 +51,8 @@ namespace {{packageName}}.Test [Test] public void {{operationId}}InstanceTest() { - Assert.IsInstanceOf<{{classname}}> (instance, "instance is a {{classname}}"); + // TODO uncomment below to test 'IsInstanceOfType' {{classname}} + Assert.IsInstanceOfType(typeof({{classname}}), instance, "instance is a {{classname}}"); } {{#operations}}{{#operation}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache index 2d3e96b9677..ea35b5d0b9c 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache @@ -11,7 +11,7 @@ mono nuget.exe install src/{{packageName}}/packages.config -o packages; mkdir -p bin; echo "[INFO] Copy DLLs to the 'bin' folder" -cp packages/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; echo "[INFO] Run 'mcs' to build bin/{{{packageName}}}.dll" diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache index 7f6dcfe0713..0164719456a 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache @@ -8,7 +8,7 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.8.0.2\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\Newtonsoft.Json.8.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\{{packageName}}.dll /recurse:src\{{packageName}}\*.cs /doc:bin\{{packageName}}.xml diff --git a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache index 6fcc4672b32..233534a3348 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model_test.mustache @@ -25,7 +25,8 @@ namespace {{packageName}}.Test [TestFixture] public class {{classname}}Tests { - private {{classname}} instance; + // TODO uncomment below to declare an instance variable for {{classname}} + //private {{classname}} instance; /// /// Setup before each test @@ -52,8 +53,8 @@ namespace {{packageName}}.Test [Test] public void {{classname}}InstanceTest() { - // TODO uncomment below to test "IsInstanceOf" {{classname}} - //Assert.IsInstanceOf<{{classname}}> (instance, "variable 'instance' is a {{classname}}"); + // TODO uncomment below to test "IsInstanceOfType" {{classname}} + //Assert.IsInstanceOfType<{{classname}}> (instance, "variable 'instance' is a {{classname}}"); } {{#vars}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache index 32eabefe317..52daa1c5063 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache @@ -10,19 +10,9 @@ wget -nc https://nuget.org/nuget.exe mozroots --import --sync mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages -echo "[INFO] Copy DLLs to the 'bin' folder" -# for project {{{packageName}}} -cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll src/{{{packageName}}}/bin/Debug/Newtonsoft.Json.dll -cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll src/{{{packageName}}}/bin/Debug/RestSharp.dll -cp packages/NUnit.2.6.4/lib/nunit.framework.dll src/{{{packageName}}}/bin/Debug/nunit.framework.dll -# for project {{{packageName}}}.Test -cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll src/{{{packageName}}}.Test/bin/Debug/Newtonsoft.Json.dll -cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll src/{{{packageName}}}.Test/bin/Debug/RestSharp.dll -cp packages/NUnit.2.6.4/lib/nunit.framework.dll src/{{{packageName}}}.Test/bin/Debug/nunit.framework.dll - echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild {{{packageName}}}.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache index 7e6f4575391..95192a480bf 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/packages_test.config.mustache @@ -1,6 +1,6 @@ - + diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index dc645198f38..6fc67c0bb51 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7B057377-44BA-47A5-AC6B-70EEB6034E6F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{64A65E8F-EACE-4663-9B82-B565E01CFEAE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Debug|Any CPU.Build.0 = Debug|Any CPU -{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Release|Any CPU.ActiveCfg = Release|Any CPU -{7B057377-44BA-47A5-AC6B-70EEB6034E6F}.Release|Any CPU.Build.0 = Release|Any CPU +{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU +{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU +{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 38d36d71493..8191778b36e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-06-11T23:10:58.942+08:00 +- Build date: 2016-06-12T01:56:22.092+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported diff --git a/samples/client/petstore/csharp/SwaggerClient/build.bat b/samples/client/petstore/csharp/SwaggerClient/build.bat index 80a13e48231..b0cdda9c0b2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/build.bat +++ b/samples/client/petstore/csharp/SwaggerClient/build.bat @@ -8,7 +8,7 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml diff --git a/samples/client/petstore/csharp/SwaggerClient/build.sh b/samples/client/petstore/csharp/SwaggerClient/build.sh index 88180f68398..63cf08bc35c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/build.sh +++ b/samples/client/petstore/csharp/SwaggerClient/build.sh @@ -11,7 +11,7 @@ mono nuget.exe install src/IO.Swagger/packages.config -o packages; mkdir -p bin; echo "[INFO] Copy DLLs to the 'bin' folder" -cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll" diff --git a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh index e2be7882f39..43d93618448 100644 --- a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh @@ -1,25 +1,18 @@ #!/usr/bin/env bash -wget -nc https://nuget.org/nuget.exe; +wget -nc https://nuget.org/nuget.exe mozroots --import --sync echo "[INFO] remove bin/Debug/SwaggerClientTest.dll" rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null echo "[INFO] install NUnit runners via NuGet" -wget -nc https://nuget.org/nuget.exe; +wget -nc https://nuget.org/nuget.exe mozroots --import --sync -mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages; +mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages -echo "[INFO] Copy DLLs to the 'bin' folder" -# for project IO.Swagger -cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll src/IO.Swagger/bin/Debug/Newtonsoft.Json.dll -cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll src/IO.Swagger/bin/Debug/RestSharp.dll -cp packages/NUnit.2.6.3/lib/nunit.framework.dll src/IO.Swagger/bin/Debug/nunit.framework.dll -# for project IO.Swagger.Test -cp packages/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll src/IO.Swagger.Test/bin/Debug/Newtonsoft.Json.dll -cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll src/IO.Swagger.Test/bin/Debug/RestSharp.dll -cp packages/NUnit.2.6.3/lib/nunit.framework.dll src/IO.Swagger.Test/bin/Debug/nunit.framework.dll +echo "[INFO] Install NUnit runners via NuGet" +mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages -echo "[INFO] build the solution and run the unit test" +echo "[INFO] Build the solution and run the unit test" xbuild IO.Swagger.sln && \ - mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/debug/IO.Swagger.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/debug/IO.Swagger.Test.dll diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 2ba51f5afa6..9f21997895b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -59,10 +59,10 @@ limitations under the License. - $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -71,10 +71,10 @@ limitations under the License. ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\..\vendor\NUnit.3.2.1\lib\nunit.framework.dll @@ -86,7 +86,7 @@ limitations under the License. - {7B057377-44BA-47A5-AC6B-70EEB6034E6F} + {64A65E8F-EACE-4663-9B82-B565E01CFEAE} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config index a8a3491f63d..317248179b6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/packages.config @@ -1,6 +1,6 @@ - + - + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 9164a6b3fb0..844d959bcff 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {7B057377-44BA-47A5-AC6B-70EEB6034E6F} + {64A65E8F-EACE-4663-9B82-B565E01CFEAE} Library Properties Swagger Library @@ -59,10 +59,10 @@ limitations under the License. - $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config index 91f17cd0819..80f617d6d9f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/packages.config @@ -1,5 +1,5 @@ - + From bca3d24d20ec557aa0f4a4cc5ec19d9522364c91 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 12 Jun 2016 12:41:35 +0800 Subject: [PATCH 66/67] fix test cases, fix warning in exceptionfactory, update .swagger-codegen-ignore for c# to keep logo file (for upload test) --- .../csharp/ExceptionFactory.mustache | 8 ++++ .../main/resources/csharp/api_test.mustache | 6 +-- .../resources/csharp/compile-mono.sh.mustache | 25 ++++++++++- .../main/resources/csharp/compile.mustache | 14 +++++++ .../resources/csharp/mono_nunit_test.mustache | 15 +++++++ .../SwaggerClient/.swagger-codegen-ignore | 1 + .../csharp/SwaggerClient/IO.Swagger.sln | 10 ++--- .../petstore/csharp/SwaggerClient/README.md | 2 +- .../petstore/csharp/SwaggerClient/build.bat | 14 +++++++ .../petstore/csharp/SwaggerClient/build.sh | 25 ++++++++++- .../csharp/SwaggerClient/mono_nunit_test.sh | 15 +++++++ .../src/IO.Swagger.Test/Api/FakeApiTests.cs | 2 +- .../src/IO.Swagger.Test/Api/PetApiTests.cs | 36 ++++++++-------- .../src/IO.Swagger.Test/Api/StoreApiTests.cs | 4 +- .../src/IO.Swagger.Test/Api/UserApiTests.cs | 2 +- .../IO.Swagger.Test/IO.Swagger.Test.csproj | 42 ++++++++++--------- .../Model/AdditionalPropertiesClassTests.cs | 2 +- .../IO.Swagger.Test/Model/AnimalFarmTests.cs | 2 +- .../src/IO.Swagger.Test/Model/AnimalTests.cs | 2 +- .../IO.Swagger.Test/Model/ApiResponseTests.cs | 2 +- .../IO.Swagger.Test/Model/ArrayTestTests.cs | 2 +- .../src/IO.Swagger.Test/Model/CatTests.cs | 2 +- .../IO.Swagger.Test/Model/CategoryTests.cs | 2 +- .../src/IO.Swagger.Test/Model/DogTests.cs | 2 +- .../IO.Swagger.Test/Model/EnumClassTests.cs | 2 +- .../IO.Swagger.Test/Model/EnumTestTests.cs | 2 +- .../IO.Swagger.Test/Model/FormatTestTests.cs | 2 +- ...ertiesAndAdditionalPropertiesClassTests.cs | 2 +- .../Model/Model200ResponseTests.cs | 2 +- .../IO.Swagger.Test/Model/ModelReturnTests.cs | 2 +- .../src/IO.Swagger.Test/Model/NameTests.cs | 2 +- .../src/IO.Swagger.Test/Model/OrderTests.cs | 2 +- .../src/IO.Swagger.Test/Model/PetTests.cs | 2 +- .../Model/ReadOnlyFirstTests.cs | 2 +- .../Model/SpecialModelNameTests.cs | 2 +- .../src/IO.Swagger.Test/Model/TagTests.cs | 2 +- .../src/IO.Swagger.Test/Model/UserTests.cs | 2 +- .../src/IO.Swagger/Client/ExceptionFactory.cs | 29 +++++++++++++ .../src/IO.Swagger/IO.Swagger.csproj | 2 +- 39 files changed, 219 insertions(+), 75 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache b/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache index ad3cd2ac02f..c25b88ee614 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ExceptionFactory.mustache @@ -1,7 +1,15 @@ +{{>partial_header}} + using System; using RestSharp; namespace {{packageName}}.Client { + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions public delegate Exception ExceptionFactory(string methodName, IRestResponse response); } diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index 4a4c2f98952..f3f1caeaf0a 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -51,7 +51,7 @@ namespace {{packageName}}.Test [Test] public void {{operationId}}InstanceTest() { - // TODO uncomment below to test 'IsInstanceOfType' {{classname}} + // test 'IsInstanceOfType' {{classname}} Assert.IsInstanceOfType(typeof({{classname}}), instance, "instance is a {{classname}}"); } @@ -62,9 +62,9 @@ namespace {{packageName}}.Test [Test] public void {{operationId}}Test() { - // TODO uncomment below to test the method '{{operationId}}' + // TODO uncomment below to test the method and replace null with proper value {{#allParams}} - //{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value + //{{{dataType}}} {{paramName}} = null; {{/allParams}} //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{#returnType}}//Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache index ea35b5d0b9c..7aab3657090 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache @@ -1,4 +1,19 @@ #!/usr/bin/env bash +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + frameworkVersion={{targetFrameworkNuget}} netfx=${frameworkVersion#net} @@ -8,9 +23,9 @@ echo "[INFO] Download nuget and packages" wget -nc https://nuget.org/nuget.exe; mozroots --import --sync mono nuget.exe install src/{{packageName}}/packages.config -o packages; -mkdir -p bin; echo "[INFO] Copy DLLs to the 'bin' folder" +mkdir -p bin; cp packages/Newtonsoft.Json.8.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; @@ -23,3 +38,11 @@ System.Runtime.Serialization.dll \ -recurse:'src/{{packageName}}/*.cs' \ -doc:bin/{{packageName}}.xml \ -platform:anycpu + +if [ $? -ne 0 ] +then + echo "[ERROR] Compilation failed with exit code $?" + exit 1 +else + echo "[INFO] bin/{{{packageName}}}.dll was created successfully" +fi diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache index 0164719456a..5da333f4e72 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/compile.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/compile.mustache @@ -1,3 +1,17 @@ +:: Generated by: https://github.com/swagger-api/swagger-codegen.git +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + @echo off {{#supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319{{/supportsAsync}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache index 52daa1c5063..114e86a7a28 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache @@ -1,4 +1,19 @@ #!/usr/bin/env bash +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + wget -nc https://nuget.org/nuget.exe mozroots --import --sync diff --git a/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore b/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore index 19d3377182e..61ed08d3455 100644 --- a/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore +++ b/samples/client/petstore/csharp/SwaggerClient/.swagger-codegen-ignore @@ -21,3 +21,4 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md +src/IO.Swagger.Test/IO.Swagger.Test.csproj diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 6fc67c0bb51..95488d816b9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{64A65E8F-EACE-4663-9B82-B565E01CFEAE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7B20DAE3-B510-4814-8986-CF1B89EA039E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU -{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU -{64A65E8F-EACE-4663-9B82-B565E01CFEAE}.Release|Any CPU.Build.0 = Release|Any CPU +{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.Build.0 = Debug|Any CPU +{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Release|Any CPU.ActiveCfg = Release|Any CPU +{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index 8191778b36e..a0bd0780740 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-06-12T01:56:22.092+08:00 +- Build date: 2016-06-12T12:38:46.317+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported diff --git a/samples/client/petstore/csharp/SwaggerClient/build.bat b/samples/client/petstore/csharp/SwaggerClient/build.bat index b0cdda9c0b2..ae94b120d7b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/build.bat +++ b/samples/client/petstore/csharp/SwaggerClient/build.bat @@ -1,3 +1,17 @@ +:: Generated by: https://github.com/swagger-api/swagger-codegen.git +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + @echo off SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 diff --git a/samples/client/petstore/csharp/SwaggerClient/build.sh b/samples/client/petstore/csharp/SwaggerClient/build.sh index 63cf08bc35c..25228f3cc36 100644 --- a/samples/client/petstore/csharp/SwaggerClient/build.sh +++ b/samples/client/petstore/csharp/SwaggerClient/build.sh @@ -1,4 +1,19 @@ #!/usr/bin/env bash +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + frameworkVersion=net45 netfx=${frameworkVersion#net} @@ -8,9 +23,9 @@ echo "[INFO] Download nuget and packages" wget -nc https://nuget.org/nuget.exe; mozroots --import --sync mono nuget.exe install src/IO.Swagger/packages.config -o packages; -mkdir -p bin; echo "[INFO] Copy DLLs to the 'bin' folder" +mkdir -p bin; cp packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; @@ -23,3 +38,11 @@ System.Runtime.Serialization.dll \ -recurse:'src/IO.Swagger/*.cs' \ -doc:bin/IO.Swagger.xml \ -platform:anycpu + +if [ $? -ne 0 ] +then + echo "[ERROR] Compilation failed with exit code $?" + exit 1 +else + echo "[INFO] bin/IO.Swagger.dll was created successfully" +fi diff --git a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh index 43d93618448..45626ecad48 100644 --- a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh @@ -1,4 +1,19 @@ #!/usr/bin/env bash +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + wget -nc https://nuget.org/nuget.exe mozroots --import --sync diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 71a4063af4e..7f537b16558 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -48,7 +48,7 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf (instance, "instance is a FakeApi"); + Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs index b9dae814b68..0d517af68b5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs @@ -97,7 +97,7 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf (instance, "instance is a PetApi"); + Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi"); } @@ -134,7 +134,7 @@ namespace IO.Swagger.Test List listPet = petApi.FindPetsByTags (tagsList); foreach (Pet pet in listPet) // Loop through List with foreach. { - Assert.IsInstanceOf (pet, "Response is a Pet"); + Assert.IsInstanceOfType(typeof(Pet), pet, "Response is a Pet"); Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]); } } @@ -147,7 +147,7 @@ namespace IO.Swagger.Test { List tags = new List(new String[] {"pet"}); var response = instance.FindPetsByTags(tags); - Assert.IsInstanceOf> (response, "response is List"); + Assert.IsInstanceOfType(typeof(List), response, "response is List"); } /// @@ -161,19 +161,19 @@ namespace IO.Swagger.Test PetApi petApi = new PetApi (c1); Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOf (response, "Response is a Pet"); + Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); Assert.AreEqual (56, response.Category.Id); Assert.AreEqual ("sample category name2", response.Category.Name); } @@ -187,19 +187,19 @@ namespace IO.Swagger.Test PetApi petApi = new PetApi (); var task = petApi.GetPetByIdAsync (petId); Pet response = task.Result; - Assert.IsInstanceOf (response, "Response is a Pet"); + Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); Assert.AreEqual (56, response.Category.Id); Assert.AreEqual ("sample category name2", response.Category.Name); @@ -219,19 +219,19 @@ namespace IO.Swagger.Test Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json"); Pet response = task.Result.Data; - Assert.IsInstanceOf (response, "Response is a Pet"); + Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); Assert.AreEqual ("Csharp test", response.Name); Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); Assert.AreEqual (petId, response.Tags [0].Id); Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); Assert.AreEqual (56, response.Category.Id); Assert.AreEqual ("sample category name2", response.Category.Name); @@ -258,9 +258,9 @@ namespace IO.Swagger.Test petApi.UpdatePetWithForm (petId, "new form name", "pending"); Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOf (response, "Response is a Pet"); - Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); - Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); + Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); + Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); Assert.AreEqual ("new form name", response.Name); Assert.AreEqual (Pet.StatusEnum.Pending, response.Status); diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs index e1237b51c0b..2ca3b35f30d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs @@ -50,7 +50,7 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf (instance, "instance is a StoreApi"); + Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi"); } @@ -84,7 +84,7 @@ namespace IO.Swagger.Test foreach(KeyValuePair entry in response) { - Assert.IsInstanceOf (typeof(int?), entry.Value); + Assert.IsInstanceOfType(typeof(int?), entry.Value); } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs index 77f6bd5ec99..31edf492923 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs @@ -49,7 +49,7 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf (instance, "instance is a UserApi"); + Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi"); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 9f21997895b..5660f132a37 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + Debug AnyCPU @@ -59,36 +59,38 @@ limitations under the License. - $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll - ..\..\vendor\NUnit.3.2.1\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\..\packages\NUnit.3.2.1\lib\nunit.framework.dll + ..\..\vendor\NUnit.3.2.1\lib\nunit.framework.dll - + - + - - {64A65E8F-EACE-4663-9B82-B565E01CFEAE} - IO.Swagger - + + {85AE8212-9819-4224-A9E5-B93419EC927B} + IO.Swagger + + + + - diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs index fca6d20d0dc..b4680801e4c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AdditionalPropertiesClassTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void AdditionalPropertiesClassInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a AdditionalPropertiesClass"); + Assert.IsInstanceOfType(typeof(AdditionalPropertiesClass), instance, "instance is a AdditionalPropertiesClass"); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs index 5baa4d93485..6e824fbfd84 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalFarmTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void AnimalFarmInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a AnimalFarm"); + Assert.IsInstanceOfType(typeof(AnimalFarm), instance, "instance is a AnimalFarm"); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs index e7356e3750d..59cd4d76d68 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void AnimalInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Animal"); + Assert.IsInstanceOfType(typeof(Animal), instance, "instance is a Animal"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs index c2535cdadb3..13d4310916b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ApiResponseTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void ApiResponseInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a ApiResponse"); + Assert.IsInstanceOfType(typeof(ApiResponse), instance, "instance is a ApiResponse"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs index fd6b6f31d86..c063340171f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ArrayTestTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void ArrayTestInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a ArrayTest"); + Assert.IsInstanceOfType(typeof(ArrayTest), instance, "instance is a ArrayTest"); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs index 72e65f60bf0..8a6abb12f62 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void CatInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Cat"); + Assert.IsInstanceOfType(typeof(Cat), instance, "instance is a Cat"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs index 96e5d946c0b..3c7ba0499aa 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CategoryTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void CategoryInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Category"); + Assert.IsInstanceOfType(typeof(Category), instance, "instance is a Category"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs index 624c16d479d..5d3b6fef175 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void DogInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Dog"); + Assert.IsInstanceOfType(typeof(Dog), instance, "instance is a Dog"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs index d2a3fc86c78..154e3c7b57a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void EnumClassInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a EnumClass"); + Assert.IsInstanceOfType(typeof(EnumClass), instance, "instance is a EnumClass"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs index 2679b085233..9ea929a0cd6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumTestTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void EnumTestInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a EnumTest"); + Assert.IsInstanceOfType(typeof(EnumTest), instance, "instance is a EnumTest"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs index e1d59bcc174..1d2d334a45e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void FormatTestInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a FormatTest"); + Assert.IsInstanceOfType(typeof(FormatTest), instance, "instance is a FormatTest"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs index e21779241db..2157758ec1f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass"); + Assert.IsInstanceOfType(typeof(MixedPropertiesAndAdditionalPropertiesClass), instance, "instance is a MixedPropertiesAndAdditionalPropertiesClass"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs index eb55902a998..13bbc1b1c7d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/Model200ResponseTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void Model200ResponseInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Model200Response"); + Assert.IsInstanceOfType(typeof(Model200Response), instance, "instance is a Model200Response"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs index 1c620b73241..53e62fc51a3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ModelReturnTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void ModelReturnInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a ModelReturn"); + Assert.IsInstanceOfType(typeof(ModelReturn), instance, "instance is a ModelReturn"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs index d8fbafe238c..d1e0deec41f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void NameInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Name"); + Assert.IsInstanceOfType(typeof(Name), instance, "instance is a Name"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs index 2d55d2300f9..799b6ef43f8 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs @@ -57,7 +57,7 @@ namespace IO.Swagger.Test [Test] public void OrderInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Order"); + Assert.IsInstanceOfType(typeof(Order), instance, "instance is a Order"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs index 24be033f6c5..7029264ee06 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs @@ -49,7 +49,7 @@ namespace IO.Swagger.Test [Test] public void PetInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Pet"); + Assert.IsInstanceOfType(typeof(Pet), instance, "instance is a Pet"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs index 9aa3cec42b2..e0c4029546b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/ReadOnlyFirstTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void ReadOnlyFirstInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a ReadOnlyFirst"); + Assert.IsInstanceOfType(typeof(ReadOnlyFirst), instance, "instance is a ReadOnlyFirst"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs index 21051e71f54..eec6e837449 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/SpecialModelNameTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void SpecialModelNameInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a SpecialModelName"); + Assert.IsInstanceOfType(typeof(SpecialModelName), instance, "instance is a SpecialModelName"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs index 4fff0e4c12d..2b78594eb6f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/TagTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void TagInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a Tag"); + Assert.IsInstanceOfType(typeof(Tag), instance, "instance is a Tag"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs index 38f2667c403..59451079ebf 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/UserTests.cs @@ -47,7 +47,7 @@ namespace IO.Swagger.Test [Test] public void UserInstanceTest() { - Assert.IsInstanceOf (instance, "instance is a User"); + Assert.IsInstanceOfType(typeof(User), instance, "instance is a User"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs index 24e5fad478f..579cb8618c2 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ExceptionFactory.cs @@ -1,7 +1,36 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + using System; using RestSharp; namespace IO.Swagger.Client { + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions public delegate Exception ExceptionFactory(string methodName, IRestResponse response); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 844d959bcff..d878c812396 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {64A65E8F-EACE-4663-9B82-B565E01CFEAE} + {7B20DAE3-B510-4814-8986-CF1B89EA039E} Library Properties Swagger Library From 16d89a47b7aeae451d519682159565426ad6e9ac Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 12 Jun 2016 16:45:49 +0800 Subject: [PATCH 67/67] add travis file for C# client --- .../languages/CSharpClientCodegen.java | 5 ++++- .../resources/csharp/mono_nunit_test.mustache | 2 +- .../src/main/resources/csharp/travis.mustache | 21 +++++++++++++++++++ .../petstore/csharp/SwaggerClient/.travis.yml | 21 +++++++++++++++++++ .../csharp/SwaggerClient/IO.Swagger.sln | 10 ++++----- .../petstore/csharp/SwaggerClient/README.md | 2 +- .../csharp/SwaggerClient/mono_nunit_test.sh | 2 +- .../src/IO.Swagger/IO.Swagger.csproj | 2 +- 8 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/csharp/travis.mustache create mode 100644 samples/client/petstore/csharp/SwaggerClient/.travis.yml diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index ef3baedd78e..4265f67709c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -243,6 +243,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { // copy package.config to nuget's standard location for project-level installs supportingFiles.add(new SupportingFile("packages.config.mustache", packageFolder + File.separator, "packages.config")); + // .travis.yml for travis-ci.org CI + supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); if(Boolean.FALSE.equals(excludeTests)) { supportingFiles.add(new SupportingFile("packages_test.config.mustache", testPackageFolder + File.separator, "packages.config")); @@ -252,7 +254,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); // apache v2 license - supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE")); + // UPDATE (20160612) no longer needed as the Apache v2 LICENSE is added globally + //supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE")); if (optionalAssemblyInfoFlag) { supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs")); diff --git a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache index 114e86a7a28..b4d1cd74ca6 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/mono_nunit_test.mustache @@ -30,4 +30,4 @@ mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild {{{packageName}}}.sln && \ - mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/{{{packageName}}}.Test/bin/debug/{{{packageName}}}.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll diff --git a/modules/swagger-codegen/src/main/resources/csharp/travis.mustache b/modules/swagger-codegen/src/main/resources/csharp/travis.mustache new file mode 100644 index 00000000000..983f06b7156 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/travis.mustache @@ -0,0 +1,21 @@ +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +language: csharp +mono: + - latest +solution: {{{packageName}}}.sln +script: + - /bin/sh ./mono_nunit_test.sh diff --git a/samples/client/petstore/csharp/SwaggerClient/.travis.yml b/samples/client/petstore/csharp/SwaggerClient/.travis.yml new file mode 100644 index 00000000000..4096e0b50d4 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/.travis.yml @@ -0,0 +1,21 @@ +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +language: csharp +mono: + - latest +solution: IO.Swagger.sln +script: + - /bin/sh ./mono_nunit_test.sh diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 95488d816b9..143ffeb1629 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7B20DAE3-B510-4814-8986-CF1B89EA039E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{BF42B49D-37A0-49C4-A405-24CD946ADAA7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Debug|Any CPU.Build.0 = Debug|Any CPU -{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Release|Any CPU.ActiveCfg = Release|Any CPU -{7B20DAE3-B510-4814-8986-CF1B89EA039E}.Release|Any CPU.Build.0 = Release|Any CPU +{BF42B49D-37A0-49C4-A405-24CD946ADAA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{BF42B49D-37A0-49C4-A405-24CD946ADAA7}.Debug|Any CPU.Build.0 = Debug|Any CPU +{BF42B49D-37A0-49C4-A405-24CD946ADAA7}.Release|Any CPU.ActiveCfg = Release|Any CPU +{BF42B49D-37A0-49C4-A405-24CD946ADAA7}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index a0bd0780740..c5a53af127d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-06-12T12:38:46.317+08:00 +- Build date: 2016-06-12T16:29:47.553+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported diff --git a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh index 45626ecad48..e7032942787 100644 --- a/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/SwaggerClient/mono_nunit_test.sh @@ -30,4 +30,4 @@ mono nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild IO.Swagger.sln && \ - mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/debug/IO.Swagger.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index d878c812396..7a78c9e7e69 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -24,7 +24,7 @@ limitations under the License. Debug AnyCPU - {7B20DAE3-B510-4814-8986-CF1B89EA039E} + {BF42B49D-37A0-49C4-A405-24CD946ADAA7} Library Properties Swagger Library