always set operation#consumes to application/json (#255)

Signed-off-by: Min Jin <minkimzz@amazon.com>
This commit is contained in:
Min Jin
2023-10-28 10:32:32 -07:00
committed by GitHub
parent 4209a8e4be
commit 7ac2e3d8c0

View File

@@ -129,6 +129,9 @@ def transform_to_csharp_consume_json(operation, _):
if operation.get('consumes', None) == ["*/*",] or operation.get('consumes', None) == "*/*":
operation['consumes'] = ["application/json"]
def transform_to_java_consume_json(operation, _):
operation['consumes'] = ["application/json"]
def strip_tags_from_operation_id(operation, _):
operation_id = operation['operationId']
if 'tags' in operation:
@@ -234,6 +237,10 @@ def process_swagger(spec, client_language, crd_mode=False):
# force to consume json if */*
apply_func_to_spec_operations(spec, transform_to_csharp_consume_json)
if client_language == "java":
# force to consume json, need this change due to https://github.com/OpenAPITools/openapi-generator/pull/10769
apply_func_to_spec_operations(spec, transform_to_java_consume_json)
apply_func_to_spec_operations(spec, strip_delete_collection_operation_watch_params)
apply_func_to_spec_operations(spec, add_codegen_request_body)