Skip to content

Commit

Permalink
Added rule to make every header should be explicit in defining whethe…
Browse files Browse the repository at this point in the history
…r it is required (#20)
  • Loading branch information
jpolavar authored Nov 25, 2024
1 parent f281ad8 commit 6c788b8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 21.x]
node-version: [20.x, 22.x, 23.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -35,7 +35,7 @@ jobs:
name: Branch Build
strategy:
matrix:
node-version: [20.x, 21.x]
node-version: [20.x, 22.x, 23.x]
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@checkdigit/spectral-config",
"version": "2.1.0",
"version": "2.1.1",
"description": "Check Digit Spectral Config",
"main": "ruleset.json",
"private": false,
"prettier": "@checkdigit/prettier-config",
"engines": {
"node": ">=20.11"
"node": ">=20.17"
},
"files": [
"ruleset.json"
Expand Down
13 changes: 12 additions & 1 deletion ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
"oas2-operation-security-defined": "error",
"oas2-schema": "error",
"oas2-unused-definition": "error",
"oas2-valid-media-example": "error"
"oas2-valid-media-example": "error",

"header-required-property": {
"description": "All headers must explicitly define whether they are required.",
"message": "Header is missing 'required' property.",
"severity": "error",
"given": "$.components.headers.*",
"then": {
"field": "required",
"function": "defined"
}
}
}
}
3 changes: 3 additions & 0 deletions test/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,20 @@ components:

headers:
ETag:
required: false
description: Version information for record
schema:
type: string

Created-On:
required: false
description: CreatedOn timestamp for the newly created record
schema:
type: string
format: date-time

Updated-On:
required: false
description: UpdatedOn timestamp for the existing record
schema:
type: string
Expand Down

0 comments on commit 6c788b8

Please sign in to comment.