mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
[python] fixes bugs (#13581)
* Adds bug fixes * Samples and docs regenerated * Samples regenerated
This commit is contained in:
@@ -140,7 +140,7 @@ Please follow the [installation procedure](#installation--usage) and then run th
|
||||
import time
|
||||
import dynamic_servers
|
||||
from pprint import pprint
|
||||
from dynamic_servers.apis import usage_api
|
||||
from dynamic_servers.apis.tags import usage_api
|
||||
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = dynamic_servers.Configuration(
|
||||
|
||||
@@ -1048,7 +1048,7 @@ class ApiClient:
|
||||
) -> urllib3.HTTPResponse:
|
||||
|
||||
# header parameters
|
||||
headers = headers or {}
|
||||
headers = headers or HTTPHeaderDict()
|
||||
headers.update(self.default_headers)
|
||||
if self.cookie:
|
||||
headers['Cookie'] = self.cookie
|
||||
|
||||
@@ -26,6 +26,24 @@ import frozendict # noqa: F401
|
||||
from dynamic_servers import schemas # noqa: F401
|
||||
|
||||
SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema
|
||||
|
||||
|
||||
@dataclass
|
||||
class ApiResponseFor200(api_client.ApiResponse):
|
||||
response: urllib3.HTTPResponse
|
||||
body: typing.Union[
|
||||
SchemaFor200ResponseBodyApplicationJson,
|
||||
]
|
||||
headers: schemas.Unset = schemas.unset
|
||||
|
||||
|
||||
_response_for_200 = api_client.OpenApiResponse(
|
||||
response_cls=ApiResponseFor200,
|
||||
content={
|
||||
'application/json': api_client.MediaType(
|
||||
schema=SchemaFor200ResponseBodyApplicationJson),
|
||||
},
|
||||
)
|
||||
_all_accept_content_types = (
|
||||
'application/json',
|
||||
)
|
||||
|
||||
@@ -26,6 +26,24 @@ import frozendict # noqa: F401
|
||||
from dynamic_servers import schemas # noqa: F401
|
||||
|
||||
SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema
|
||||
|
||||
|
||||
@dataclass
|
||||
class ApiResponseFor200(api_client.ApiResponse):
|
||||
response: urllib3.HTTPResponse
|
||||
body: typing.Union[
|
||||
SchemaFor200ResponseBodyApplicationJson,
|
||||
]
|
||||
headers: schemas.Unset = schemas.unset
|
||||
|
||||
|
||||
_response_for_200 = api_client.OpenApiResponse(
|
||||
response_cls=ApiResponseFor200,
|
||||
content={
|
||||
'application/json': api_client.MediaType(
|
||||
schema=SchemaFor200ResponseBodyApplicationJson),
|
||||
},
|
||||
)
|
||||
_all_accept_content_types = (
|
||||
'application/json',
|
||||
)
|
||||
|
||||
@@ -1883,6 +1883,7 @@ class ComposedBase(Discriminable):
|
||||
"Invalid inputs given to generate an instance of {}. Multiple "
|
||||
"oneOf schemas {} matched the inputs, but a max of one is allowed.".format(cls, oneof_classes)
|
||||
)
|
||||
# exactly one class matches
|
||||
return path_to_schemas
|
||||
|
||||
@classmethod
|
||||
@@ -1947,7 +1948,9 @@ class ComposedBase(Discriminable):
|
||||
)
|
||||
|
||||
# process composed schema
|
||||
discriminator = getattr(cls, 'discriminator', None)
|
||||
discriminator = None
|
||||
if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'discriminator'):
|
||||
discriminator = cls.MetaOapg.discriminator()
|
||||
discriminated_cls = None
|
||||
if discriminator and arg and isinstance(arg, frozendict.frozendict):
|
||||
disc_property_name = list(discriminator.keys())[0]
|
||||
|
||||
Reference in New Issue
Block a user