@checkdigit/spectral-config 4.0.0-PR.24-4dc5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +4 -11
- package/package.json +45 -1
- package/ruleset.json +7 -20
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -55,17 +55,10 @@ Install Spectral, by Spotlight https://marketplace.visualstudio.com/items?itemNa
|
|
|
55
55
|
|
|
56
56
|
### Rules for Certain Warnings and Errors
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
`operation-operationId Operation must have "operationId"`
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
Add an operationId to the operation. Check Digit uses a `noun-noun-verb` naming convention. For example, the correct operationId for a `PUT` to path `/resource/{id}/item/{itemId}/key` is `resource-item-key-put`
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
The use of `operationId` requires manual effort and can lead to inconsistencies and maintenance challenges. By disallowing `operationId`, we automatically maintain a consistent naming convention, since our code generation tool chain relies on paths and HTTP methods for operation identification.
|
|
62
|
+
## License
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- Remove any `operationId` fields.
|
|
68
|
-
- References to the previously generated Koa router Context typings:
|
|
69
|
-
- Update the OpenAPI-related code generation dependencies, and update the npm script `prepare` according to the coding standards to activate Koa router typing support.
|
|
70
|
-
- With Koa router typing support enabled, the typing references should now be able to be removed from the router implementation.
|
|
71
|
-
- Just in case the types need to be used elsewhere, they'll follow the `${Path}${Method}` pattern in PascalCase. For example, `PUT /account/{accountId}` will translate to AccountPutContext.
|
|
64
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1 +1,45 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@checkdigit/spectral-config",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Check Digit Spectral Config",
|
|
6
|
+
"homepage": "https://github.com/checkdigit/spectral-config#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/checkdigit/spectral-config/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/checkdigit/spectral-config.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Check Digit, LLC",
|
|
16
|
+
"main": "ruleset.json",
|
|
17
|
+
"files": [
|
|
18
|
+
"ruleset.json"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"ci:compile": "",
|
|
22
|
+
"ci:coverage": "",
|
|
23
|
+
"ci:lint": "npm run lint",
|
|
24
|
+
"ci:style": "npm run prettier",
|
|
25
|
+
"ci:test": "spectral lint test/openapi.yml --ruleset test/.spectral.json",
|
|
26
|
+
"lint": "",
|
|
27
|
+
"lint:fix": "",
|
|
28
|
+
"prettier": "prettier . --check",
|
|
29
|
+
"prettier:fix": "prettier . --write",
|
|
30
|
+
"test": "npm run ci:compile && npm run ci:test && npm run ci:style && npm run ci:lint"
|
|
31
|
+
},
|
|
32
|
+
"prettier": "@checkdigit/prettier-config",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@checkdigit/prettier-config": "^8.1.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@stoplight/spectral-cli": "6.16.3"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=24.18.0"
|
|
41
|
+
},
|
|
42
|
+
"allowScripts": {
|
|
43
|
+
"@scarf/scarf@1.4.0": false
|
|
44
|
+
}
|
|
45
|
+
}
|
package/ruleset.json
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
"extends": ["spectral:oas"],
|
|
3
3
|
"rules": {
|
|
4
4
|
"no-$ref-siblings": "off",
|
|
5
|
+
|
|
5
6
|
"info-contact": "error",
|
|
6
7
|
"info-description": "error",
|
|
7
8
|
"duplicated-entry-in-enum": "error",
|
|
8
9
|
"operation-success-response": "error",
|
|
10
|
+
"operation-operationId-unique": "error",
|
|
9
11
|
"operation-tag-defined": "error",
|
|
10
12
|
"no-eval-in-markdown": "error",
|
|
11
13
|
"no-script-tags-in-markdown": "error",
|
|
12
14
|
"operation-description": "error",
|
|
15
|
+
"operation-operationId": "error",
|
|
16
|
+
"operation-operationId-valid-in-url": "error",
|
|
13
17
|
"operation-tags": "error",
|
|
14
18
|
"path-declarations-must-exist": "error",
|
|
15
19
|
"path-keys-no-trailing-slash": "error",
|
|
@@ -20,8 +24,10 @@
|
|
|
20
24
|
"oas3-operation-security-defined": "error",
|
|
21
25
|
"oas3-server-trailing-slash": "error",
|
|
22
26
|
"oas3-unused-component": "error",
|
|
27
|
+
|
|
23
28
|
"oas2-api-host": "off",
|
|
24
29
|
"oas2-api-schemes": "off",
|
|
30
|
+
|
|
25
31
|
"oas2-anyOf": "error",
|
|
26
32
|
"oas2-discriminator": "error",
|
|
27
33
|
"oas2-host-trailing-slash": "error",
|
|
@@ -31,6 +37,7 @@
|
|
|
31
37
|
"oas2-schema": "error",
|
|
32
38
|
"oas2-unused-definition": "error",
|
|
33
39
|
"oas2-valid-media-example": "error",
|
|
40
|
+
|
|
34
41
|
"header-required-property": {
|
|
35
42
|
"description": "All headers must explicitly define whether they are required.",
|
|
36
43
|
"message": "Header is missing 'required' property.",
|
|
@@ -40,26 +47,6 @@
|
|
|
40
47
|
"field": "required",
|
|
41
48
|
"function": "defined"
|
|
42
49
|
}
|
|
43
|
-
},
|
|
44
|
-
"operation-operationId": "off",
|
|
45
|
-
"operation-operationId-unique": "off",
|
|
46
|
-
"operation-operationId-valid-in-url": "off",
|
|
47
|
-
"no-operationId-allowed": {
|
|
48
|
-
"description": "operationId is not allowed in our API style.",
|
|
49
|
-
"message": "Remove `operationId` from operations.",
|
|
50
|
-
"severity": "error",
|
|
51
|
-
"given": "$.paths[*][*]",
|
|
52
|
-
"then": {
|
|
53
|
-
"function": "schema",
|
|
54
|
-
"functionOptions": {
|
|
55
|
-
"schema": {
|
|
56
|
-
"type": "object",
|
|
57
|
-
"not": {
|
|
58
|
-
"required": ["operationId"]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
52
|
}
|