`Inline` fails on a recursive schema file shared through a response file: `reference ... not found in analysis phase`
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #288 của @TristanSpeakEasy — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/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
Start by tracing openapi.Inline and the nested reference analysis for external response and schema files; the report does not name implementation or test files. Reproduce with the three operations and recursive Folder.yaml schema, then compare with two operations and a single-file document. Done when the three-operation case inlines successfully for OpenAPI 3.0.3 and 3.1.0, with the recursive reference targeting #/components/schemas/__Folder_yaml.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
openapi.Inline (and openapi spec inline) fails when a self-referencing schema in its own file is reached through a response file that three or more operations reference. With two operations it inlines fine, and so does the same document written in one file.
Reproduction
openapi.yaml:
openapi: 3.0.3
info: {title: t, version: "1"}
paths:
/f1:
get:
responses:
"200": {$ref: ./responses/folder.yaml}
/f2:
get:
responses:
"200": {$ref: ./responses/folder.yaml}
/f3:
get:
responses:
"200": {$ref: ./responses/folder.yaml}
responses/folder.yaml:
description: ok
content: {application/json: {schema: {$ref: ../schemas/Folder.yaml}}}
schemas/Folder.yaml:
properties:
parents:
items: {$ref: ./Folder.yaml}
$ openapi spec inline openapi.yaml
Processing OpenAPI document: openapi.yaml
Error: failed to inline OpenAPI document: failed to inline references: failed to inline nested references in : failed to inline schemas: failed to inline schema: failed to inline schema: reference schemas/Folder.yaml#/components/schemas/__Folder_yaml not found in analysis phase
The library call (openapi.Unmarshal, then openapi.Inline with ResolveOptions{RootDocument: doc, TargetLocation: <absolute path>} and RemoveUnusedComponents: true) returns the same error.
Expected result
The document is inlined, as it is with /f3 removed: each response gets the Folder schema and the recursive ref points at #/components/schemas/__Folder_yaml. The same three operations also inline when they reference ./schemas/Folder.yaml directly, or when the response and the schema are in the root's components (one file).
Actual result
The error above, for openapi: 3.0.3 and 3.1.0 alike, and with four operations too. The reference it can't find, #/components/schemas/__Folder_yaml, is the name the inliner itself gives the recursive schema, here resolved against schemas/Folder.yaml.
Version
v1.26.0 (also main, d269643). CLI from go install github.com/speakeasy-api/openapi/cmd/openapi@latest (v0.0.0-20261016011534-d2696438ec74).
- Ngôn ngữ chính
- Go
- Star
- 276
- Fork
- 21
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 18
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của speakeasy-api/openapi
-
`openapi spec lint --fix` drops node-level fixes and can duplicate pathsCó thể đã có người làm @RaphaelFakhri đã nhận 5 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
speakeasy-api/openapi#280 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của speakeasy-api/openapi
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Project submission: BivyĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
slavakurilyak/awesome-ai-agents#880 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
后缀带有LTX的番号无法自动匹配Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
metatube-community/metatube-sdk-go#387 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/openserverless#282 · 2 bình luận ·