[python] can't handle 'application/json; charset=UTF-8' when spec lacks charset info
Created by: bayeslearner
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output?
Description
openapi-generator version
openapi-generator-cli 6.2.1 commit : b0ce532b built : 2022-11-01T09:40:00Z source : https://github.com/openapitools/openapi-generator docs : https://openapi-generator.tech/
OpenAPI declaration file content or url
https://admin.splunk.com/service/info/specs/v2/openapi.json
Generation Details
openapi-generator generate -g python -o out -i https://admin.splunk.com/service/info/specs/v2/openapi.json --package-name splunkacs --skip-validate-spec
The API call for the following program goes through and in fact fetches the desired json, but the content-type check fails and exception is thrown instead.
Steps to reproduce
import splunkacs
from splunkacs.apis.tags import indexes_api
from splunkacs.model.error import Error
from splunkacs.model.index_response import IndexResponse
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = splunkacs.Configuration(
host = "https://admin.splunk.com"
)
# Configure Bearer authorization (JWT): bearerAuth
configuration.access_token = '<private token>'
# Enter a context with an instance of the API client
with splunkacs.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = indexes_api.IndexesApi(api_client)
# example passing only required values which don't have defaults set
path_params = {
'stack': "michmed",
}
query_params = {
}
try:
api_response = api_instance.list_indexes(
path_params=path_params,
query_params=query_params,
)
pprint(api_response)
except splunkacs.ApiException as e:
print("Exception when calling IndexesApi->list_indexes: %s\n" % e)
The error is as follows,
Traceback (most recent call last):
File ".../splunkacstest/splunk_cloud_acs_test.py", line 33, in <module>
api_response = api_instance.list_indexes(
File "/Users/yyy/.local/lib/python3.10/site-packages/splunkacs-1.0.0-py3.10.egg/splunkacs/paths/stack_adminconfig_v2_indexes/get.py", line 408, in list_indexes
File "/Users/yyy/.local/lib/python3.10/site-packages/splunkacs-1.0.0-py3.10.egg/splunkacs/paths/stack_adminconfig_v2_indexes/get.py", line 342, in _list_indexes_oapg
File "/Users/yyy/.local/lib/python3.10/site-packages/splunkacs-1.0.0-py3.10.egg/splunkacs/api_client.py", line 929, in deserialize
splunkacs.exceptions.ApiValueError: Invalid content_type returned. Content_type='application/json; charset=UTF-8' was returned when only {'application/json'} are defined for status_code=200
Suggest a fix
Not sure whether the spec json is flawed or openapi-generator needs to relax the checking.