Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug]: 2.1.48 2xx response written as $ref: '#/components/responses/X' generates void.

Đang mở
#2,408 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

Start by locating how swagger-parser resolves $ref values under components/responses and how the resolved response schema reaches generated return types; the payload names no source files or tests. Compare parsing the referenced 202 response with the inline response schema shown in the report. Done means the referenced response retains its typed return value instead of producing void.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug

Description

2xx responses written as $ref: '#/components/responses/X' generate void / ApiResponse<Void>.

Affected Version

2.1.48

Steps to Reproduce

      responses:
	        202:
	          $ref: '#/components/responses/RequestAcceptedResponse'

generates

    /**
     * Does a thing
     * @param thing ID
     * @throws ApiException If API call fails
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 202 </td><td>  </td><td>  -  </td></tr>
        <tr><td> 0 </td><td>  </td><td>  -  </td></tr>
     </table>
     */
    public void doAThing(String thingID) throws ApiException {
        doAThingWithHttpInfo(thingID);
    }
      responses:
	        202:
	          description: Request accepted. Confirmation of success/failure of request to be sent asynchronously via SNS.
	          content:
	            application/json:
	              schema:
	                $ref: '#/components/schemas/responseBody'

generates the expected response type.

Expected Behavior

parsing should not cause typed object references to generate void returns in client code

Actual Behavior

typed object references in the swagger schema generate void returns in client code

Environment

  • Java version: JDK 17
  • Build tool: Gradle 7.x, 8.x
  • OS: AmazonLinux2 x86_64

Additional Context

NA

Checklist

I've searched, but don't often work with swagger and don't have full visibility into the build toolchain being run.
If this smells like a duplicate to the maintainers, please feel free to resolve.

  • I have provided sufficient information for maintainers to reproduce the issue.
    As above, made my best effort in the time available.
Ngôn ngữ chính
Java
Star
870
Fork
565
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của swagger-api/swagger-parser

Tất cả issue của swagger-api/swagger-parser

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.