Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _process_return_value(self) -> Parameter:
"""Returns a Parameter object representing the return type."""
responses = self._operation.responses or {}
# Default to Any if no 2xx response or if schema is missing
return_schema = Schema(type='Any')
return_schema = Schema(type='object')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change improves type safety by defaulting to object. However, it introduces two issues:

  1. The comment on the preceding line (167) is now outdated as it still refers to Any as the default. It should be updated to object to maintain code clarity.
  2. This change causes multiple tests in tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py to fail (e.g., test_process_return_value_no_2xx, test_process_return_value_no_content, test_process_return_value_no_schema). These tests assert that the default type_hint is 'Any', but with this change, it will become 'Dict[str, Any]'. Please update the tests to reflect the new behavior.


# Take the 20x response with the smallest response code.
valid_codes = list(
Expand Down
Loading