Better handling of Inline schema (#15682)

* skip allOf inline subschema created as $ref

* add option for fallback

* add back atleastonemodel

* add log

* update java, kotlin, js samples

* update tests

* fix native client test

* fix java client errors by regenerating test files

* clean up python

* clean up powershell

* clean up php

* clean up ruby

* update erlang, elixir

* update dart samples

* update ts samples

* update r, go samples

* update perl

* update swift

* add back files

* add back files

* remove outdated test files

* fix test
This commit is contained in:
William Cheng
2023-06-11 15:35:58 +08:00
committed by GitHub
parent 21748e024a
commit 6788f43af0
1026 changed files with 1185 additions and 50712 deletions

View File

@@ -12,7 +12,6 @@ docs/ArrayTest.md
docs/BasquePig.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ClassModel.md
docs/Client.md
@@ -21,7 +20,6 @@ docs/DanishPig.md
docs/DefaultApi.md
docs/DeprecatedObject.md
docs/Dog.md
docs/DogAllOf.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
@@ -83,7 +81,6 @@ src/model/ArrayTest.js
src/model/BasquePig.js
src/model/Capitalization.js
src/model/Cat.js
src/model/CatAllOf.js
src/model/Category.js
src/model/ClassModel.js
src/model/Client.js
@@ -91,7 +88,6 @@ src/model/Color.js
src/model/DanishPig.js
src/model/DeprecatedObject.js
src/model/Dog.js
src/model/DogAllOf.js
src/model/EnumArrays.js
src/model/EnumClass.js
src/model/EnumTest.js

View File

@@ -172,7 +172,6 @@ Class | Method | HTTP request | Description
- [OpenApiPetstore.BasquePig](docs/BasquePig.md)
- [OpenApiPetstore.Capitalization](docs/Capitalization.md)
- [OpenApiPetstore.Cat](docs/Cat.md)
- [OpenApiPetstore.CatAllOf](docs/CatAllOf.md)
- [OpenApiPetstore.Category](docs/Category.md)
- [OpenApiPetstore.ClassModel](docs/ClassModel.md)
- [OpenApiPetstore.Client](docs/Client.md)
@@ -180,7 +179,6 @@ Class | Method | HTTP request | Description
- [OpenApiPetstore.DanishPig](docs/DanishPig.md)
- [OpenApiPetstore.DeprecatedObject](docs/DeprecatedObject.md)
- [OpenApiPetstore.Dog](docs/Dog.md)
- [OpenApiPetstore.DogAllOf](docs/DogAllOf.md)
- [OpenApiPetstore.EnumArrays](docs/EnumArrays.md)
- [OpenApiPetstore.EnumClass](docs/EnumClass.md)
- [OpenApiPetstore.EnumTest](docs/EnumTest.md)

View File

@@ -1,9 +0,0 @@
# OpenApiPetstore.CatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **Boolean** | | [optional]

View File

@@ -1,9 +0,0 @@
# OpenApiPetstore.DogAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **String** | | [optional]

View File

@@ -22,7 +22,6 @@ import ArrayTest from './model/ArrayTest';
import BasquePig from './model/BasquePig';
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';
@@ -30,7 +29,6 @@ import Color from './model/Color';
import DanishPig from './model/DanishPig';
import DeprecatedObject from './model/DeprecatedObject';
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';
@@ -167,12 +165,6 @@ export {
*/
Cat,
/**
* The CatAllOf model constructor.
* @property {module:model/CatAllOf}
*/
CatAllOf,
/**
* The Category model constructor.
* @property {module:model/Category}
@@ -215,12 +207,6 @@ export {
*/
Dog,
/**
* The DogAllOf model constructor.
* @property {module:model/DogAllOf}
*/
DogAllOf,
/**
* The EnumArrays model constructor.
* @property {module:model/EnumArrays}

View File

@@ -13,7 +13,6 @@
import ApiClient from '../ApiClient';
import Animal from './Animal';
import CatAllOf from './CatAllOf';
/**
* The Cat model module.
@@ -26,11 +25,10 @@ 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);CatAllOf.initialize(this);
Animal.initialize(this, className);
Cat.initialize(this, className);
}
@@ -54,7 +52,6 @@ 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');
@@ -100,11 +97,6 @@ Animal.prototype['className'] = undefined;
* @default 'red'
*/
Animal.prototype['color'] = 'red';
// Implement CatAllOf interface:
/**
* @member {Boolean} declawed
*/
CatAllOf.prototype['declawed'] = undefined;

View File

@@ -1,83 +0,0 @@
/**
* 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 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;
}
/**
* Validates the JSON data with respect to <code>CatAllOf</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>CatAllOf</code>.
*/
static validateJSON(data) {
return true;
}
}
/**
* @member {Boolean} declawed
*/
CatAllOf.prototype['declawed'] = undefined;
export default CatAllOf;

View File

@@ -13,7 +13,6 @@
import ApiClient from '../ApiClient';
import Animal from './Animal';
import DogAllOf from './DogAllOf';
/**
* The Dog model module.
@@ -26,11 +25,10 @@ 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);DogAllOf.initialize(this);
Animal.initialize(this, className);
Dog.initialize(this, className);
}
@@ -54,7 +52,6 @@ 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');
@@ -104,11 +101,6 @@ Animal.prototype['className'] = undefined;
* @default 'red'
*/
Animal.prototype['color'] = 'red';
// Implement DogAllOf interface:
/**
* @member {String} breed
*/
DogAllOf.prototype['breed'] = undefined;

View File

@@ -1,87 +0,0 @@
/**
* 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 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;
}
/**
* Validates the JSON data with respect to <code>DogAllOf</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>DogAllOf</code>.
*/
static validateJSON(data) {
// ensure the json data is a string
if (data['breed'] && !(typeof data['breed'] === 'string' || data['breed'] instanceof String)) {
throw new Error("Expected the field `breed` to be a primitive type in the JSON string but got " + data['breed']);
}
return true;
}
}
/**
* @member {String} breed
*/
DogAllOf.prototype['breed'] = undefined;
export default DogAllOf;

View File

@@ -1,65 +0,0 @@
/**
* 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.CatAllOf();
});
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('CatAllOf', function() {
it('should create an instance of CatAllOf', function() {
// uncomment below and update the code to test CatAllOf
//var instance = new OpenApiPetstore.CatAllOf();
//expect(instance).to.be.a(OpenApiPetstore.CatAllOf);
});
it('should have the property declawed (base name: "declawed")', function() {
// uncomment below and update the code to test the property declawed
//var instance = new OpenApiPetstore.CatAllOf();
//expect(instance).to.be();
});
});
}));

View File

@@ -1,65 +0,0 @@
/**
* 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.DogAllOf();
});
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('DogAllOf', function() {
it('should create an instance of DogAllOf', function() {
// uncomment below and update the code to test DogAllOf
//var instance = new OpenApiPetstore.DogAllOf();
//expect(instance).to.be.a(OpenApiPetstore.DogAllOf);
});
it('should have the property breed (base name: "breed")', function() {
// uncomment below and update the code to test the property breed
//var instance = new OpenApiPetstore.DogAllOf();
//expect(instance).to.be();
});
});
}));