[JavaScript] add enum tests cases for JS generator (java) (#3546)

* add enum tests cases for JS generator (java)

* fix typo quote
This commit is contained in:
wing328 2016-08-08 18:52:24 +08:00 committed by GitHub
parent ad3d9cd3b4
commit 7a245e3189
34 changed files with 1518 additions and 87 deletions

4
bin/javascript-petstore-all.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
./bin/javascript-petstore.sh
./bin/javascript-promise-petstore.sh

View File

@ -806,6 +806,20 @@ public class DefaultCodegen {
specialCharReplacements.put("<", "Less_Than");
specialCharReplacements.put(".", "Period");
specialCharReplacements.put("_", "Underscore");
specialCharReplacements.put("?", "Question_Mark");
specialCharReplacements.put(",", "Comma");
specialCharReplacements.put("'", "Quote");
specialCharReplacements.put("\"", "Double_Quote");
specialCharReplacements.put("/", "Slash");
specialCharReplacements.put("\\", "Back_Slash");
specialCharReplacements.put("(", "Left_Parenthesis");
specialCharReplacements.put(")", "Right_Parenthesis");
specialCharReplacements.put("{", "Left_Curly_Bracket");
specialCharReplacements.put("}", "Right_Curly_Bracket");
specialCharReplacements.put("[", "Left_Square_Bracket");
specialCharReplacements.put("]", "Right_Square_Bracket");
specialCharReplacements.put("~", "Tilde");
specialCharReplacements.put("`", "Backtick");
specialCharReplacements.put("<=", "Less_Than_Or_Equal_To");
specialCharReplacements.put(">=", "Greater_Than_Or_Equal_To");

View File

@ -1008,25 +1008,12 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override
public String toEnumVarName(String value, String datatype) {
return value;
/*
// number
if ("Integer".equals(datatype) || "Number".equals(datatype)) {
String varName = "NUMBER_" + value;
varName = varName.replaceAll("-", "MINUS_");
varName = varName.replaceAll("\\+", "PLUS_");
varName = varName.replaceAll("\\.", "_DOT_");
return varName;
// for symbol, e.g. $, #
if (getSymbolName(value) != null) {
return (getSymbolName(value)).toUpperCase();
}
// string
String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase();
if (var.matches("\\d.*")) {
return "_" + var;
} else {
return var;
}
*/
return value;
}
@Override

View File

@ -11,6 +11,8 @@ import io.swagger.models.ModelImpl;
import io.swagger.models.RefModel;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.StringProperty;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import org.testng.Assert;
import org.testng.annotations.Test;
@ -92,4 +94,61 @@ public class JavaScriptModelEnumTest {
Assert.assertEquals(enumVar.datatypeWithEnum, "UnsharedThingEnum");
Assert.assertTrue(enumVar.isEnum);
}
@Test(description = "test enum array model")
public void enumArrayMdoelTest() {
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml");
final DefaultCodegen codegen = new JavascriptClientCodegen();
final Model definition = model.getDefinitions().get("EnumArrays");
Property property = definition.getProperties().get("array_enum");
CodegenProperty prope = codegen.fromProperty("array_enum", property);
codegen.updateCodegenPropertyEnum(prope);
Assert.assertEquals(prope.datatypeWithEnum, "[ArrayEnumEnum]");
Assert.assertEquals(prope.enumName, "ArrayEnumEnum");
Assert.assertTrue(prope.isEnum);
Assert.assertEquals(prope.allowableValues.get("values"), Arrays.asList("fish", "crab"));
HashMap<String, String> fish= new HashMap<String, String>();
fish.put("name", "fish");
fish.put("value", "\"fish\"");
HashMap<String, String> crab= new HashMap<String, String>();
crab.put("name", "crab");
crab.put("value", "\"crab\"");
Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(fish, crab));
// assert inner items
Assert.assertEquals(prope.datatypeWithEnum, "[ArrayEnumEnum]");
Assert.assertEquals(prope.enumName, "ArrayEnumEnum");
Assert.assertTrue(prope.items.isEnum);
Assert.assertEquals(prope.items.allowableValues.get("values"), Arrays.asList("fish", "crab"));
Assert.assertEquals(prope.items.allowableValues.get("enumVars"), Arrays.asList(fish, crab));
}
@Test(description = "test enum model for values (numeric, string, etc)")
public void enumMdoelValueTest() {
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml");
final DefaultCodegen codegen = new JavascriptClientCodegen();
final Model definition = model.getDefinitions().get("Enum_Test");
Property property = definition.getProperties().get("enum_integer");
CodegenProperty prope = codegen.fromProperty("enum_integer", property);
codegen.updateCodegenPropertyEnum(prope);
Assert.assertEquals(prope.datatypeWithEnum, "EnumIntegerEnum");
Assert.assertEquals(prope.enumName, "EnumIntegerEnum");
Assert.assertTrue(prope.isEnum);
Assert.assertNull(prope.isContainer);
Assert.assertNull(prope.items);
Assert.assertEquals(prope.allowableValues.get("values"), Arrays.asList(1, -1));
HashMap<String, String> one = new HashMap<String, String>();
one.put("name", "1");
one.put("value", "1");
HashMap<String, String> minusOne = new HashMap<String, String>();
minusOne.put("name", "-1");
minusOne.put("value", "-1");
Assert.assertEquals(prope.allowableValues.get("enumVars"), Arrays.asList(one, minusOne));
}
}

View File

@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-07-11T21:45:36.147-07:00
- Build date: 2016-08-06T16:38:11.935+08:00
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
@ -55,26 +55,10 @@ var SwaggerPetstore = require('swagger_petstore');
var api = new SwaggerPetstore.FakeApi()
var _number = 3.4; // {Number} None
var body = new SwaggerPetstore.Client(); // {Client} client model
var _double = 1.2; // {Number} None
var _string = "_string_example"; // {String} None
var _byte = "B"; // {String} None
var opts = {
'integer': 56, // {Integer} None
'int32': 56, // {Integer} None
'int64': 789, // {Integer} None
'_float': 3.4, // {Number} None
'binary': "B", // {String} None
'_date': new Date("2013-10-20"), // {Date} None
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // {Date} None
'password': "password_example" // {String} None
};
api.testEndpointParameters(_number, _double, _string, _byte, opts).then(function() {
console.log('API called successfully.');
api.testClientModel(body).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
@ -88,6 +72,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*SwaggerPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
*SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*SwaggerPetstore.FakeApi* | [**testEnumQueryParameters**](docs/FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
*SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
@ -123,11 +108,14 @@ Class | Method | HTTP request | Description
- [SwaggerPetstore.ArrayTest](docs/ArrayTest.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Category](docs/Category.md)
- [SwaggerPetstore.Client](docs/Client.md)
- [SwaggerPetstore.Dog](docs/Dog.md)
- [SwaggerPetstore.EnumArrays](docs/EnumArrays.md)
- [SwaggerPetstore.EnumClass](docs/EnumClass.md)
- [SwaggerPetstore.EnumTest](docs/EnumTest.md)
- [SwaggerPetstore.FormatTest](docs/FormatTest.md)
- [SwaggerPetstore.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [SwaggerPetstore.List](docs/List.md)
- [SwaggerPetstore.MapTest](docs/MapTest.md)
- [SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [SwaggerPetstore.Model200Response](docs/Model200Response.md)
@ -145,6 +133,12 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth
- **Type**: OAuth
@ -154,9 +148,3 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account
- read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Client
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **String** | | [optional]

View File

@ -0,0 +1,31 @@
# SwaggerPetstore.EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**justSymbol** | **String** | | [optional]
**arrayEnum** | **[String]** | | [optional]
<a name="JustSymbolEnum"></a>
## Enum: JustSymbolEnum
* `GREATER_THAN_OR_EQUAL_TO` (value: `">="`)
* `DOLLAR` (value: `"$"`)
<a name="[ArrayEnumEnum]"></a>
## Enum: [ArrayEnumEnum]
* `fish` (value: `"fish"`)
* `crab` (value: `"crab"`)

View File

@ -4,10 +4,52 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
<a name="testClientModel"></a>
# **testClientModel**
> Client testClientModel(body)
To test \&quot;client\&quot; model
### Example
```javascript
var SwaggerPetstore = require('swagger_petstore');
var apiInstance = new SwaggerPetstore.FakeApi();
var body = new SwaggerPetstore.Client(); // Client | client model
apiInstance.testClientModel(body).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(_number, _double, _string, _byte, opts)

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123List** | **String** | | [optional]

View File

@ -11,6 +11,10 @@ Name | Type | Description | Notes
## Enum: {String: String}
* `UPPER` (value: `"UPPER"`)
* `lower` (value: `"lower"`)

View File

@ -64,8 +64,8 @@
* @type {Array.<String>}
*/
this.authentications = {
'petstore_auth': {type: 'oauth2'},
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
'petstore_auth': {type: 'oauth2'}
};
/**
* The default HTTP headers to be included for all API calls.

View File

@ -25,18 +25,18 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
define(['ApiClient', 'model/Client'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
module.exports = factory(require('../ApiClient'), require('../model/Client'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient);
root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client);
}
}(this, function(ApiClient) {
}(this, function(ApiClient, Client) {
'use strict';
/**
@ -57,6 +57,42 @@
/**
* To test \&quot;client\&quot; model
* @param {module:model/Client} body client model
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Client}
*/
this.testClientModel = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling testClientModel";
}
var pathParams = {
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = Client;
return this.apiClient.callApi(
'/fake', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

View File

@ -25,12 +25,12 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Cat', 'model/Category', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Cat'), require('./model/Category'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
}
}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) {
}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Cat, Category, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) {
'use strict';
/**
@ -115,11 +115,21 @@
* @property {module:model/Category}
*/
Category: Category,
/**
* The Client model constructor.
* @property {module:model/Client}
*/
Client: Client,
/**
* The Dog model constructor.
* @property {module:model/Dog}
*/
Dog: Dog,
/**
* The EnumArrays model constructor.
* @property {module:model/EnumArrays}
*/
EnumArrays: EnumArrays,
/**
* The EnumClass model constructor.
* @property {module:model/EnumClass}
@ -140,6 +150,11 @@
* @property {module:model/HasOnlyReadOnly}
*/
HasOnlyReadOnly: HasOnlyReadOnly,
/**
* The List model constructor.
* @property {module:model/List}
*/
List: List,
/**
* The MapTest model constructor.
* @property {module:model/MapTest}

View File

@ -0,0 +1,90 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Client = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The Client model module.
* @module model/Client
* @version 1.0.0
*/
/**
* Constructs a new <code>Client</code>.
* @alias module:model/Client
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>Client</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Client} obj Optional instance to populate.
* @return {module:model/Client} The populated <code>Client</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('client')) {
obj['client'] = ApiClient.convertToType(data['client'], 'String');
}
}
return obj;
}
/**
* @member {String} client
*/
exports.prototype['client'] = undefined;
return exports;
}));

View File

@ -0,0 +1,132 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.EnumArrays = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The EnumArrays model module.
* @module model/EnumArrays
* @version 1.0.0
*/
/**
* Constructs a new <code>EnumArrays</code>.
* @alias module:model/EnumArrays
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>EnumArrays</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/EnumArrays} obj Optional instance to populate.
* @return {module:model/EnumArrays} The populated <code>EnumArrays</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('just_symbol')) {
obj['just_symbol'] = ApiClient.convertToType(data['just_symbol'], 'String');
}
if (data.hasOwnProperty('array_enum')) {
obj['array_enum'] = ApiClient.convertToType(data['array_enum'], ['String']);
}
}
return obj;
}
/**
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
*/
exports.prototype['just_symbol'] = undefined;
/**
* @member {Array.<module:model/EnumArrays.ArrayEnumEnum>} array_enum
*/
exports.prototype['array_enum'] = undefined;
/**
* Allowed values for the <code>just_symbol</code> property.
* @enum {String}
* @readonly
*/
exports.JustSymbolEnum = {
/**
* value: ">="
* @const
*/
"GREATER_THAN_OR_EQUAL_TO": ">=",
/**
* value: "$"
* @const
*/
"DOLLAR": "$" };
/**
* Allowed values for the <code>arrayEnum</code> property.
* @enum {String}
* @readonly
*/
exports.ArrayEnumEnum = {
/**
* value: "fish"
* @const
*/
"fish": "fish",
/**
* value: "crab"
* @const
*/
"crab": "crab" };
return exports;
}));

View File

@ -0,0 +1,90 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.List = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The List model module.
* @module model/List
* @version 1.0.0
*/
/**
* Constructs a new <code>List</code>.
* @alias module:model/List
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>List</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/List} obj Optional instance to populate.
* @return {module:model/List} The populated <code>List</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('123-list')) {
obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String');
}
}
return obj;
}
/**
* @member {String} 123-list
*/
exports.prototype['123-list'] = undefined;
return exports;
}));

View File

@ -0,0 +1,76 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.Client();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('Client', function() {
it('should create an instance of Client', function() {
// uncomment below and update the code to test Client
//var instane = new SwaggerPetstore.Client();
//expect(instance).to.be.a(SwaggerPetstore.Client);
});
it('should have the property client (base name: "client")', function() {
// uncomment below and update the code to test the property client
//var instane = new SwaggerPetstore.Client();
//expect(instance).to.be();
});
});
}));

View File

@ -0,0 +1,82 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.EnumArrays();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('EnumArrays', function() {
it('should create an instance of EnumArrays', function() {
// uncomment below and update the code to test EnumArrays
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be.a(SwaggerPetstore.EnumArrays);
});
it('should have the property justSymbol (base name: "just_symbol")', function() {
// uncomment below and update the code to test the property justSymbol
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be();
});
it('should have the property arrayEnum (base name: "array_enum")', function() {
// uncomment below and update the code to test the property arrayEnum
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be();
});
});
}));

View File

@ -0,0 +1,76 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.List();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('List', function() {
it('should create an instance of List', function() {
// uncomment below and update the code to test List
//var instane = new SwaggerPetstore.List();
//expect(instance).to.be.a(SwaggerPetstore.List);
});
it('should have the property _123List (base name: "123-list")', function() {
// uncomment below and update the code to test the property _123List
//var instane = new SwaggerPetstore.List();
//expect(instance).to.be();
});
});
}));

View File

@ -6,7 +6,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-07-11T21:45:28.055-07:00
- Build date: 2016-08-06T16:38:09.393+08:00
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
## Installation
@ -55,33 +55,17 @@ var SwaggerPetstore = require('swagger_petstore');
var api = new SwaggerPetstore.FakeApi()
var _number = 3.4; // {Number} None
var body = new SwaggerPetstore.Client(); // {Client} client model
var _double = 1.2; // {Number} None
var _string = "_string_example"; // {String} None
var _byte = "B"; // {String} None
var opts = {
'integer': 56, // {Integer} None
'int32': 56, // {Integer} None
'int64': 789, // {Integer} None
'_float': 3.4, // {Number} None
'binary': "B", // {String} None
'_date': new Date("2013-10-20"), // {Date} None
'dateTime': new Date("2013-10-20T19:20:30+01:00"), // {Date} None
'password': "password_example" // {String} None
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
console.log('API called successfully. Returned data: ' + data);
}
};
api.testEndpointParameters(_number, _double, _string, _byte, opts, callback);
api.testClientModel(body, callback);
```
@ -91,6 +75,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*SwaggerPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
*SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*SwaggerPetstore.FakeApi* | [**testEnumQueryParameters**](docs/FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
*SwaggerPetstore.PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
@ -126,11 +111,14 @@ Class | Method | HTTP request | Description
- [SwaggerPetstore.ArrayTest](docs/ArrayTest.md)
- [SwaggerPetstore.Cat](docs/Cat.md)
- [SwaggerPetstore.Category](docs/Category.md)
- [SwaggerPetstore.Client](docs/Client.md)
- [SwaggerPetstore.Dog](docs/Dog.md)
- [SwaggerPetstore.EnumArrays](docs/EnumArrays.md)
- [SwaggerPetstore.EnumClass](docs/EnumClass.md)
- [SwaggerPetstore.EnumTest](docs/EnumTest.md)
- [SwaggerPetstore.FormatTest](docs/FormatTest.md)
- [SwaggerPetstore.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [SwaggerPetstore.List](docs/List.md)
- [SwaggerPetstore.MapTest](docs/MapTest.md)
- [SwaggerPetstore.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [SwaggerPetstore.Model200Response](docs/Model200Response.md)
@ -148,6 +136,12 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth
- **Type**: OAuth
@ -157,9 +151,3 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account
- read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.Client
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **String** | | [optional]

View File

@ -0,0 +1,31 @@
# SwaggerPetstore.EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**justSymbol** | **String** | | [optional]
**arrayEnum** | **[String]** | | [optional]
<a name="JustSymbolEnum"></a>
## Enum: JustSymbolEnum
* `GREATER_THAN_OR_EQUAL_TO` (value: `">="`)
* `DOLLAR` (value: `"$"`)
<a name="[ArrayEnumEnum]"></a>
## Enum: [ArrayEnumEnum]
* `fish` (value: `"fish"`)
* `crab` (value: `"crab"`)

View File

@ -4,10 +4,55 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** /fake | To test enum query parameters
<a name="testClientModel"></a>
# **testClientModel**
> Client testClientModel(body)
To test \&quot;client\&quot; model
### Example
```javascript
var SwaggerPetstore = require('swagger_petstore');
var apiInstance = new SwaggerPetstore.FakeApi();
var body = new SwaggerPetstore.Client(); // Client | client model
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.testClientModel(body, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(_number, _double, _string, _byte, opts)

View File

@ -0,0 +1,8 @@
# SwaggerPetstore.List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123List** | **String** | | [optional]

View File

@ -11,6 +11,10 @@ Name | Type | Description | Notes
## Enum: {String: String}
* `UPPER` (value: `"UPPER"`)
* `lower` (value: `"lower"`)

View File

@ -64,8 +64,8 @@
* @type {Array.<String>}
*/
this.authentications = {
'petstore_auth': {type: 'oauth2'},
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
'petstore_auth': {type: 'oauth2'}
};
/**
* The default HTTP headers to be included for all API calls.

View File

@ -25,18 +25,18 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
define(['ApiClient', 'model/Client'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
module.exports = factory(require('../ApiClient'), require('../model/Client'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient);
root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client);
}
}(this, function(ApiClient) {
}(this, function(ApiClient, Client) {
'use strict';
/**
@ -56,6 +56,50 @@
this.apiClient = apiClient || ApiClient.instance;
/**
* Callback function to receive the result of the testClientModel operation.
* @callback module:api/FakeApi~testClientModelCallback
* @param {String} error Error message, if any.
* @param {module:model/Client} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* To test \&quot;client\&quot; model
* @param {module:model/Client} body 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}
*/
this.testClientModel = function(body, callback) {
var postBody = body;
// verify the required parameter 'body' is set
if (body == undefined || body == null) {
throw "Missing the required parameter 'body' when calling testClientModel";
}
var pathParams = {
};
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = Client;
return this.apiClient.callApi(
'/fake', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the testEndpointParameters operation.
* @callback module:api/FakeApi~testEndpointParametersCallback

View File

@ -25,12 +25,12 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Cat', 'model/Category', 'model/Dog', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Cat', 'model/Category', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Cat'), require('./model/Category'), require('./model/Dog'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Cat'), require('./model/Category'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi'));
}
}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Cat, Category, Dog, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) {
}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Cat, Category, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) {
'use strict';
/**
@ -115,11 +115,21 @@
* @property {module:model/Category}
*/
Category: Category,
/**
* The Client model constructor.
* @property {module:model/Client}
*/
Client: Client,
/**
* The Dog model constructor.
* @property {module:model/Dog}
*/
Dog: Dog,
/**
* The EnumArrays model constructor.
* @property {module:model/EnumArrays}
*/
EnumArrays: EnumArrays,
/**
* The EnumClass model constructor.
* @property {module:model/EnumClass}
@ -140,6 +150,11 @@
* @property {module:model/HasOnlyReadOnly}
*/
HasOnlyReadOnly: HasOnlyReadOnly,
/**
* The List model constructor.
* @property {module:model/List}
*/
List: List,
/**
* The MapTest model constructor.
* @property {module:model/MapTest}

View File

@ -0,0 +1,90 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.Client = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The Client model module.
* @module model/Client
* @version 1.0.0
*/
/**
* Constructs a new <code>Client</code>.
* @alias module:model/Client
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>Client</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/Client} obj Optional instance to populate.
* @return {module:model/Client} The populated <code>Client</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('client')) {
obj['client'] = ApiClient.convertToType(data['client'], 'String');
}
}
return obj;
}
/**
* @member {String} client
*/
exports.prototype['client'] = undefined;
return exports;
}));

View File

@ -0,0 +1,132 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.EnumArrays = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The EnumArrays model module.
* @module model/EnumArrays
* @version 1.0.0
*/
/**
* Constructs a new <code>EnumArrays</code>.
* @alias module:model/EnumArrays
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>EnumArrays</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/EnumArrays} obj Optional instance to populate.
* @return {module:model/EnumArrays} The populated <code>EnumArrays</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('just_symbol')) {
obj['just_symbol'] = ApiClient.convertToType(data['just_symbol'], 'String');
}
if (data.hasOwnProperty('array_enum')) {
obj['array_enum'] = ApiClient.convertToType(data['array_enum'], ['String']);
}
}
return obj;
}
/**
* @member {module:model/EnumArrays.JustSymbolEnum} just_symbol
*/
exports.prototype['just_symbol'] = undefined;
/**
* @member {Array.<module:model/EnumArrays.ArrayEnumEnum>} array_enum
*/
exports.prototype['array_enum'] = undefined;
/**
* Allowed values for the <code>just_symbol</code> property.
* @enum {String}
* @readonly
*/
exports.JustSymbolEnum = {
/**
* value: ">="
* @const
*/
"GREATER_THAN_OR_EQUAL_TO": ">=",
/**
* value: "$"
* @const
*/
"DOLLAR": "$" };
/**
* Allowed values for the <code>arrayEnum</code> property.
* @enum {String}
* @readonly
*/
exports.ArrayEnumEnum = {
/**
* value: "fish"
* @const
*/
"fish": "fish",
/**
* value: "crab"
* @const
*/
"crab": "crab" };
return exports;
}));

View File

@ -0,0 +1,90 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.List = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* The List model module.
* @module model/List
* @version 1.0.0
*/
/**
* Constructs a new <code>List</code>.
* @alias module:model/List
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>List</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/List} obj Optional instance to populate.
* @return {module:model/List} The populated <code>List</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('123-list')) {
obj['123-list'] = ApiClient.convertToType(data['123-list'], 'String');
}
}
return obj;
}
/**
* @member {String} 123-list
*/
exports.prototype['123-list'] = undefined;
return exports;
}));

View File

@ -0,0 +1,76 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.Client();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('Client', function() {
it('should create an instance of Client', function() {
// uncomment below and update the code to test Client
//var instane = new SwaggerPetstore.Client();
//expect(instance).to.be.a(SwaggerPetstore.Client);
});
it('should have the property client (base name: "client")', function() {
// uncomment below and update the code to test the property client
//var instane = new SwaggerPetstore.Client();
//expect(instance).to.be();
});
});
}));

View File

@ -0,0 +1,82 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.EnumArrays();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('EnumArrays', function() {
it('should create an instance of EnumArrays', function() {
// uncomment below and update the code to test EnumArrays
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be.a(SwaggerPetstore.EnumArrays);
});
it('should have the property justSymbol (base name: "just_symbol")', function() {
// uncomment below and update the code to test the property justSymbol
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be();
});
it('should have the property arrayEnum (base name: "array_enum")', function() {
// uncomment below and update the code to test the property arrayEnum
//var instane = new SwaggerPetstore.EnumArrays();
//expect(instance).to.be();
});
});
}));

View File

@ -0,0 +1,76 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', '../../src/index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require('../../src/index'));
} else {
// Browser globals (root is window)
factory(root.expect, root.SwaggerPetstore);
}
}(this, function(expect, SwaggerPetstore) {
'use strict';
var instance;
beforeEach(function() {
instance = new SwaggerPetstore.List();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('List', function() {
it('should create an instance of List', function() {
// uncomment below and update the code to test List
//var instane = new SwaggerPetstore.List();
//expect(instance).to.be.a(SwaggerPetstore.List);
});
it('should have the property _123List (base name: "123-list")', function() {
// uncomment below and update the code to test the property _123List
//var instane = new SwaggerPetstore.List();
//expect(instance).to.be();
});
});
}));