Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Created May 17, 2020 10:16
Show Gist options
  • Save philsturgeon/8c1aab93e211fdbebaaface5d6bc5d0f to your computer and use it in GitHub Desktop.
Save philsturgeon/8c1aab93e211fdbebaaface5d6bc5d0f to your computer and use it in GitHub Desktop.
cache control rule
rules:
cache-control-undocumented:
description: |-
Cache usage MUST be extensively detailed in the `description` property
to avoid data leaks or the usage of stale data.
This rule should ensure in some way that the api provider
documented extensively the cache usage to avoid data leaks
or usage of stale data.
For now this just tests the presence of `max-age` but that's
only a placeholder. Hints welcome.
message: >-
Cache usage MUST be documented: {{error}}
formats:
- oas3
severity: error
given: >-
$..[parameters].[?(@.name=="cache-control" || @.name=="Cache-Control")]
then:
- field: description
function: pattern
functionOptions:
match: >-
max-age.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment