-
Notifications
You must be signed in to change notification settings - Fork 2
/
.spectral.js
88 lines (87 loc) · 2.97 KB
/
.spectral.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const ibmCloudValidationRules = require('@ibm-cloud/openapi-ruleset');
const { enumCasingConvention, pathSegmentCasingConvention } = require('@ibm-cloud/openapi-ruleset/src/functions');
const { operations, paths, schemas } = require('@ibm-cloud/openapi-ruleset-utilities/src/collections');
module.exports = {
extends: ibmCloudValidationRules,
rules: {
// In json-schema enum is used for any kind of "one of this string values"
// situations, which is not limited to verbatim rust enum variant names.
// Additionally linter overrides only work for types defined in the root
// document. So we can't declare exceptions for the cases where it's not
// a verbatim rust enum variant name.
'ibm-enum-casing-convention': "off",
'ibm-operationid-casing-convention': {
description: 'Operation ids must be pascal case',
message: '{{error}}',
resolved: true,
given: operations,
severity: 'error',
then: {
function: enumCasingConvention,
functionOptions: {
type: 'pascal',
},
},
},
'ibm-path-segment-casing-convention': {
description: 'Path segments must be snake case',
message: '{{error}}',
resolved: true,
given: paths,
severity: 'error',
then: {
function: pathSegmentCasingConvention,
functionOptions: {
type: 'snake',
separator: {
char: '_',
allowLeading: true
}
},
},
},
'ibm-major-version-in-path': 'off',
'ibm-schema-description': 'off',
// spectral has its own rules to check schemas that support v3.1
'ibm-schema-type-format': 'off',
'ibm-avoid-inline-schemas': 'off',
'ibm-property-description': 'off',
'oas3-api-servers': 'off',
'ibm-no-body-for-delete': 'off',
'ibm-summary-sentence-style': 'off',
'ibm-collection-array-property': 'off',
// the rule set wants to enforce a specific error schema
'ibm-error-response-schemas': 'off',
'ibm-patch-request-content-type': 'off',
},
overrides: [
{
files: [
"web-api/openapi/back_office.yaml#/components/schemas/DocumentCandidatesRequest",
"web-api/openapi/back_office.yaml#/components/schemas/DocumentCandidatesResponse",
"web-api/openapi/schemas/document.yml#/DocumentPropertyArrayString",
],
rules: {
"ibm-array-attributes": "off",
},
},
{
files: [
"web-api/openapi/front_office.yaml#/components/schemas/FilterCompare/additionalProperties/properties",
"web-api/openapi/front_office.yaml#/components/schemas/FilterCombine/properties",
"web-api/openapi/front_office.yaml#/components/schemas/FilterIds/properties",
],
rules: {
"ibm-property-casing-convention": "off",
},
},
{
files: [
"web-api/openapi/front_office.yaml#/components/schemas/FilterCombine/properties",
],
rules: {
"ibm-no-circular-refs": "off",
},
},
],
};