Enhance Response cache-control header
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ính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- api, documentation
Hướng nghiên cứu
Bắt đầu bằng cách xem xét OpenAPI Header Object, hỗ trợ JSON Schema và các ví dụ về Cache-Control trong issue này. Không có tệp repository hoặc bài kiểm thử nào được xác định; để hoàn thành, cần thống nhất và lập tài liệu về một cách chính xác, có khả năng tương tác lẫn nhau để biểu diễn các directive được phân tách bằng dấu phẩy và các directive khóa-giá trị như max-age.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have been trying to use Open API to specify the expected Cache rules for some API routes
While defining such rules through the Expires and/or Pragma headers can be quite simple (a date for Expires & the no-cache constant for Pragma), they are not the modern way to do it. Pragma is deprecated, and Expires is ignored when Cache-Control is defined.
Cache-Control is also nowadays supported by all clients making it the most obvious solution to define the caching rules.
Unfortunately, the current OPEN API Header Object support looks a bit limited for Cache-Control. Using pure JSON Schema definition might produce unexpected behavior without dedicated context for this header or for headers having similar Design.
This header value is defined as a comma-seperated list of properties called directives
If all directives were simple strings I could write something like that if I allowed any of them (or restrict to the on I accept by design)
responses:
200:
description: "The request was successfully treated."
headers:
Cache-Control:
schema:
type: array
items:
type: string
enum:
- public
- private
- no-cache
- no-store
- must-revalidate
- proxy-revalidate
- immutable
- no-transform
- only-if-cached
If I want my route to prevent response to be cached I can easily design it a more simple way
Cache-Control:
schema:
type: string
enum:
- no-store
Or with the last JSON-Schema edition support of constants
Cache-Control:
schema:
const: "no-store"
But some of the most important cache control properties are key value pairs like max-age=300
I tried to express it the most reiable still simple way using adavanced JSON Schema feature unfortunately not really well supported (yet?) by Open API implementations
Sample 1
- Pro:
- shortest
- Cons:
- forbid different property order
- forbid potentially acceptable other cache-control properties
- not really the most inspectable
Cache-Control:
schema:
const: "public, max-age=300"
Sample 2
- Pro:
- still short
- Cons:
- ⚠️❌ the specification doesn't say how to serialize the object
Cache-Control:
schema:
const: ["public", {"max-age": 300}]
Sample 3
- Pro:
- explicit, no need for const support
- Cons:
- very verbose
- pretty sure enum not well supported for numbers
- ⚠️❌ the specification still doesn't say how to serialize the object
Cache-Control:
schema:
type: array
items:
allOf:
- type: string
enum:
- public
- type: object
properties:
max-age:
type: number
enum:
- 300
required:
- max-age
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 OAI/OpenAPI-Specification
-
Housekeeping
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 45/100
OAI/OpenAPI-Specification#5566 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Housekeeping
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
OAI/OpenAPI-Specification#5562 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Housekeeping
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
OAI/OpenAPI-Specification#5556 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v3.2.1 releaseCó thể làm lại được @lornajane đã nhận 32 ngày trước và không có pull request nào đang mở. Đang mở
OAI/OpenAPI-Specification#5460 · 11 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
param serialization
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OAI/OpenAPI-Specification#5366 · 12 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OAI/OpenAPI-Specification
Issue tương tự
-
status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
a2ui-project/a2ui#3158 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SocialGouv/iterion#2369 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Consolidate the now-identical CLI-native and composed tasks_packages guards (#5945 follow-up)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
spec-kitty/spec-kitty#6112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: OpenRouter streaming chunks report the requested router name instead of the model OpenRouter servedCó thể đã có người làm @Mrun25 đã nhận hôm nay. Đang mởbug llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
BerriAI/litellm#46095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
uberdeveloper/fastbt#29 ·