Support discriminator for oneOf in OpenApiValidationPlugin

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

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

@waldekmastykarz đang làm issue này rồi.

Từ ngày 31/10/2026.

  • #2042 của @waldekmastykarz — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

work in progress

OpenApiValidationPlugin (#2037) validates oneOf strictly: a body that matches more than one branch is reported. That's correct per spec, but many real-world specs have overlapping oneOf branches and rely on discriminator to pick one, so valid payloads get flagged.

Proposal: when a discriminator is present, select the branch from the discriminator property's value, using mapping (or the implicit schema name if there's no mapping), and validate only that branch. Report a clear error when the discriminator value is missing or unknown.

Depends on #2037.

Ngôn ngữ chính
C#
Star
838
Fork
90
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
59

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 dotnet/dev-proxy

Tất cả issue của dotnet/dev-proxy

Issue tương tự

Thêm issue về C#

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.