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

Ordering of matches when no path is concrete

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

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
openapi
Lĩnh vực
api, documentation

Hướng nghiên cứu

Bắt đầu với phần «Patterned Fields» được liên kết của OpenAPI 3.0.3 và phần thảo luận trong OpenAPI Specification issue #1459. So sánh hướng dẫn của chúng với ví dụ về templated path trong issue này và xác định xem có tồn tại quy tắc sắp xếp mang tính chuẩn tắc hay không. Được coi là hoàn tất khi sự mơ hồ được giải quyết bằng một quy tắc được ghi rõ trong tài liệu hoặc một tuyên bố rõ ràng rằng đặc tả không định nghĩa quy tắc đó.

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

Mô tả

clarification request matching

I'm a contributor for an OpenAPI Validator project, and one of our users has raised an issue that their the spec is not matching in the order they would expect (you can see the issue here).

The issue effectively boils down to the user expecting a path with just one templated segment to be matched over a path with more than one templated segment, i.e.:

/{id1}/{id2}/{id3}
/resource/{id}/new <- Expect this one to be picked

With a request path like: /resource/1/new.

Currently we are matching simply based on the order of the paths as defined by the user in their specification file (which is probably not the correct approach). My question is whether it is specified anywhere how to resolve/match multiple templated matches?

Looking at the relevant part of the OpenAPI3 spec, while it discusses preferring a concrete path over a path which uses templates, from the spec I couldn't see how paths would be chosen if both match the request, and both use templates in the path. Since the examples in the spec are fairly short, I wasn't sure if the above example would fall into the ambiguous category or not.

I did manage to find a discussion in your issues here which hints at the fact most people would match a path with more concrete segments, over one with less. Since we are a validation tool, I would prefer to be able to apply concrete rules.

Do you have any advice/further reading on matching paths like the above example?

Ngôn ngữ chính
Markdown
Star
31.2k
Fork
9.2k
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
17

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 OAI/OpenAPI-Specification

Tất cả issue của OAI/OpenAPI-Specification

Issue tương tự

Thêm issue về Backend & API Design

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.