[JS] mark ES5 as deprecated (#6408)

* mark js es5 deprecated, remove samples, migrate samples to use oas3

* update test in pom.xml

* update js samples

* delete js es5 samples

* update js petstore

* remove openapi3 js petstore

* fix tests

* skip test/model/AdditionalPropertiesArray.spec.js

* fix test

* update doc
This commit is contained in:
William Cheng
2020-05-26 09:55:00 +08:00
committed by GitHub
parent fb57b602c2
commit d49de5b577
762 changed files with 8419 additions and 53501 deletions

View File

@@ -45,15 +45,15 @@ export default class AnotherFakeApi {
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param {module:model/Client} body client model
* @param {module:model/Client} client client model
* @param {module:api/AnotherFakeApi~call123testSpecialTagsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Client}
*/
call123testSpecialTags(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling call123testSpecialTags");
call123testSpecialTags(client, callback) {
let postBody = client;
// verify the required parameter 'client' is set
if (client === undefined || client === null) {
throw new Error("Missing the required parameter 'client' when calling call123testSpecialTags");
}
let pathParams = {

View File

@@ -0,0 +1,73 @@
/**
* OpenAPI 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: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from "../ApiClient";
import InlineResponseDefault from '../model/InlineResponseDefault';
/**
* Default service.
* @module api/DefaultApi
* @version 1.0.0
*/
export default class DefaultApi {
/**
* Constructs a new DefaultApi.
* @alias module:api/DefaultApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
}
/**
* Callback function to receive the result of the fooGet operation.
* @callback module:api/DefaultApi~fooGetCallback
* @param {String} error Error message, if any.
* @param {module:model/InlineResponseDefault} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* @param {module:api/DefaultApi~fooGetCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/InlineResponseDefault}
*/
fooGet(callback) {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = InlineResponseDefault;
return this.apiClient.callApi(
'/foo', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
}

View File

@@ -15,9 +15,10 @@
import ApiClient from "../ApiClient";
import Client from '../model/Client';
import FileSchemaTestClass from '../model/FileSchemaTestClass';
import HealthCheckResult from '../model/HealthCheckResult';
import OuterComposite from '../model/OuterComposite';
import Pet from '../model/Pet';
import User from '../model/User';
import XmlItem from '../model/XmlItem';
/**
* Fake service.
@@ -39,25 +40,20 @@ export default class FakeApi {
/**
* Callback function to receive the result of the createXmlItem operation.
* @callback module:api/FakeApi~createXmlItemCallback
* Callback function to receive the result of the fakeHealthGet operation.
* @callback module:api/FakeApi~fakeHealthGetCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {module:model/HealthCheckResult} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* creates an XmlItem
* this route creates an XmlItem
* @param {module:model/XmlItem} xmlItem XmlItem Body
* @param {module:api/FakeApi~createXmlItemCallback} callback The callback function, accepting three arguments: error, data, response
* Health check endpoint
* @param {module:api/FakeApi~fakeHealthGetCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/HealthCheckResult}
*/
createXmlItem(xmlItem, callback) {
let postBody = xmlItem;
// verify the required parameter 'xmlItem' is set
if (xmlItem === undefined || xmlItem === null) {
throw new Error("Missing the required parameter 'xmlItem' when calling createXmlItem");
}
fakeHealthGet(callback) {
let postBody = null;
let pathParams = {
};
@@ -69,11 +65,57 @@ export default class FakeApi {
};
let authNames = [];
let contentTypes = ['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = HealthCheckResult;
return this.apiClient.callApi(
'/fake/health', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the fakeHttpSignatureTest operation.
* @callback module:api/FakeApi~fakeHttpSignatureTestCallback
* @param {String} error Error message, if any.
* @param data This operation does not return a value.
* @param {String} response The complete HTTP response.
*/
/**
* test http signature authentication
* @param {module:model/Pet} pet Pet object that needs to be added to the store
* @param {Object} opts Optional parameters
* @param {String} opts.query1 query parameter
* @param {String} opts.header1 header parameter
* @param {module:api/FakeApi~fakeHttpSignatureTestCallback} callback The callback function, accepting three arguments: error, data, response
*/
fakeHttpSignatureTest(pet, opts, callback) {
opts = opts || {};
let postBody = pet;
// verify the required parameter 'pet' is set
if (pet === undefined || pet === null) {
throw new Error("Missing the required parameter 'pet' when calling fakeHttpSignatureTest");
}
let pathParams = {
};
let queryParams = {
'query_1': opts['query1']
};
let headerParams = {
'header_1': opts['header1']
};
let formParams = {
};
let authNames = ['http_signature_test'];
let contentTypes = ['application/json', 'application/xml'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
'/fake/create_xml_item', 'POST',
'/fake/http-signature-test', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
@@ -108,7 +150,7 @@ export default class FakeApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = ['*/*'];
let returnType = 'Boolean';
return this.apiClient.callApi(
@@ -129,13 +171,13 @@ export default class FakeApi {
/**
* Test serialization of object with outer number type
* @param {Object} opts Optional parameters
* @param {module:model/OuterComposite} opts.body Input composite as post body
* @param {module:model/OuterComposite} opts.outerComposite Input composite as post body
* @param {module:api/FakeApi~fakeOuterCompositeSerializeCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/OuterComposite}
*/
fakeOuterCompositeSerialize(opts, callback) {
opts = opts || {};
let postBody = opts['body'];
let postBody = opts['outerComposite'];
let pathParams = {
};
@@ -147,7 +189,7 @@ export default class FakeApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = ['*/*'];
let returnType = OuterComposite;
return this.apiClient.callApi(
@@ -186,7 +228,7 @@ export default class FakeApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = ['*/*'];
let returnType = 'Number';
return this.apiClient.callApi(
@@ -225,7 +267,7 @@ export default class FakeApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = ['*/*'];
let returnType = 'String';
return this.apiClient.callApi(
@@ -245,14 +287,14 @@ export default class FakeApi {
/**
* For this test, the body for this request much reference a schema named `File`.
* @param {module:model/FileSchemaTestClass} body
* @param {module:model/FileSchemaTestClass} fileSchemaTestClass
* @param {module:api/FakeApi~testBodyWithFileSchemaCallback} callback The callback function, accepting three arguments: error, data, response
*/
testBodyWithFileSchema(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testBodyWithFileSchema");
testBodyWithFileSchema(fileSchemaTestClass, callback) {
let postBody = fileSchemaTestClass;
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass === undefined || fileSchemaTestClass === null) {
throw new Error("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
}
let pathParams = {
@@ -285,18 +327,18 @@ export default class FakeApi {
/**
* @param {String} query
* @param {module:model/User} body
* @param {module:model/User} user
* @param {module:api/FakeApi~testBodyWithQueryParamsCallback} callback The callback function, accepting three arguments: error, data, response
*/
testBodyWithQueryParams(query, body, callback) {
let postBody = body;
testBodyWithQueryParams(query, user, callback) {
let postBody = user;
// verify the required parameter 'query' is set
if (query === undefined || query === null) {
throw new Error("Missing the required parameter 'query' when calling testBodyWithQueryParams");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testBodyWithQueryParams");
// verify the required parameter 'user' is set
if (user === undefined || user === null) {
throw new Error("Missing the required parameter 'user' when calling testBodyWithQueryParams");
}
let pathParams = {
@@ -331,15 +373,15 @@ export default class FakeApi {
/**
* To test \"client\" model
* To test \"client\" model
* @param {module:model/Client} body client model
* @param {module:model/Client} client client model
* @param {module:api/FakeApi~testClientModelCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Client}
*/
testClientModel(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testClientModel");
testClientModel(client, callback) {
let postBody = client;
// verify the required parameter 'client' is set
if (client === undefined || client === null) {
throw new Error("Missing the required parameter 'client' when calling testClientModel");
}
let pathParams = {
@@ -371,8 +413,8 @@ export default class FakeApi {
*/
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* @param {Number} _number None
* @param {Number} _double None
* @param {String} patternWithoutDelimiter None
@@ -473,7 +515,7 @@ export default class FakeApi {
let pathParams = {
};
let queryParams = {
'enum_query_string_array': this.apiClient.buildCollectionParam(opts['enumQueryStringArray'], 'csv'),
'enum_query_string_array': this.apiClient.buildCollectionParam(opts['enumQueryStringArray'], 'multi'),
'enum_query_string': opts['enumQueryString'],
'enum_query_integer': opts['enumQueryInteger'],
'enum_query_double': opts['enumQueryDouble']
@@ -549,7 +591,7 @@ export default class FakeApi {
let formParams = {
};
let authNames = [];
let authNames = ['bearer_test'];
let contentTypes = [];
let accepts = [];
let returnType = null;
@@ -570,14 +612,14 @@ export default class FakeApi {
/**
* test inline additionalProperties
* @param {Object.<String, {String: String}>} param request body
* @param {Object.<String, {String: String}>} requestBody request body
* @param {module:api/FakeApi~testInlineAdditionalPropertiesCallback} callback The callback function, accepting three arguments: error, data, response
*/
testInlineAdditionalProperties(param, callback) {
let postBody = param;
// verify the required parameter 'param' is set
if (param === undefined || param === null) {
throw new Error("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
testInlineAdditionalProperties(requestBody, callback) {
let postBody = requestBody;
// verify the required parameter 'requestBody' is set
if (requestBody === undefined || requestBody === null) {
throw new Error("Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties");
}
let pathParams = {
@@ -690,7 +732,7 @@ export default class FakeApi {
let pathParams = {
};
let queryParams = {
'pipe': this.apiClient.buildCollectionParam(pipe, 'csv'),
'pipe': this.apiClient.buildCollectionParam(pipe, 'multi'),
'ioutil': this.apiClient.buildCollectionParam(ioutil, 'csv'),
'http': this.apiClient.buildCollectionParam(http, 'space'),
'url': this.apiClient.buildCollectionParam(url, 'csv'),

View File

@@ -45,15 +45,15 @@ export default class FakeClassnameTags123Api {
/**
* To test class name in snake case
* To test class name in snake case
* @param {module:model/Client} body client model
* @param {module:model/Client} client client model
* @param {module:api/FakeClassnameTags123Api~testClassnameCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Client}
*/
testClassname(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling testClassname");
testClassname(client, callback) {
let postBody = client;
// verify the required parameter 'client' is set
if (client === undefined || client === null) {
throw new Error("Missing the required parameter 'client' when calling testClassname");
}
let pathParams = {

View File

@@ -45,14 +45,15 @@ export default class PetApi {
/**
* Add a new pet to the store
* @param {module:model/Pet} body Pet object that needs to be added to the store
* @param {module:model/Pet} pet Pet object that needs to be added to the store
* @param {module:api/PetApi~addPetCallback} callback The callback function, accepting three arguments: error, data, response
*/
addPet(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling addPet");
addPet(pet, opts, callback) {
opts = opts || {};
let postBody = pet;
// verify the required parameter 'pet' is set
if (pet === undefined || pet === null) {
throw new Error("Missing the required parameter 'pet' when calling addPet");
}
let pathParams = {
@@ -68,10 +69,19 @@ export default class PetApi {
let contentTypes = ['application/json', 'application/xml'];
let accepts = [];
let returnType = null;
let basePaths = ['http://petstore.swagger.io/v2', 'http://path-server-test.petstore.local/v2'];
let basePath = basePaths[0]; // by default use the first one in "servers" defined in OpenAPI
if (typeof opts['_base_path_index'] !== 'undefined') {
if (opts['_base_path_index'] >= basePaths.length || opts['_base_path_index'] < 0) {
throw new Error("Invalid index " + opts['_base_path_index'] + " when selecting the host settings. Must be less than " + basePaths.length);
}
basePath = basePaths[opts['_base_path_index']];
}
return this.apiClient.callApi(
'/pet', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
authNames, contentTypes, accepts, returnType, basePath, callback
);
}
@@ -259,14 +269,15 @@ export default class PetApi {
/**
* Update an existing pet
* @param {module:model/Pet} body Pet object that needs to be added to the store
* @param {module:model/Pet} pet Pet object that needs to be added to the store
* @param {module:api/PetApi~updatePetCallback} callback The callback function, accepting three arguments: error, data, response
*/
updatePet(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updatePet");
updatePet(pet, opts, callback) {
opts = opts || {};
let postBody = pet;
// verify the required parameter 'pet' is set
if (pet === undefined || pet === null) {
throw new Error("Missing the required parameter 'pet' when calling updatePet");
}
let pathParams = {
@@ -282,10 +293,19 @@ export default class PetApi {
let contentTypes = ['application/json', 'application/xml'];
let accepts = [];
let returnType = null;
let basePaths = ['http://petstore.swagger.io/v2', 'http://path-server-test.petstore.local/v2'];
let basePath = basePaths[0]; // by default use the first one in "servers" defined in OpenAPI
if (typeof opts['_base_path_index'] !== 'undefined') {
if (opts['_base_path_index'] >= basePaths.length || opts['_base_path_index'] < 0) {
throw new Error("Invalid index " + opts['_base_path_index'] + " when selecting the host settings. Must be less than " + basePaths.length);
}
basePath = basePaths[opts['_base_path_index']];
}
return this.apiClient.callApi(
'/pet', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
authNames, contentTypes, accepts, returnType, basePath, callback
);
}

View File

@@ -166,15 +166,15 @@ export default class StoreApi {
/**
* Place an order for a pet
* @param {module:model/Order} body order placed for purchasing the pet
* @param {module:model/Order} order order placed for purchasing the pet
* @param {module:api/StoreApi~placeOrderCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Order}
*/
placeOrder(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling placeOrder");
placeOrder(order, callback) {
let postBody = order;
// verify the required parameter 'order' is set
if (order === undefined || order === null) {
throw new Error("Missing the required parameter 'order' when calling placeOrder");
}
let pathParams = {
@@ -187,7 +187,7 @@ export default class StoreApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = ['application/xml', 'application/json'];
let returnType = Order;
return this.apiClient.callApi(

View File

@@ -45,14 +45,14 @@ export default class UserApi {
/**
* Create user
* This can only be done by the logged in user.
* @param {module:model/User} body Created user object
* @param {module:model/User} user Created user object
* @param {module:api/UserApi~createUserCallback} callback The callback function, accepting three arguments: error, data, response
*/
createUser(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUser");
createUser(user, callback) {
let postBody = user;
// verify the required parameter 'user' is set
if (user === undefined || user === null) {
throw new Error("Missing the required parameter 'user' when calling createUser");
}
let pathParams = {
@@ -65,7 +65,7 @@ export default class UserApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
@@ -85,14 +85,14 @@ export default class UserApi {
/**
* Creates list of users with given input array
* @param {Array.<module:model/User>} body List of user object
* @param {Array.<module:model/User>} user List of user object
* @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response
*/
createUsersWithArrayInput(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput");
createUsersWithArrayInput(user, callback) {
let postBody = user;
// verify the required parameter 'user' is set
if (user === undefined || user === null) {
throw new Error("Missing the required parameter 'user' when calling createUsersWithArrayInput");
}
let pathParams = {
@@ -105,7 +105,7 @@ export default class UserApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
@@ -125,14 +125,14 @@ export default class UserApi {
/**
* Creates list of users with given input array
* @param {Array.<module:model/User>} body List of user object
* @param {Array.<module:model/User>} user List of user object
* @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response
*/
createUsersWithListInput(body, callback) {
let postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput");
createUsersWithListInput(user, callback) {
let postBody = user;
// verify the required parameter 'user' is set
if (user === undefined || user === null) {
throw new Error("Missing the required parameter 'user' when calling createUsersWithListInput");
}
let pathParams = {
@@ -145,7 +145,7 @@ export default class UserApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(
@@ -334,18 +334,18 @@ export default class UserApi {
* Updated user
* This can only be done by the logged in user.
* @param {String} username name that need to be deleted
* @param {module:model/User} body Updated user object
* @param {module:model/User} user Updated user object
* @param {module:api/UserApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response
*/
updateUser(username, body, callback) {
let postBody = body;
updateUser(username, user, callback) {
let postBody = user;
// verify the required parameter 'username' is set
if (username === undefined || username === null) {
throw new Error("Missing the required parameter 'username' when calling updateUser");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling updateUser");
// verify the required parameter 'user' is set
if (user === undefined || user === null) {
throw new Error("Missing the required parameter 'user' when calling updateUser");
}
let pathParams = {
@@ -359,7 +359,7 @@ export default class UserApi {
};
let authNames = [];
let contentTypes = [];
let contentTypes = ['application/json'];
let accepts = [];
let returnType = null;
return this.apiClient.callApi(