handle composed schemas in InlineModelResolver (#2112)

* handle composed schemas in InlineModelResolver

* fix unit test -> TestUtils.parseSpec

* update samples

* fix samples

* update samples

* update samples

* add new files
This commit is contained in:
Matthieu Berthomé
2019-05-08 04:19:15 +02:00
committed by William Cheng
parent 7eb2be9c99
commit ee43cc1520
412 changed files with 17001 additions and 101 deletions

View File

@@ -28,10 +28,12 @@ import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
import ArrayTest from './model/ArrayTest';
import Capitalization from './model/Capitalization';
import Cat from './model/Cat';
import CatAllOf from './model/CatAllOf';
import Category from './model/Category';
import ClassModel from './model/ClassModel';
import Client from './model/Client';
import Dog from './model/Dog';
import DogAllOf from './model/DogAllOf';
import EnumArrays from './model/EnumArrays';
import EnumClass from './model/EnumClass';
import EnumTest from './model/EnumTest';
@@ -193,6 +195,12 @@ export {
*/
Cat,
/**
* The CatAllOf model constructor.
* @property {module:model/CatAllOf}
*/
CatAllOf,
/**
* The Category model constructor.
* @property {module:model/Category}
@@ -217,6 +225,12 @@ export {
*/
Dog,
/**
* The DogAllOf model constructor.
* @property {module:model/DogAllOf}
*/
DogAllOf,
/**
* The EnumArrays model constructor.
* @property {module:model/EnumArrays}

View File

@@ -13,6 +13,7 @@
import ApiClient from '../ApiClient';
import Animal from './Animal';
import CatAllOf from './CatAllOf';
/**
* The Cat model module.
@@ -25,10 +26,11 @@ class Cat {
* @alias module:model/Cat
* @extends module:model/Animal
* @implements module:model/Animal
* @implements module:model/CatAllOf
* @param className {String}
*/
constructor(className) {
Animal.initialize(this, className);
Animal.initialize(this, className);CatAllOf.initialize(this);
Cat.initialize(this, className);
}
@@ -52,6 +54,7 @@ class Cat {
obj = obj || new Cat();
Animal.constructFromObject(data, obj);
Animal.constructFromObject(data, obj);
CatAllOf.constructFromObject(data, obj);
if (data.hasOwnProperty('declawed')) {
obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean');
@@ -79,6 +82,11 @@ Animal.prototype['className'] = undefined;
* @default 'red'
*/
Animal.prototype['color'] = 'red';
// Implement CatAllOf interface:
/**
* @member {Boolean} declawed
*/
CatAllOf.prototype['declawed'] = undefined;

View File

@@ -0,0 +1,71 @@
/**
* 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: \" \\
*
* OpenAPI spec version: 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';
/**
* The CatAllOf model module.
* @module model/CatAllOf
* @version 1.0.0
*/
class CatAllOf {
/**
* Constructs a new <code>CatAllOf</code>.
* @alias module:model/CatAllOf
*/
constructor() {
CatAllOf.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>CatAllOf</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/CatAllOf} obj Optional instance to populate.
* @return {module:model/CatAllOf} The populated <code>CatAllOf</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new CatAllOf();
if (data.hasOwnProperty('declawed')) {
obj['declawed'] = ApiClient.convertToType(data['declawed'], 'Boolean');
}
}
return obj;
}
}
/**
* @member {Boolean} declawed
*/
CatAllOf.prototype['declawed'] = undefined;
export default CatAllOf;

View File

@@ -13,6 +13,7 @@
import ApiClient from '../ApiClient';
import Animal from './Animal';
import DogAllOf from './DogAllOf';
/**
* The Dog model module.
@@ -25,10 +26,11 @@ class Dog {
* @alias module:model/Dog
* @extends module:model/Animal
* @implements module:model/Animal
* @implements module:model/DogAllOf
* @param className {String}
*/
constructor(className) {
Animal.initialize(this, className);
Animal.initialize(this, className);DogAllOf.initialize(this);
Dog.initialize(this, className);
}
@@ -52,6 +54,7 @@ class Dog {
obj = obj || new Dog();
Animal.constructFromObject(data, obj);
Animal.constructFromObject(data, obj);
DogAllOf.constructFromObject(data, obj);
if (data.hasOwnProperty('breed')) {
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
@@ -79,6 +82,11 @@ Animal.prototype['className'] = undefined;
* @default 'red'
*/
Animal.prototype['color'] = 'red';
// Implement DogAllOf interface:
/**
* @member {String} breed
*/
DogAllOf.prototype['breed'] = undefined;

View File

@@ -0,0 +1,71 @@
/**
* 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: \" \\
*
* OpenAPI spec version: 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';
/**
* The DogAllOf model module.
* @module model/DogAllOf
* @version 1.0.0
*/
class DogAllOf {
/**
* Constructs a new <code>DogAllOf</code>.
* @alias module:model/DogAllOf
*/
constructor() {
DogAllOf.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>DogAllOf</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/DogAllOf} obj Optional instance to populate.
* @return {module:model/DogAllOf} The populated <code>DogAllOf</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new DogAllOf();
if (data.hasOwnProperty('breed')) {
obj['breed'] = ApiClient.convertToType(data['breed'], 'String');
}
}
return obj;
}
}
/**
* @member {String} breed
*/
DogAllOf.prototype['breed'] = undefined;
export default DogAllOf;