forked from loafle/openapi-generator-original
Better inline model resolver to handle inline schema in array item (#12104)
* better support of inline schema in array item * update tests * update samples * regenerate samples * fix allof naming, remove files * add files * update samples * update readme * fix tests * update samples * update samples * add new files * update test spec * add back tests * remove unused files * comment out python test * update js test using own spec * remove files * remove unused files * remove files * remove unused files * better handling of allOf with a single type * comment out go test * remove test_all_of_with_single_ref_single_ref_type.py * fix inline resolver, uncomment go test
This commit is contained in:
@@ -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.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAllOfWithSingleRef(unittest.TestCase):
|
||||
"""AllOfWithSingleRef unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AllOfWithSingleRef
|
||||
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.all_of_with_single_ref.AllOfWithSingleRef() # noqa: E501
|
||||
if include_optional :
|
||||
return AllOfWithSingleRef(
|
||||
username = '',
|
||||
single_ref_type = None
|
||||
)
|
||||
else :
|
||||
return AllOfWithSingleRef(
|
||||
)
|
||||
|
||||
def testAllOfWithSingleRef(self):
|
||||
"""Test AllOfWithSingleRef"""
|
||||
inst_req_only = self.make_instance(include_optional=False)
|
||||
inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -16,11 +16,11 @@ import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.user_type import UserType # noqa: E501
|
||||
from petstore_api.models.single_ref_type import SingleRefType # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestUserType(unittest.TestCase):
|
||||
"""UserType unit test stubs"""
|
||||
class TestSingleRefType(unittest.TestCase):
|
||||
"""SingleRefType unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
@@ -29,20 +29,20 @@ class TestUserType(unittest.TestCase):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test UserType
|
||||
"""Test SingleRefType
|
||||
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.user_type.UserType() # noqa: E501
|
||||
# model = petstore_api.models.single_ref_type.SingleRefType() # noqa: E501
|
||||
if include_optional :
|
||||
return UserType(
|
||||
return SingleRefType(
|
||||
)
|
||||
else :
|
||||
return UserType(
|
||||
return SingleRefType(
|
||||
)
|
||||
|
||||
def testUserType(self):
|
||||
"""Test UserType"""
|
||||
def testSingleRefType(self):
|
||||
"""Test SingleRefType"""
|
||||
inst_req_only = self.make_instance(include_optional=False)
|
||||
inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
Reference in New Issue
Block a user