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

[Question] [Bug]: Inconsistent Relative Reference Resolution in Nested Schema Contexts

Đang mở
#2,256 1 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với ngữ cảnh tái hiện trong OpenAPITools/openapi-generator#21492 và kiểm tra cách parentDirectory được xử lý khi phân giải các giá trị $ref tương đối thông qua các schema additionalProperties lồng nhau. Xác minh hành vi theo quy tắc tương đối theo tệp của OpenAPI 3.0, bao gồm cả các tham chiếu path-file và schema-file; được xem là hoàn tất khi các tham chiếu lồng nhau được phân giải nhất quán mà không xảy ra lỗi build.

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

Mô tả

Question

Question

There seems to be a bug when resolving nested schemas.

OpenAPI Generator incorrectly resolves relative $ref paths in schema files when they are referenced through nested contexts (like additionalProperties). The reference resolution context switches from file-relative to root-relative depending on the nesting level, causing build failures when using standard file-relative references.

This creates inconsistent behavior where:

References from path files work correctly using file-relative paths (../components/schemas/...)
References from schema files fail when using file-relative paths (NestedData.yaml)

This violates the OpenAPI 3.0 specification where all relative references should be resolved from the containing file's location.

Any ideas? parentDirectory seems to be resolved wrongly in this case?

Affected Version

Latest

Context

This issue first reported here: https://github.com/OpenAPITools/openapi-generator/issues/21492 (the project uses this library)

# Example OpenAPI or Swagger definition (optional)

Additional Details

Checklist

  • I have searched the existing issues and documentation before asking.
  • I have provided enough information for others to understand my question.
Ngôn ngữ chính
Java
Star
868
Fork
560
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.