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

`Bundle` writes `components.pathItems` into OpenAPI 3.0 documents

Đã đóng Phù hợp với người mới
#284 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Một pull request liên quan đã được merge.

  • #286 của @TristanSpeakEasy — đã merge

Đánh giá

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

Hướng nghiên cứu

Bắt đầu với openapi/bundle.go, nơi bundleObject gửi các mục đường dẫn được tham chiếu đến bundleGenericReference với tên thành phần pathItems. Kiểm tra cách mã bundle xác định phiên bản OpenAPI và tìm các bài kiểm thử bundle hiện có bao phủ các mục đường dẫn được tham chiếu. Với OpenAPI 3.0, mục đường dẫn phải xuất hiện trực tiếp bên dưới paths; xác nhận tài liệu được bundle không còn thêm components.pathItems.

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

Mô tả

Summary

For an OpenAPI 3.0 document, openapi.Bundle (and openapi spec bundle) moves a path item that lives in another file into components.pathItems. That field was added in 3.1: the 3.0 Components Object has no pathItems (its fixed fields are schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links and callbacks), so the bundled document is no longer valid 3.0.

Reproduction

openapi.yaml:

openapi: 3.0.3
info: {title: t, version: "1"}
paths:
  /items:
    $ref: ./paths/items.yaml

paths/items.yaml:

get:
  responses:
    "200":
      description: ok
$ openapi spec bundle openapi.yaml
openapi: 3.0.3
info: {title: t, version: "1"}
paths:
  /items:
    $ref: '#/components/pathItems/items'
components:
  pathItems:
    items:
      get:
        responses:
          "200":
            description: ok

Expected result

A valid 3.0 document: with nowhere in 3.0 components to hold it, the path item written inline under paths./items. redocly bundle does this for the same input.

Actual result

components.pathItems in a 3.0.3 document. vacuum's oas3-schema rule rejects it (schema invalid: `/components` additional properties not allowed: `[pathItems]` ), while openapi spec validate reports it valid.

Version

v1.26.0 (also main, d269643). CLI from go install github.com/speakeasy-api/openapi/cmd/openapi@latest (v0.0.0-20261016011534-d2696438ec74).

Cause

bundleObject sends every ReferencedPathItem to bundleGenericReference(..., "pathItems") (openapi/bundle.go:199) whatever the document's openapi version.

Ngôn ngữ chính
Go
Star
276
Fork
21
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
23

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 tương tự

Thêm issue về Go

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.