remove unnecessary change in JS closure codegen

This commit is contained in:
wing328 2016-08-31 17:13:35 +08:00
parent 5804fbc1dd
commit 8523c57f8c
10 changed files with 276 additions and 290 deletions

View File

@ -118,12 +118,23 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
.defaultValue("swagger"));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
.defaultValue("1.0.0"));
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated")
.defaultValue(Boolean.TRUE.toString()));
}
@Override
public void processOpts() {
super.processOpts();
// default HIDE_GENERATION_TIMESTAMP to true
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
} else {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
Boolean.valueOf((String)additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP).toString()));
}
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
}

View File

@ -70,6 +70,19 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem
embeddedTemplateDir = templateDir = "Javascript-Closure-Angular";
apiPackage = "API.Client";
modelPackage = "API.Client";
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "hides the timestamp when files were generated")
.defaultValue(Boolean.TRUE.toString()));
}
@Override
public void processOpts() {
super.processOpts();
// default HIDE_GENERATION_TIMESTAMP to true
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
}
}
@Override

View File

@ -6,7 +6,9 @@
* {{ appDescription }}{{/appDescription}}{{#version}}
* Version: {{version}}{{/version}}{{#appContact}}
* Contact: {{appContact}}{{/appContact}}
{{^hideGenerationTimestamp}}
* Generated at: {{generatedDate}}
{{/hideGenerationTimestamp}}
* Generated by: {{generatorClass}}
*/{{#licenseInfo}}
/**

View File

@ -9,7 +9,9 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- API version: {{appVersion}}
- Package version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})

View File

@ -23,6 +23,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
return builder
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.build();
}

View File

@ -20,6 +20,7 @@ public class JavascriptClosureAnularClientOptionsProvider implements OptionsProv
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.build();
}

View File

@ -7,7 +7,6 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-08-17T22:53:45.063+08:00
- Build package: class io.swagger.codegen.languages.GoClientCodegen
## Installation
@ -89,6 +88,10 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header
## http_basic_test
- **Type**: HTTP basic authentication
## petstore_auth
- **Type**: OAuth
@ -98,10 +101,6 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## http_basic_test
- **Type**: HTTP basic authentication
## Author

View File

@ -3,9 +3,8 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* 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 &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -45,45 +44,6 @@ API.Client.PetApi = function($http, $httpParamSerializer, $injector) {
}
API.Client.PetApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/**
* Update an existing pet
*
* @param {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updatePet');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Add a new pet to the store
*
@ -110,9 +70,47 @@ API.Client.PetApi.prototype.addPet = function(body, opt_extraHttpRequestParams)
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Deletes a pet
*
* @param {!number} petId Pet id to delete
* @param {!string=} opt_apiKey
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['api_key'] = opt_apiKey;
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
@ -152,9 +150,7 @@ API.Client.PetApi.prototype.findPetsByStatus = function(status, opt_extraHttpReq
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -194,9 +190,7 @@ API.Client.PetApi.prototype.findPetsByTags = function(tags, opt_extraHttpRequest
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -233,9 +227,44 @@ API.Client.PetApi.prototype.getPetById = function(petId, opt_extraHttpRequestPar
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Update an existing pet
*
* @param {!Pet} body Pet object that needs to be added to the store
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.updatePet = function(body, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet';
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'body' is set
if (!body) {
throw new Error('Missing required parameter body when calling updatePet');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'PUT',
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
@ -283,51 +312,7 @@ API.Client.PetApi.prototype.updatePetWithForm = function(petId, opt_name, opt_st
method: 'POST',
url: path,
json: false,
data: this.httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Deletes a pet
*
* @param {!number} petId Pet id to delete
* @param {!string=} opt_apiKey
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.PetApi.prototype.deletePet = function(petId, opt_apiKey, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling deletePet');
}
headerParams['api_key'] = opt_apiKey;
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
data: this.httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};
@ -376,9 +361,7 @@ API.Client.PetApi.prototype.uploadFile = function(petId, opt_additionalMetadata,
method: 'POST',
url: path,
json: false,
data: this.httpParamSerializer(formParams),
data: this.httpParamSerializer(formParams),
params: queryParameters,
headers: headerParams
};

View File

@ -3,9 +3,8 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* 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 &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -44,6 +43,43 @@ API.Client.StoreApi = function($http, $httpParamSerializer, $injector) {
}
API.Client.StoreApi.$inject = ['$http', '$httpParamSerializer', '$injector'];
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param {!string} orderId ID of the order that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@ -64,9 +100,44 @@ API.Client.StoreApi.prototype.getInventory = function(opt_extraHttpRequestParams
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param {!number} orderId ID of pet that needs to be fetched
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>}
*/
API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
@ -103,87 +174,7 @@ API.Client.StoreApi.prototype.placeOrder = function(body, opt_extraHttpRequestPa
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param {!number} orderId ID of pet that needs to be fetched
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise<!API.Client.Order>}
*/
API.Client.StoreApi.prototype.getOrderById = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling getOrderById');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param {!string} orderId ID of the order that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.StoreApi.prototype.deleteOrder = function(orderId, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'orderId' is set
if (!orderId) {
throw new Error('Missing required parameter orderId when calling deleteOrder');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};

View File

@ -3,9 +3,8 @@
* Do not edit this file by hand or your changes will be lost next time it is
* generated.
*
* 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 &#x60;special-key&#x60; to test the authorization filters.
* Version: 1.0.0
* Generated at: 2016-04-28T06:15:51.482Z
* Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
*/
/**
@ -70,9 +69,7 @@ API.Client.UserApi.prototype.createUser = function(body, opt_extraHttpRequestPar
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -109,9 +106,7 @@ API.Client.UserApi.prototype.createUsersWithArrayInput = function(body, opt_extr
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -148,9 +143,81 @@ API.Client.UserApi.prototype.createUsersWithListInput = function(body, opt_extra
url: path,
json: true,
data: body,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param {!string} username The name that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Get user by user name
*
* @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.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
@ -199,9 +266,7 @@ API.Client.UserApi.prototype.loginUser = function(username, password, opt_extraH
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -232,48 +297,7 @@ API.Client.UserApi.prototype.logoutUser = function(opt_extraHttpRequestParams) {
method: 'GET',
url: path,
json: true,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Get user by user name
*
* @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.
* @return {!angular.$q.Promise<!API.Client.User>}
*/
API.Client.UserApi.prototype.getUserByName = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling getUserByName');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'GET',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};
@ -316,48 +340,7 @@ API.Client.UserApi.prototype.updateUser = function(username, body, opt_extraHttp
url: path,
json: true,
data: body,
params: queryParameters,
headers: headerParams
};
if (opt_extraHttpRequestParams) {
httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
}
return (/** @type {?} */ (this.http_))(httpRequestParams);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param {!string} username The name that needs to be deleted
* @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
* @return {!angular.$q.Promise}
*/
API.Client.UserApi.prototype.deleteUser = function(username, opt_extraHttpRequestParams) {
/** @const {string} */
var path = this.basePath_ + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
/** @type {!Object} */
var queryParameters = {};
/** @type {!Object} */
var headerParams = angular.extend({}, this.defaultHeaders_);
// verify required parameter 'username' is set
if (!username) {
throw new Error('Missing required parameter username when calling deleteUser');
}
/** @type {!Object} */
var httpRequestParams = {
method: 'DELETE',
url: path,
json: true,
params: queryParameters,
params: queryParameters,
headers: headerParams
};