Merge branch 'master' into new-sync-master-to-2.3.0

This commit is contained in:
Paul Ebermann 2017-03-15 16:41:33 +01:00
commit 784169bc3f
38 changed files with 3264 additions and 59 deletions

View File

@ -17,7 +17,7 @@
## Overview
This is the swagger codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). Currently, the following languages/frameworks are supported:
- **API clients**: **ActionScript**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, Node)
- **API clients**: **ActionScript**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Elixir**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, jQuery, Node)
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** ([Finch](https://github.com/finagle/finch), Scalatra)
- **API documentation generators**: **HTML**, **Confluence Wiki**
- **Others**: **JMeter**
@ -889,6 +889,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [Plexxi](http://www.plexxi.com)
- [Pixoneye](http://www.pixoneye.com/)
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
- [PracticeBird](https://www.practicebird.com/)
- [Prill Tecnologia](http://www.prill.com.br)
- [QAdept](http://qadept.com/)
- [QuantiModo](https://quantimo.do/)
@ -1001,6 +1002,7 @@ Here is a list of template creators:
* TypeScript (Angular1): @mhardorf
* TypeScript (Fetch): @leonyu
* TypeScript (Angular2): @roni-frantchi
* TypeScript (jQuery): @bherila
* Server Stubs
* C# ASP.NET5: @jimschubert
* C# NancyFX: @mstefaniuk

36
bin/typescript-jquery-all.sh Executable file
View File

@ -0,0 +1,36 @@
#!/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"
echo "Typescript jquery Petstore API client (default setting)"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -o samples/client/petstore/typescript-jquery/default"
java $JAVA_OPTS -jar $executable $ags
echo "Typescript jquery Petstore API client with npm setting"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-jquery/npm"
java $JAVA_OPTS -jar $executable $ags

View File

@ -32,6 +32,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
public class ExampleGenerator {
@ -47,9 +48,12 @@ public class ExampleGenerator {
private static final String NONE = "none";
protected Map<String, Model> examples;
private Random random;
public ExampleGenerator(Map<String, Model> examples) {
this.examples = examples;
// use a fixed seed to make the "random" numbers reproducible.
this.random = new Random("ExampleGenerator".hashCode());
}
public List<Map<String, String>> generate(Map<String, Object> examples, List<String> mediaTypes, Property property) {
@ -187,13 +191,13 @@ public class ExampleGenerator {
private double randomNumber(Double min, Double max) {
if (min != null && max != null) {
double range = max - min;
return Math.random() * range + min;
return random.nextDouble() * range + min;
} else if (min != null) {
return Math.random() + min;
return random.nextDouble() + min;
} else if (max != null) {
return Math.random() * max;
return random.nextDouble() * max;
} else {
return Math.random() * 10;
return random.nextDouble() * 10;
}
}

View File

@ -60,7 +60,7 @@ public class AsyncScalaClientCodegen extends AbstractScalaCodegen implements Cod
importMapping.remove("Map");
importMapping.put("DateTime", "org.joda.time.DateTime");
importMapping.put("ListBuffer", "scala.collections.mutable.ListBuffer");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
typeMapping = new HashMap<String, String>();
typeMapping.put("enum", "NSString");

View File

@ -76,7 +76,7 @@ public class ScalaClientCodegen extends AbstractScalaCodegen implements CodegenC
importMapping.remove("Map");
importMapping.put("DateTime", "org.joda.time.DateTime");
importMapping.put("ListBuffer", "scala.collections.mutable.ListBuffer");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
typeMapping = new HashMap<String, String>();
typeMapping.put("enum", "NSString");

View File

@ -0,0 +1,110 @@
package io.swagger.codegen.languages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.swagger.codegen.CliOption;
import io.swagger.codegen.SupportingFile;
import io.swagger.models.properties.BooleanProperty;
public class TypeScriptJqueryClientCodegen extends AbstractTypeScriptClientCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class);
private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm");
public static final String NPM_NAME = "npmName";
public static final String NPM_VERSION = "npmVersion";
public static final String NPM_REPOSITORY = "npmRepository";
public static final String SNAPSHOT = "snapshot";
protected String npmName = null;
protected String npmVersion = "1.0.0";
protected String npmRepository = null;
public TypeScriptJqueryClientCodegen() {
super();
outputFolder = "generated-code/typescript-jquery";
embeddedTemplateDir = templateDir = "typescript-jquery";
this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package"));
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package"));
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
}
@Override
public void processOpts() {
super.processOpts();
supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
LOGGER.warn("check additionals: " + additionalProperties.get(NPM_NAME));
if(additionalProperties.containsKey(NPM_NAME)) {
addNpmPackageGeneration();
}
}
private void addNpmPackageGeneration() {
if(additionalProperties.containsKey(NPM_NAME)) {
this.setNpmName(additionalProperties.get(NPM_NAME).toString());
}
if (additionalProperties.containsKey(NPM_VERSION)) {
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
}
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
}
additionalProperties.put(NPM_VERSION, npmVersion);
if (additionalProperties.containsKey(NPM_REPOSITORY)) {
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
}
//Files for building our lib
supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json"));
supportingFiles.add(new SupportingFile("typings.mustache", getPackageRootDirectory(), "typings.json"));
supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json"));
}
private String getPackageRootDirectory() {
String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.')));
return indexPackage.replace('.', File.separatorChar);
}
@Override
public String getName() {
return "typescript-jquery";
}
@Override
public String getHelp() {
return "Generates a TypeScript jquery client library.";
}
public void setNpmName(String npmName) {
this.npmName = npmName;
}
public void setNpmVersion(String npmVersion) {
this.npmVersion = npmVersion;
}
public String getNpmVersion() {
return npmVersion;
}
public String getNpmRepository() {
return npmRepository;
}
public void setNpmRepository(String npmRepository) {
this.npmRepository = npmRepository;
}
}

View File

@ -52,6 +52,7 @@ io.swagger.codegen.languages.Swift3Codegen
io.swagger.codegen.languages.TizenClientCodegen
io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen
io.swagger.codegen.languages.TypeScriptAngularClientCodegen
io.swagger.codegen.languages.TypeScriptJqueryClientCodegen
io.swagger.codegen.languages.TypeScriptNodeClientCodegen
io.swagger.codegen.languages.TypeScriptFetchClientCodegen
io.swagger.codegen.languages.AkkaScalaClientCodegen

View File

@ -8,6 +8,7 @@ package {{package}}
import {{invokerPackage}}.ApiModel
import org.joda.time.DateTime
import java.util.UUID
{{#models}}
{{#model}}

View File

@ -0,0 +1,269 @@
import * as $ from 'jquery';
let defaultBasePath = '{{basePath}}';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
/* tslint:disable:no-unused-variable */
{{#models}}
{{#model}}
{{#description}}
/**
* {{{description}}}
*/
{{/description}}
export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
{{#vars}}
{{#description}}
/**
* {{{description}}}
*/
{{/description}}
'{{name}}': {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
{{/vars}}
}
{{#hasEnums}}
export namespace {{classname}} {
{{#vars}}
{{#isEnum}}
export enum {{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{name}} = <any> {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/isEnum}}
{{/vars}}
}
{{/hasEnums}}
{{/model}}
{{/models}}
export interface Authentication {
/**
* Apply authentication settings to header and query params.
*/
applyToRequest(requestOptions: JQueryAjaxSettings): void;
}
export class HttpBasicAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(requestOptions: any): void {
requestOptions.username = this.username;
requestOptions.password = this.password;
}
}
export class ApiKeyAuth implements Authentication {
public apiKey: string;
constructor(private location: string, private paramName: string) {
}
applyToRequest(requestOptions: JQueryAjaxSettings): void {
requestOptions.headers[this.paramName] = this.apiKey;
}
}
export class OAuth implements Authentication {
public accessToken: string;
applyToRequest(requestOptions: JQueryAjaxSettings): void {
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
}
}
export class VoidAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(requestOptions: JQueryAjaxSettings): void {
// Do nothing
}
}
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#description}}
/**
* {{&description}}
*/
{{/description}}
export enum {{classname}}ApiKeys {
{{#authMethods}}
{{#isApiKey}}
{{name}},
{{/isApiKey}}
{{/authMethods}}
}
export class {{classname}} {
protected basePath = defaultBasePath;
protected defaultHeaders : any = {};
protected authentications = {
'default': <Authentication>new VoidAuth(),
{{#authMethods}}
{{#isBasic}}
'{{name}}': new HttpBasicAuth(),
{{/isBasic}}
{{#isApiKey}}
'{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'),
{{/isApiKey}}
{{#isOAuth}}
'{{name}}': new OAuth(),
{{/isOAuth}}
{{/authMethods}}
}
constructor(basePath?: string);
{{#authMethods}}
{{#isBasic}}
constructor(username: string, password: string, basePath?: string);
{{/isBasic}}
{{/authMethods}}
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
{{#authMethods}}
{{#isBasic}}
this.username = basePathOrUsername;
this.password = password
{{/isBasic}}
{{/authMethods}}
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
public setApiKey(key: {{classname}}ApiKeys, value: string) {
this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
}
{{#authMethods}}
{{#isBasic}}
set username(username: string) {
this.authentications.{{name}}.username = username;
}
set password(password: string) {
this.authentications.{{name}}.password = password;
}
{{/isBasic}}
{{#isOAuth}}
set accessToken(token: string) {
this.authentications.{{name}}.accessToken = token;
}
{{/isOAuth}}
{{/authMethods}}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for(let key in objB){
if(objB.hasOwnProperty(key)){
objA[key] = objB[key];
}
}
return objA;
}
{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
let localVarPath = this.basePath + '{{path}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
{{#allParams}}{{#required}}
// verify required parameter '{{paramName}}' is not null or undefined
if ({{paramName}} === null || {{paramName}} === undefined) {
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
}
{{/required}}{{/allParams}}
{{#queryParams}}
if ({{paramName}} !== undefined) {
queryParameters['{{baseName}}'] = {{paramName}};
}
{{/queryParams}}
localVarPath = localVarPath + "?" + $.param(queryParameters);
{{#headerParams}}
headerParams['{{baseName}}'] = {{paramName}};
{{/headerParams}}
{{^bodyParam}}
let reqHasFile = false;
let reqDict = {};
let reqFormData = new FormData();
{{#formParams}}
{{#isFile}}
reqHasFile = true;
{{/isFile}}
if ({{paramName}} !== undefined) {
reqFormData.append('{{baseName}}', {{paramName}});
reqDict['{{baseName}}'] = {{paramName}};
}
{{/formParams}}
{{/bodyParam}}
{{#bodyParam}}
let reqDict = {{paramName}};
let reqFormData = new FormData();
reqFormData.append('{{paramName}}', {{paramName}});
{{#isFile}}
let reqHasFile = true;
{{/isFile}}
{{^isFile}}
let reqHasFile = false;
{{/isFile}}
{{/bodyParam}}
let requestOptions: JQueryAjaxSettings = {
url: localVarPath,
type: '{{httpMethod}}',
headers: headerParams,
processData: false
};
if (Object.keys(reqDict).length) {
requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict);
requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8';
}
{{#authMethods}}
this.authentications.{{name}}.applyToRequest(requestOptions);
{{/authMethods}}
this.authentications.default.applyToRequest(requestOptions);
let dfd = $.Deferred();
$.ajax(requestOptions).then(
(data: {{{returnType}}}, textStatus: string, jqXHR: JQueryXHR) =>
dfd.resolve({ response: jqXHR, body: data }),
(xhr: JQueryXHR, textStatus: string, errorThrown: string) =>
dfd.reject({ response: xhr, body: errorThrown })
);
return dfd.promise();
}
{{/operation}}
}
{{/operations}}
{{/apis}}
{{/apiInfo}}

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="{{{gitUserId}}}"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="{{{gitRepoId}}}"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="{{{releaseNote}}}"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,22 @@
{
"name": "{{npmName}}",
"version": "{{npmVersion}}",
"description": "JQuery client for {{npmName}}",
"main": "api.js",
"scripts": {
"build": "tsc"
},
"author": "Swagger Codegen Contributors",
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.5",
"request": "^2.72.0"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^0.8.1"
}{{#npmRepository}},
"publishConfig":{
"registry":"{{npmRepository}}"
}{{/npmRepository}}
}

View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"noLib": false,
"declaration": true
},
"files": [
"api.ts",
"typings/main.d.ts"
]
}

View File

@ -0,0 +1,10 @@
{
"ambientDependencies": {
"bluebird": "registry:dt/bluebird#2.0.0+20160319051630",
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"node": "registry:dt/node#4.0.0+20160423143914"
},
"dependencies": {
"request": "registry:npm/request#2.69.0+20160304121250"
}
}

View File

@ -758,6 +758,7 @@
<!-- run ruby test first which has a random delay script to
avoid issues with running 2 CI jobs in parallel. -->
<!-- clients -->
<module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/android/volley</module>
<module>samples/client/petstore/bash</module>
@ -779,6 +780,7 @@
<module>samples/client/petstore/typescript-fetch/tests/default</module>
<module>samples/client/petstore/typescript-angular</module>
<module>samples/client/petstore/typescript-node/npm</module>
<module>samples/client/petstore/typescript-jquery/npm</module>
<!-- servers -->
<module>samples/server/petstore/java-inflector</module>
<module>samples/server/petstore/undertow</module>

View File

@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-client</artifactId>
<artifactId>scala-akka-petstore-client</artifactId>
<packaging>jar</packaging>
<name>swagger-client</name>
<name>scala-akka-petstore-client</name>
<version>1.0.0</version>
<prerequisites>
<maven>2.2.0</maven>
@ -217,7 +217,7 @@
<akka-version>2.3.9</akka-version>
<joda-version>1.2</joda-version>
<joda-time-version>2.2</joda-time-version>
<swagger-core-version>1.5.9</swagger-core-version>
<swagger-core-version>1.5.12</swagger-core-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<junit-version>4.8.1</junit-version>

View File

@ -23,7 +23,7 @@ object UserApi {
def createUser(body: User): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
.withSuccessResponse[Unit](0)
/**
*
* Expected answers:
@ -34,7 +34,7 @@ object UserApi {
def createUsersWithArrayInput(body: Seq[User]): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithArray", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
.withSuccessResponse[Unit](0)
/**
*
* Expected answers:
@ -45,7 +45,7 @@ object UserApi {
def createUsersWithListInput(body: Seq[User]): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithList", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
.withSuccessResponse[Unit](0)
/**
* This can only be done by the logged in user.
*
@ -105,7 +105,7 @@ object UserApi {
*/
def logoutUser(): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/logout", "application/json")
.withDefaultSuccessResponse[Unit]
.withSuccessResponse[Unit](0)
/**
* This can only be done by the logged in user.
*

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class ApiResponse (
code: Option[Int],

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class Category (
id: Option[Long],

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class Order (
id: Option[Long],

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class Pet (
id: Option[Long],

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class Tag (
id: Option[Long],

View File

@ -8,6 +8,7 @@ package io.swagger.client.model
import io.swagger.client.core.ApiModel
import org.joda.time.DateTime
import java.util.UUID
case class User (
id: Option[Long],

View File

@ -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
# This 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
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="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -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
# This 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
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="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,22 @@
{
"name": "@swagger/angular2-typescript-petstore",
"version": "0.0.1-SNAPSHOT.201703061507",
"description": "JQuery client for @swagger/angular2-typescript-petstore",
"main": "api.js",
"scripts": {
"build": "tsc"
},
"author": "Swagger Codegen Contributors",
"license": "MIT",
"dependencies": {
"bluebird": "^3.3.5",
"request": "^2.72.0"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^0.8.1"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"
}
}

View File

@ -0,0 +1,46 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>TSJQueryNPMPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS jQuery npm Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "ES5",
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"noLib": false,
"declaration": true
},
"files": [
"api.ts",
"typings/main.d.ts"
]
}

View File

@ -0,0 +1,10 @@
{
"ambientDependencies": {
"bluebird": "registry:dt/bluebird#2.0.0+20160319051630",
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"node": "registry:dt/node#4.0.0+20160423143914"
},
"dependencies": {
"request": "registry:npm/request#2.69.0+20160304121250"
}
}

View File

@ -35,16 +35,16 @@ exports.findPetsByStatus = function(args, res, next) {
examples['application/json'] = [ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
"id" : 1
} ],
"status" : "aeiou"
"status" : "available"
} ];
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -66,16 +66,16 @@ exports.findPetsByTags = function(args, res, next) {
examples['application/json'] = [ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
"id" : 1
} ],
"status" : "aeiou"
"status" : "available"
} ];
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -97,16 +97,16 @@ exports.getPetById = function(args, res, next) {
examples['application/json'] = {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 123456789
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
"id" : 1
} ],
"status" : "aeiou"
"status" : "available"
};
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -152,7 +152,7 @@ exports.uploadFile = function(args, res, next) {
**/
var examples = {};
examples['application/json'] = {
"code" : 123,
"code" : 0,
"type" : "aeiou",
"message" : "aeiou"
};

View File

@ -20,7 +20,7 @@ exports.getInventory = function(args, res, next) {
**/
var examples = {};
examples['application/json'] = {
"key" : 123
"key" : 0
};
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -40,12 +40,12 @@ exports.getOrderById = function(args, res, next) {
**/
var examples = {};
examples['application/json'] = {
"petId" : 123456789,
"quantity" : 123,
"id" : 123456789,
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "aeiou"
"complete" : false,
"status" : "placed"
};
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
@ -65,12 +65,12 @@ exports.placeOrder = function(args, res, next) {
**/
var examples = {};
examples['application/json'] = {
"petId" : 123456789,
"quantity" : 123,
"id" : 123456789,
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : true,
"status" : "aeiou"
"complete" : false,
"status" : "placed"
};
if (Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');

View File

@ -57,9 +57,9 @@ exports.getUserByName = function(args, res, next) {
"firstName" : "aeiou",
"lastName" : "aeiou",
"password" : "aeiou",
"userStatus" : 123,
"userStatus" : 6,
"phone" : "aeiou",
"id" : 123456789,
"id" : 0,
"email" : "aeiou",
"username" : "aeiou"
};

View File

@ -43,14 +43,14 @@ exports.findPetsByStatus = function(status) {
examples['application/json'] = [ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 6,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 8
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 6
"id" : 1
} ],
"status" : "available"
} ];
@ -76,14 +76,14 @@ exports.findPetsByTags = function(tags) {
examples['application/json'] = [ {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 7,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 9
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 2
"id" : 1
} ],
"status" : "available"
} ];
@ -109,14 +109,14 @@ exports.getPetById = function(petId) {
examples['application/json'] = {
"photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 8,
"id" : 0,
"category" : {
"name" : "aeiou",
"id" : 4
"id" : 6
},
"tags" : [ {
"name" : "aeiou",
"id" : 3
"id" : 1
} ],
"status" : "available"
};
@ -172,7 +172,7 @@ exports.uploadFile = function(petId,additionalMetadata,file) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"code" : 8,
"code" : 0,
"type" : "aeiou",
"message" : "aeiou"
};

View File

@ -25,7 +25,7 @@ exports.getInventory = function() {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"key" : 1
"key" : 0
};
if (Object.keys(examples).length > 0) {
resolve(examples[Object.keys(examples)[0]]);
@ -47,9 +47,9 @@ exports.getOrderById = function(orderId) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"petId" : 8,
"quantity" : 8,
"id" : 5,
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
@ -74,9 +74,9 @@ exports.placeOrder = function(body) {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] = {
"petId" : 7,
"quantity" : 0,
"id" : 1,
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"

View File

@ -71,9 +71,9 @@ exports.getUserByName = function(username) {
"firstName" : "aeiou",
"lastName" : "aeiou",
"password" : "aeiou",
"userStatus" : 8,
"userStatus" : 6,
"phone" : "aeiou",
"id" : 5,
"id" : 0,
"email" : "aeiou",
"username" : "aeiou"
};