[Inline model resolver] better handling of inline responses and bug fixes (#12353)

* better handling of inline response schemas, bug fixes

* update samples

* add new files

* better code format

* remove unused ruby files

* fix java test

* remove unused js spec files

* remove inline_response_default_test.dart

* fix webclient tests

* fix spring tests
This commit is contained in:
William Cheng
2022-05-13 10:17:59 +08:00
committed by GitHub
parent 2cf3d3805f
commit 12cdacabbf
284 changed files with 7620 additions and 1220 deletions

View File

@@ -28,10 +28,10 @@ docs/FakeClassnameTags123Api.md
docs/File.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FooGetDefaultResponse.md
docs/FormatTest.md
docs/HasOnlyReadOnly.md
docs/HealthCheckResult.md
docs/InlineResponseDefault.md
docs/List.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -93,10 +93,10 @@ petstore_api/models/enum_test.py
petstore_api/models/file.py
petstore_api/models/file_schema_test_class.py
petstore_api/models/foo.py
petstore_api/models/foo_get_default_response.py
petstore_api/models/format_test.py
petstore_api/models/has_only_read_only.py
petstore_api/models/health_check_result.py
petstore_api/models/inline_response_default.py
petstore_api/models/list.py
petstore_api/models/map_test.py
petstore_api/models/mixed_properties_and_additional_properties_class.py

View File

@@ -148,10 +148,10 @@ Class | Method | HTTP request | Description
- [File](docs/File.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Foo](docs/Foo.md)
- [FooGetDefaultResponse](docs/FooGetDefaultResponse.md)
- [FormatTest](docs/FormatTest.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [HealthCheckResult](docs/HealthCheckResult.md)
- [InlineResponseDefault](docs/InlineResponseDefault.md)
- [List](docs/List.md)
- [MapTest](docs/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)

View File

@@ -8,7 +8,7 @@ Method | HTTP request | Description
# **foo_get**
> InlineResponseDefault foo_get()
> FooGetDefaultResponse foo_get()
@@ -44,7 +44,7 @@ This endpoint does not need any parameter.
### Return type
[**InlineResponseDefault**](InlineResponseDefault.md)
[**FooGetDefaultResponse**](FooGetDefaultResponse.md)
### Authorization

View File

@@ -0,0 +1,11 @@
# FooGetDefaultResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string** | [**Foo**](Foo.md) | | [optional]
[[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

@@ -57,10 +57,10 @@ from petstore_api.models.enum_test import EnumTest
from petstore_api.models.file import File
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
from petstore_api.models.foo import Foo
from petstore_api.models.foo_get_default_response import FooGetDefaultResponse
from petstore_api.models.format_test import FormatTest
from petstore_api.models.has_only_read_only import HasOnlyReadOnly
from petstore_api.models.health_check_result import HealthCheckResult
from petstore_api.models.inline_response_default import InlineResponseDefault
from petstore_api.models.list import List
from petstore_api.models.map_test import MapTest
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass

View File

@@ -58,7 +58,7 @@ class DefaultApi(object):
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: InlineResponseDefault
:rtype: FooGetDefaultResponse
"""
kwargs['_return_http_data_only'] = True
return self.foo_get_with_http_info(**kwargs) # noqa: E501
@@ -93,7 +93,7 @@ class DefaultApi(object):
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(InlineResponseDefault, status_code(int), headers(HTTPHeaderDict))
:rtype: tuple(FooGetDefaultResponse, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()

View File

@@ -36,10 +36,10 @@ from petstore_api.models.enum_test import EnumTest
from petstore_api.models.file import File
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
from petstore_api.models.foo import Foo
from petstore_api.models.foo_get_default_response import FooGetDefaultResponse
from petstore_api.models.format_test import FormatTest
from petstore_api.models.has_only_read_only import HasOnlyReadOnly
from petstore_api.models.health_check_result import HealthCheckResult
from petstore_api.models.inline_response_default import InlineResponseDefault
from petstore_api.models.list import List
from petstore_api.models.map_test import MapTest
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass

View File

@@ -0,0 +1,131 @@
# 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
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getfullargspec
import pprint
import re # noqa: F401
import six
from petstore_api.configuration import Configuration
class FooGetDefaultResponse(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'string': 'Foo'
}
attribute_map = {
'string': 'string'
}
def __init__(self, string=None, local_vars_configuration=None): # noqa: E501
"""FooGetDefaultResponse - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_configuration
self._string = None
self.discriminator = None
if string is not None:
self.string = string
@property
def string(self):
"""Gets the string of this FooGetDefaultResponse. # noqa: E501
:return: The string of this FooGetDefaultResponse. # noqa: E501
:rtype: Foo
"""
return self._string
@string.setter
def string(self, string):
"""Sets the string of this FooGetDefaultResponse.
:param string: The string of this FooGetDefaultResponse. # noqa: E501
:type string: Foo
"""
self._string = string
def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = getfullargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
else:
return x.to_dict(serialize)
else:
return x
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
attr = self.attribute_map.get(attr, attr) if serialize else attr
if isinstance(value, list):
result[attr] = list(map(
lambda x: convert(x),
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], convert(item[1])),
value.items()
))
else:
result[attr] = convert(value)
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, FooGetDefaultResponse):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, FooGetDefaultResponse):
return True
return self.to_dict() != other.to_dict()

View File

@@ -0,0 +1,52 @@
# 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.foo_get_default_response import FooGetDefaultResponse # noqa: E501
from petstore_api.rest import ApiException
class TestFooGetDefaultResponse(unittest.TestCase):
"""FooGetDefaultResponse unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test FooGetDefaultResponse
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.foo_get_default_response.FooGetDefaultResponse() # noqa: E501
if include_optional :
return FooGetDefaultResponse(
string = petstore_api.models.foo.Foo(
bar = 'bar', )
)
else :
return FooGetDefaultResponse(
)
def testFooGetDefaultResponse(self):
"""Test FooGetDefaultResponse"""
inst_req_only = self.make_instance(include_optional=False)
inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()