Enhance Response cache-control header
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Área
- api, documentation
Línea de trabajo
Empieza revisando OpenAPI Header Object, la compatibilidad con JSON Schema y los ejemplos de Cache-Control de este issue. No se han identificado archivos del repositorio ni pruebas; completar el trabajo requeriría acordar y documentar una forma precisa e interoperable de representar directivas separadas por comas y directivas de clave-valor como max-age.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Markdown
- Estrellas
- 31.2k
- Forks
- 9.2k
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 17
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OAI/OpenAPI-Specification
-
Housekeeping
Dificultad 1/5 Menos de una hora Aptitud para principiantes 45/100
OAI/OpenAPI-Specification#5566 ·
Los mantenedores suelen responder en 1 día
-
Housekeeping
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
OAI/OpenAPI-Specification#5562 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Housekeeping
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
OAI/OpenAPI-Specification#5556 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
v3.2.1 releaseQuizá libre de nuevo @lornajane la tomó hace 31 días y no hay ningún pull request abierto. Abierto
OAI/OpenAPI-Specification#5460 · 11 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
param serialization
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
OAI/OpenAPI-Specification#5366 · 12 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de OAI/OpenAPI-Specification
Issues similares
-
A numeric literal is parsed in the host's culture, so 1.5 is 15 in a made EXE on a comma-decimal OSAbiertobug interpreter silently-wrong small
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
[Analytics] Add Focus Time-Block Efficiency Ratio Calculator in src/lib/focus/efficiency-ratio.tsAbiertoanalytics beginner friendly community contributions-welcome enhancement good first issue hacktoberfest help wanted up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
slackapi/node-slack-sdk#2766 ·
Los mantenedores suelen responder en 1 día
-
comp/gateway comp/plugins duplicate P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NousResearch/hermes-agent#137019 ·
Los mantenedores suelen responder en 1 día
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security updatePosiblemente ocupada @muscariello la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100