Update Javascript closure angular Petstore samples with OAS2, OAS3 (#164)

* update js closure angular with oas2

* update js closure angular with oas3 (no diff)
This commit is contained in:
William Cheng 2018-04-20 19:01:05 +08:00 committed by GitHub
parent 3e0f959215
commit fa346ce004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 50 deletions

View File

@ -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/openapi-generator-cli/target/openapi-generator-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/openapi-generator/src/test/resources/3_0/petstore.yaml -l javascript-closure-angular -o samples/client/petstore/javascript-closure-angular $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1 +1 @@
2.2.3-SNAPSHOT 3.0.0-SNAPSHOT

View File

@ -5,10 +5,10 @@
* *
* 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. * 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.
* Version: 1.0.0 * Version: 1.0.0
* Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
* @license Apache 2.0 * @license Apache-2.0
* http://www.apache.org/licenses/LICENSE-2.0.html * http://www.apache.org/licenses/LICENSE-2.0.html
*/ */
@ -47,11 +47,11 @@ API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/** /**
* Add a new pet to the store * Add a new pet to the store
* *
* @param {!Pet} body Pet object that needs to be added to the store * @param {!Pet} pet Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams) { API.Client.PetApi.prototype.addPet = function(pet, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/pet'; var path = this.basePath_ + '/pet';
@ -60,16 +60,16 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams)
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'pet' is set
if (!body) { if (!pet) {
throw new Error('Missing required parameter body when calling addPet'); throw new Error('Missing required parameter pet when calling addPet');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'POST', method: 'POST',
url: path, url: path,
json: true, json: true,
data: body, data: pet,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -241,11 +241,11 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar
/** /**
* Update an existing pet * Update an existing pet
* *
* @param {!Pet} body Pet object that needs to be added to the store * @param {!Pet} pet Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) { API.Client.PetApi.prototype.updatePet = function(pet, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/pet'; var path = this.basePath_ + '/pet';
@ -254,16 +254,16 @@ API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParam
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'pet' is set
if (!body) { if (!pet) {
throw new Error('Missing required parameter body when calling updatePet'); throw new Error('Missing required parameter pet when calling updatePet');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'PUT', method: 'PUT',
url: path, url: path,
json: true, json: true,
data: body, data: pet,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };

View File

@ -5,10 +5,10 @@
* *
* 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. * 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.
* Version: 1.0.0 * Version: 1.0.0
* Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
* @license Apache 2.0 * @license Apache-2.0
* http://www.apache.org/licenses/LICENSE-2.0.html * http://www.apache.org/licenses/LICENSE-2.0.html
*/ */
@ -151,11 +151,11 @@ API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequ
/** /**
* Place an order for a pet * Place an order for a pet
* *
* @param {!Order} body order placed for purchasing the pet * @param {!Order} order order placed for purchasing the pet
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>} * @return {!angular.$q.Promise<!API.Client.Order>}
*/ */
API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestParams) { API.Client.StoreApi.prototype.placeOrder = function(order, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/store/order'; var path = this.basePath_ + '/store/order';
@ -164,16 +164,16 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'order' is set
if (!body) { if (!order) {
throw new Error('Missing required parameter body when calling placeOrder'); throw new Error('Missing required parameter order when calling placeOrder');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'POST', method: 'POST',
url: path, url: path,
json: true, json: true,
data: body, data: order,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };

View File

@ -5,10 +5,10 @@
* *
* 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 &#x60;special-key&#x60; to test the authorization filters. * 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 &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0 * Version: 1.0.0
* Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
*/ */
/** /**
* @license Apache 2.0 * @license Apache-2.0
* http://www.apache.org/licenses/LICENSE-2.0.html * http://www.apache.org/licenses/LICENSE-2.0.html
*/ */
@ -46,11 +46,11 @@ API.Client.UserApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/** /**
* Create user * Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param {!User} body Created user object * @param {!User} user Created user object
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestParams) { API.Client.UserApi.prototype.createUser = function(user, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/user'; var path = this.basePath_ + '/user';
@ -59,16 +59,16 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'user' is set
if (!body) { if (!user) {
throw new Error('Missing required parameter body when calling createUser'); throw new Error('Missing required parameter user when calling createUser');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'POST', method: 'POST',
url: path, url: path,
json: true, json: true,
data: body, data: user,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -83,11 +83,11 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param {!Array<!API.Client.User>} body List of user object * @param {!Array<!API.Client.User>} user List of user object
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extraHttpRequestParams) { API.Client.UserApi.prototype.createUsersWithArrayInput = function(user, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/user/createWithArray'; var path = this.basePath_ + '/user/createWithArray';
@ -96,16 +96,16 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'user' is set
if (!body) { if (!user) {
throw new Error('Missing required parameter body when calling createUsersWithArrayInput'); throw new Error('Missing required parameter user when calling createUsersWithArrayInput');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'POST', method: 'POST',
url: path, url: path,
json: true, json: true,
data: body, data: user,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -120,11 +120,11 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
/** /**
* Creates list of users with given input array * Creates list of users with given input array
* *
* @param {!Array<!API.Client.User>} body List of user object * @param {!Array<!API.Client.User>} user List of user object
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extraHttpRequestParams) { API.Client.UserApi.prototype.createUsersWithListInput = function(user, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/user/createWithList'; var path = this.basePath_ + '/user/createWithList';
@ -133,16 +133,16 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
/** @type {!Object} */ /** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_); var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set // verify required parameter 'user' is set
if (!body) { if (!user) {
throw new Error('Missing required parameter body when calling createUsersWithListInput'); throw new Error('Missing required parameter user when calling createUsersWithListInput');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'POST', method: 'POST',
url: path, url: path,
json: true, json: true,
data: body, data: user,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };
@ -194,7 +194,7 @@ API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpReques
/** /**
* Get user by user name * Get user by user name
* *
* @param {!string} username The name that needs to be fetched. Use user1 for testing. * @param {!string} username The name that needs to be fetched. Use user1 for testing.
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.User>} * @return {!angular.$q.Promise<!API.Client.User>}
*/ */
@ -312,11 +312,11 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
* Updated user * Updated user
* This can only be done by the logged in user. * This can only be done by the logged in user.
* @param {!string} username name that need to be deleted * @param {!string} username name that need to be deleted
* @param {!User} body Updated user object * @param {!User} user Updated user object
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send. * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise} * @return {!angular.$q.Promise}
*/ */
API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttpRequestParams) { API.Client.UserApi.prototype.updateUser = function(username, user, opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '/user/{username}' var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username)); .replace('{' + 'username' + '}', String(username));
@ -330,16 +330,16 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
if (!username) { if (!username) {
throw new Error('Missing required parameter username when calling updateUser'); throw new Error('Missing required parameter username when calling updateUser');
} }
// verify required parameter 'body' is set // verify required parameter 'user' is set
if (!body) { if (!user) {
throw new Error('Missing required parameter body when calling updateUser'); throw new Error('Missing required parameter user when calling updateUser');
} }
/** @type {!Object} */ /** @type {!Object} */
var httpRequestParams = { var httpRequestParams = {
method: 'PUT', method: 'PUT',
url: path, url: path,
json: true, json: true,
data: body, data: user,
params: queryParameters, params: queryParameters,
headers: headerParams headers: headerParams
}; };