mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-06 00:26:08 +00:00
Support models with multi-level hierarchy (via roxspring) (#4503)
* Example of broken multi-level hierarchy * Support for multiple levels of hierarchy in model objects * Support for multiple levels of hierarchy in generators * Regenerated samples * Temporarily skip scalaz sample verification, which is having issue with Java version in CI container * Re-enable scalaz in verify samples Co-authored-by: Rob Oxspring <roxspring@imapmail.org>
This commit is contained in:
committed by
William Cheng
parent
daec02b8c5
commit
376e419d0b
@@ -172,6 +172,8 @@ Class | Method | HTTP request | Description
|
||||
- [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [OpenApiPetstore.ArrayTest](docs/ArrayTest.md)
|
||||
- [OpenApiPetstore.BigCat](docs/BigCat.md)
|
||||
- [OpenApiPetstore.BigCatAllOf](docs/BigCatAllOf.md)
|
||||
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
|
||||
- [OpenApiPetstore.Cat](docs/Cat.md)
|
||||
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# OpenApiPetstore.BigCat
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**kind** | **String** | | [optional]
|
||||
|
||||
|
||||
|
||||
## Enum: KindEnum
|
||||
|
||||
|
||||
* `lions` (value: `"lions"`)
|
||||
|
||||
* `tigers` (value: `"tigers"`)
|
||||
|
||||
* `leopards` (value: `"leopards"`)
|
||||
|
||||
* `jaguars` (value: `"jaguars"`)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# OpenApiPetstore.BigCatAllOf
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**kind** | **String** | | [optional]
|
||||
|
||||
|
||||
|
||||
## Enum: KindEnum
|
||||
|
||||
|
||||
* `lions` (value: `"lions"`)
|
||||
|
||||
* `tigers` (value: `"tigers"`)
|
||||
|
||||
* `leopards` (value: `"leopards"`)
|
||||
|
||||
* `jaguars` (value: `"jaguars"`)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ import ApiResponse from './model/ApiResponse';
|
||||
import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly';
|
||||
import ArrayOfNumberOnly from './model/ArrayOfNumberOnly';
|
||||
import ArrayTest from './model/ArrayTest';
|
||||
import BigCat from './model/BigCat';
|
||||
import BigCatAllOf from './model/BigCatAllOf';
|
||||
import Capitalization from './model/Capitalization';
|
||||
import Cat from './model/Cat';
|
||||
import CatAllOf from './model/CatAllOf';
|
||||
@@ -183,6 +185,18 @@ export {
|
||||
*/
|
||||
ArrayTest,
|
||||
|
||||
/**
|
||||
* The BigCat model constructor.
|
||||
* @property {module:model/BigCat}
|
||||
*/
|
||||
BigCat,
|
||||
|
||||
/**
|
||||
* The BigCatAllOf model constructor.
|
||||
* @property {module:model/BigCatAllOf}
|
||||
*/
|
||||
BigCatAllOf,
|
||||
|
||||
/**
|
||||
* The Capitalization model constructor.
|
||||
* @property {module:model/Capitalization}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* 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 BigCatAllOf from './BigCatAllOf';
|
||||
import Cat from './Cat';
|
||||
|
||||
/**
|
||||
* The BigCat model module.
|
||||
* @module model/BigCat
|
||||
* @version 1.0.0
|
||||
*/
|
||||
class BigCat {
|
||||
/**
|
||||
* Constructs a new <code>BigCat</code>.
|
||||
* @alias module:model/BigCat
|
||||
* @extends module:model/Cat
|
||||
* @implements module:model/Cat
|
||||
* @implements module:model/BigCatAllOf
|
||||
* @param className {String}
|
||||
*/
|
||||
constructor(className) {
|
||||
Cat.initialize(this, className);BigCatAllOf.initialize(this);
|
||||
BigCat.initialize(this, className);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, className) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>BigCat</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/BigCat} obj Optional instance to populate.
|
||||
* @return {module:model/BigCat} The populated <code>BigCat</code> instance.
|
||||
*/
|
||||
static constructFromObject(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new BigCat();
|
||||
Cat.constructFromObject(data, obj);
|
||||
Cat.constructFromObject(data, obj);
|
||||
BigCatAllOf.constructFromObject(data, obj);
|
||||
|
||||
if (data.hasOwnProperty('kind')) {
|
||||
obj['kind'] = ApiClient.convertToType(data['kind'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {module:model/BigCat.KindEnum} kind
|
||||
*/
|
||||
BigCat.prototype['kind'] = undefined;
|
||||
|
||||
|
||||
// Implement Cat interface:
|
||||
/**
|
||||
* @member {String} className
|
||||
*/
|
||||
Cat.prototype['className'] = undefined;
|
||||
/**
|
||||
* @member {String} color
|
||||
* @default 'red'
|
||||
*/
|
||||
Cat.prototype['color'] = 'red';
|
||||
/**
|
||||
* @member {Boolean} declawed
|
||||
*/
|
||||
Cat.prototype['declawed'] = undefined;
|
||||
// Implement BigCatAllOf interface:
|
||||
/**
|
||||
* @member {module:model/BigCatAllOf.KindEnum} kind
|
||||
*/
|
||||
BigCatAllOf.prototype['kind'] = undefined;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allowed values for the <code>kind</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
BigCat['KindEnum'] = {
|
||||
|
||||
/**
|
||||
* value: "lions"
|
||||
* @const
|
||||
*/
|
||||
"lions": "lions",
|
||||
|
||||
/**
|
||||
* value: "tigers"
|
||||
* @const
|
||||
*/
|
||||
"tigers": "tigers",
|
||||
|
||||
/**
|
||||
* value: "leopards"
|
||||
* @const
|
||||
*/
|
||||
"leopards": "leopards",
|
||||
|
||||
/**
|
||||
* value: "jaguars"
|
||||
* @const
|
||||
*/
|
||||
"jaguars": "jaguars"
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default BigCat;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* 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';
|
||||
|
||||
/**
|
||||
* The BigCatAllOf model module.
|
||||
* @module model/BigCatAllOf
|
||||
* @version 1.0.0
|
||||
*/
|
||||
class BigCatAllOf {
|
||||
/**
|
||||
* Constructs a new <code>BigCatAllOf</code>.
|
||||
* @alias module:model/BigCatAllOf
|
||||
*/
|
||||
constructor() {
|
||||
|
||||
BigCatAllOf.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>BigCatAllOf</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/BigCatAllOf} obj Optional instance to populate.
|
||||
* @return {module:model/BigCatAllOf} The populated <code>BigCatAllOf</code> instance.
|
||||
*/
|
||||
static constructFromObject(data, obj) {
|
||||
if (data) {
|
||||
obj = obj || new BigCatAllOf();
|
||||
|
||||
if (data.hasOwnProperty('kind')) {
|
||||
obj['kind'] = ApiClient.convertToType(data['kind'], 'String');
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @member {module:model/BigCatAllOf.KindEnum} kind
|
||||
*/
|
||||
BigCatAllOf.prototype['kind'] = undefined;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allowed values for the <code>kind</code> property.
|
||||
* @enum {String}
|
||||
* @readonly
|
||||
*/
|
||||
BigCatAllOf['KindEnum'] = {
|
||||
|
||||
/**
|
||||
* value: "lions"
|
||||
* @const
|
||||
*/
|
||||
"lions": "lions",
|
||||
|
||||
/**
|
||||
* value: "tigers"
|
||||
* @const
|
||||
*/
|
||||
"tigers": "tigers",
|
||||
|
||||
/**
|
||||
* value: "leopards"
|
||||
* @const
|
||||
*/
|
||||
"leopards": "leopards",
|
||||
|
||||
/**
|
||||
* value: "jaguars"
|
||||
* @const
|
||||
*/
|
||||
"jaguars": "jaguars"
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default BigCatAllOf;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', process.cwd()+'/src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require(process.cwd()+'/src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.OpenApiPetstore);
|
||||
}
|
||||
}(this, function(expect, OpenApiPetstore) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
instance = new OpenApiPetstore.BigCat();
|
||||
});
|
||||
|
||||
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('BigCat', function() {
|
||||
it('should create an instance of BigCat', function() {
|
||||
// uncomment below and update the code to test BigCat
|
||||
//var instane = new OpenApiPetstore.BigCat();
|
||||
//expect(instance).to.be.a(OpenApiPetstore.BigCat);
|
||||
});
|
||||
|
||||
it('should have the property kind (base name: "kind")', function() {
|
||||
// uncomment below and update the code to test the property kind
|
||||
//var instane = new OpenApiPetstore.BigCat();
|
||||
//expect(instance).to.be();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD.
|
||||
define(['expect.js', process.cwd()+'/src/index'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports, like Node.
|
||||
factory(require('expect.js'), require(process.cwd()+'/src/index'));
|
||||
} else {
|
||||
// Browser globals (root is window)
|
||||
factory(root.expect, root.OpenApiPetstore);
|
||||
}
|
||||
}(this, function(expect, OpenApiPetstore) {
|
||||
'use strict';
|
||||
|
||||
var instance;
|
||||
|
||||
beforeEach(function() {
|
||||
instance = new OpenApiPetstore.BigCatAllOf();
|
||||
});
|
||||
|
||||
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('BigCatAllOf', function() {
|
||||
it('should create an instance of BigCatAllOf', function() {
|
||||
// uncomment below and update the code to test BigCatAllOf
|
||||
//var instane = new OpenApiPetstore.BigCatAllOf();
|
||||
//expect(instance).to.be.a(OpenApiPetstore.BigCatAllOf);
|
||||
});
|
||||
|
||||
it('should have the property kind (base name: "kind")', function() {
|
||||
// uncomment below and update the code to test the property kind
|
||||
//var instane = new OpenApiPetstore.BigCatAllOf();
|
||||
//expect(instance).to.be();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}));
|
||||
Reference in New Issue
Block a user