Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always set operation#consumes to application/json #255

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions openapi/preprocess_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down