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

@@ -16,7 +16,6 @@ docs/ArrayTest.md
docs/BasquePig.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/CircularReferenceModel.md
docs/ClassModel.md
@@ -26,7 +25,6 @@ docs/DanishPig.md
docs/DefaultApi.md
docs/DeprecatedObject.md
docs/Dog.md
docs/DogAllOf.md
docs/DummyModel.md
docs/EnumArrays.md
docs/EnumClass.md
@@ -107,7 +105,6 @@ petstore_api/models/array_test.py
petstore_api/models/basque_pig.py
petstore_api/models/capitalization.py
petstore_api/models/cat.py
petstore_api/models/cat_all_of.py
petstore_api/models/category.py
petstore_api/models/circular_reference_model.py
petstore_api/models/class_model.py
@@ -116,7 +113,6 @@ petstore_api/models/color.py
petstore_api/models/danish_pig.py
petstore_api/models/deprecated_object.py
petstore_api/models/dog.py
petstore_api/models/dog_all_of.py
petstore_api/models/dummy_model.py
petstore_api/models/enum_arrays.py
petstore_api/models/enum_class.py

View File

@@ -144,7 +144,6 @@ Class | Method | HTTP request | Description
- [BasquePig](docs/BasquePig.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [CatAllOf](docs/CatAllOf.md)
- [Category](docs/Category.md)
- [CircularReferenceModel](docs/CircularReferenceModel.md)
- [ClassModel](docs/ClassModel.md)
@@ -153,7 +152,6 @@ Class | Method | HTTP request | Description
- [DanishPig](docs/DanishPig.md)
- [DeprecatedObject](docs/DeprecatedObject.md)
- [Dog](docs/Dog.md)
- [DogAllOf](docs/DogAllOf.md)
- [DummyModel](docs/DummyModel.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)

View File

@@ -1,28 +0,0 @@
# CatAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [optional]
## Example
```python
from petstore_api.models.cat_all_of import CatAllOf
# TODO update the JSON string below
json = "{}"
# create an instance of CatAllOf from a JSON string
cat_all_of_instance = CatAllOf.from_json(json)
# print the JSON string representation of the object
print CatAllOf.to_json()
# convert the object into a dict
cat_all_of_dict = cat_all_of_instance.to_dict()
# create an instance of CatAllOf from a dict
cat_all_of_form_dict = cat_all_of.from_dict(cat_all_of_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,28 +0,0 @@
# DogAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **str** | | [optional]
## Example
```python
from petstore_api.models.dog_all_of import DogAllOf
# TODO update the JSON string below
json = "{}"
# create an instance of DogAllOf from a JSON string
dog_all_of_instance = DogAllOf.from_json(json)
# print the JSON string representation of the object
print DogAllOf.to_json()
# convert the object into a dict
dog_all_of_dict = dog_all_of_instance.to_dict()
# create an instance of DogAllOf from a dict
dog_all_of_form_dict = dog_all_of.from_dict(dog_all_of_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -50,7 +50,6 @@ from petstore_api.models.array_test import ArrayTest
from petstore_api.models.basque_pig import BasquePig
from petstore_api.models.capitalization import Capitalization
from petstore_api.models.cat import Cat
from petstore_api.models.cat_all_of import CatAllOf
from petstore_api.models.category import Category
from petstore_api.models.circular_reference_model import CircularReferenceModel
from petstore_api.models.class_model import ClassModel
@@ -59,7 +58,6 @@ from petstore_api.models.color import Color
from petstore_api.models.danish_pig import DanishPig
from petstore_api.models.deprecated_object import DeprecatedObject
from petstore_api.models.dog import Dog
from petstore_api.models.dog_all_of import DogAllOf
from petstore_api.models.dummy_model import DummyModel
from petstore_api.models.enum_arrays import EnumArrays
from petstore_api.models.enum_class import EnumClass

View File

@@ -26,7 +26,6 @@ from petstore_api.models.array_test import ArrayTest
from petstore_api.models.basque_pig import BasquePig
from petstore_api.models.capitalization import Capitalization
from petstore_api.models.cat import Cat
from petstore_api.models.cat_all_of import CatAllOf
from petstore_api.models.category import Category
from petstore_api.models.circular_reference_model import CircularReferenceModel
from petstore_api.models.class_model import ClassModel
@@ -35,7 +34,6 @@ from petstore_api.models.color import Color
from petstore_api.models.danish_pig import DanishPig
from petstore_api.models.deprecated_object import DeprecatedObject
from petstore_api.models.dog import Dog
from petstore_api.models.dog_all_of import DogAllOf
from petstore_api.models.dummy_model import DummyModel
from petstore_api.models.enum_arrays import EnumArrays
from petstore_api.models.enum_class import EnumClass

View File

@@ -1,82 +0,0 @@
# coding: utf-8
"""
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: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from typing import Optional
from pydantic import BaseModel, StrictBool
class CatAllOf(BaseModel):
"""
CatAllOf
"""
declawed: Optional[StrictBool] = None
additional_properties: Dict[str, Any] = {}
__properties = ["declawed"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> CatAllOf:
"""Create an instance of CatAllOf from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
"additional_properties"
},
exclude_none=True)
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value
return _dict
@classmethod
def from_dict(cls, obj: dict) -> CatAllOf:
"""Create an instance of CatAllOf from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return CatAllOf.parse_obj(obj)
_obj = CatAllOf.parse_obj({
"declawed": obj.get("declawed")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj

View File

@@ -1,82 +0,0 @@
# coding: utf-8
"""
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: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from typing import Optional
from pydantic import BaseModel, StrictStr
class DogAllOf(BaseModel):
"""
DogAllOf
"""
breed: Optional[StrictStr] = None
additional_properties: Dict[str, Any] = {}
__properties = ["breed"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> DogAllOf:
"""Create an instance of DogAllOf from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
"additional_properties"
},
exclude_none=True)
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value
return _dict
@classmethod
def from_dict(cls, obj: dict) -> DogAllOf:
"""Create an instance of DogAllOf from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return DogAllOf.parse_obj(obj)
_obj = DogAllOf.parse_obj({
"breed": obj.get("breed")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)
return _obj

View File

@@ -1,51 +0,0 @@
# coding: utf-8
"""
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: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import petstore_api
from petstore_api.models.cat_all_of import CatAllOf # noqa: E501
from petstore_api.rest import ApiException
class TestCatAllOf(unittest.TestCase):
"""CatAllOf unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test CatAllOf
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = petstore_api.models.cat_all_of.CatAllOf() # noqa: E501
if include_optional :
return CatAllOf(
declawed = True
)
else :
return CatAllOf(
)
def testCatAllOf(self):
"""Test CatAllOf"""
inst_req_only = self.make_instance(include_optional=False)
inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,51 +0,0 @@
# coding: utf-8
"""
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: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import petstore_api
from petstore_api.models.dog_all_of import DogAllOf # noqa: E501
from petstore_api.rest import ApiException
class TestDogAllOf(unittest.TestCase):
"""DogAllOf unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test DogAllOf
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = petstore_api.models.dog_all_of.DogAllOf() # noqa: E501
if include_optional :
return DogAllOf(
breed = ''
)
else :
return DogAllOf(
)
def testDogAllOf(self):
"""Test DogAllOf"""
inst_req_only = self.make_instance(include_optional=False)
inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()