Enhance Response cache-control header #2784
Labels
headers
http
Supporting HTTP features and interactions
param serialization
Issues related to parameter and/or header serialization
Milestone
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/orPragma
headers can be quite simple (a date forExpires
& theno-cache
constant forPragma
), they are not the modern way to do it.Pragma
is deprecated, andExpires
is ignored whenCache-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 forCache-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)
If I want my route to prevent response to be cached I can easily design it a more simple way
Or with the last JSON-Schema edition support of constants
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
Sample 2
Sample 3
The text was updated successfully, but these errors were encountered: