Skip to content

Commit 506eec0

Browse files
author
Sophia Marie Terry
committed
Alter name to 'ignorePluralizationList' and add documentation
1 parent dd8b404 commit 506eec0

15 files changed

+87
-25
lines changed

tools/spectral/ipa/rulesets/IPA-104.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,17 @@ rules:
108108
Rule checks for the following conditions:
109109
- Applies only to GET methods on single resources or singleton resources
110110
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
111+
112+
##### Configuration
113+
This rule includes two configuration options:
114+
- `methodName`: The verb to be used in the OperationIds
115+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
111116
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-104-valid-operation-id'
112117
severity: warn
113118
given: '#GetOperationObject'
114119
then:
115120
function: 'IPA104ValidOperationID'
116121
functionOptions:
117122
methodName: 'get'
118-
ignoreList:
123+
ignorePluralizationList:
119124
- 'Fts'

tools/spectral/ipa/rulesets/IPA-105.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,17 @@ rules:
8888
- Applies only to GET methods on resource collection paths
8989
- Ignores singleton resources
9090
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
91+
92+
##### Configuration
93+
This rule includes two configuration options:
94+
- `methodName`: The verb to be used in the OperationIds
95+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
9196
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-105-valid-operation-id'
9297
severity: warn
9398
given: '#GetOperationObject'
9499
then:
95100
function: 'IPA105ValidOperationID'
96101
functionOptions:
97102
methodName: 'list'
98-
ignoreList:
103+
ignorePluralizationList:
99104
- 'Fts'

tools/spectral/ipa/rulesets/IPA-106.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,17 @@ rules:
122122
Rule checks for the following conditions:
123123
- Applies only to POST methods that are not [custom methods](https://mongodb.github.io/ipa/109)
124124
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
125+
126+
##### Configuration
127+
This rule includes two configuration options:
128+
- `methodName`: The verb to be used in the OperationIds
129+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
125130
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-valid-operation-id'
126131
severity: warn
127132
given: '#CreateOperationObject'
128133
then:
129134
function: 'IPA106ValidOperationID'
130135
functionOptions:
131136
methodName: 'create'
132-
ignoreList:
137+
ignorePluralizationList:
133138
- 'Fts'

tools/spectral/ipa/rulesets/IPA-107.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,17 @@ rules:
123123
Rule checks for the following conditions:
124124
- Applies only to PUT/PATCH methods that are not [custom methods](https://mongodb.github.io/ipa/109)
125125
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
126+
127+
##### Configuration
128+
This rule includes two configuration options:
129+
- `methodName`: The verb to be used in the OperationIds
130+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
126131
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-107-valid-operation-id'
127132
severity: warn
128133
given: '#UpdateOperationObject'
129134
then:
130135
function: 'IPA107ValidOperationID'
131136
functionOptions:
132137
methodName: 'update'
133-
ignoreList:
138+
ignorePluralizationList:
134139
- 'Fts'

tools/spectral/ipa/rulesets/IPA-108.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,18 @@ rules:
6464
Rule checks for the following conditions:
6565
- Applies only to DELETE methods that are not [custom methods](https://mongodb.github.io/ipa/109)
6666
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
67+
##### Configuration
68+
This rule includes two configuration options:
69+
- `methodName`: The verb to be used in the OperationIds
70+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
6771
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-108-valid-operation-id'
6872
severity: warn
6973
given: '#DeleteOperationObject'
7074
then:
7175
function: 'IPA108ValidOperationID'
7276
functionOptions:
7377
methodName: 'delete'
74-
ignoreList:
78+
ignorePluralizationList:
7579
- 'Fts'
7680

7781
functions:

tools/spectral/ipa/rulesets/IPA-109.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ rules:
7070
Rule checks for the following conditions:
7171
- Applies only to paths containing custom method identifiers (with colon format)
7272
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
73+
74+
##### Configuration
75+
This rule includes one configuration options:
76+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
7377
message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-109-valid-operation-id'
7478
severity: warn
7579
given: '$.paths[*][*]'
7680
then:
7781
function: 'IPA109ValidOperationID'
7882
functionOptions:
79-
ignoreList:
83+
ignorePluralizationList:
8084
- 'Fts'

tools/spectral/ipa/rulesets/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ Rule checks for the following conditions:
154154
- Applies only to GET methods on single resources or singleton resources
155155
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
156156

157+
##### Configuration
158+
This rule includes two configuration options:
159+
- `methodName`: The verb to be used in the OperationIds
160+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
161+
157162

158163

159164
### IPA-105
@@ -220,6 +225,11 @@ Rule checks for the following conditions:
220225
- Ignores singleton resources
221226
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
222227

228+
##### Configuration
229+
This rule includes two configuration options:
230+
- `methodName`: The verb to be used in the OperationIds
231+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
232+
223233

224234

225235
### IPA-106
@@ -311,6 +321,11 @@ Rule checks for the following conditions:
311321
- Applies only to POST methods that are not [custom methods](https://mongodb.github.io/ipa/109)
312322
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
313323

324+
##### Configuration
325+
This rule includes two configuration options:
326+
- `methodName`: The verb to be used in the OperationIds
327+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
328+
314329

315330

316331
### IPA-107
@@ -394,6 +409,11 @@ Rule checks for the following conditions:
394409
- Applies only to PUT/PATCH methods that are not [custom methods](https://mongodb.github.io/ipa/109)
395410
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
396411

412+
##### Configuration
413+
This rule includes two configuration options:
414+
- `methodName`: The verb to be used in the OperationIds
415+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
416+
397417

398418

399419
### IPA-108
@@ -448,6 +468,10 @@ The noun(s) in the Operation ID should be the collection identifiers from the re
448468
Rule checks for the following conditions:
449469
- Applies only to DELETE methods that are not [custom methods](https://mongodb.github.io/ipa/109)
450470
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
471+
##### Configuration
472+
This rule includes two configuration options:
473+
- `methodName`: The verb to be used in the OperationIds
474+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
451475

452476

453477

@@ -509,6 +533,10 @@ Rule checks for the following conditions:
509533
- Applies only to paths containing custom method identifiers (with colon format)
510534
- Confirms that the existing OperationId is compliant with generated IPA Compliant OperationId
511535

536+
##### Configuration
537+
This rule includes one configuration options:
538+
- `ignorePluralizationList`: Words that are allowed to maintain their assumed plurality (e.g., "Fts")
539+
512540

513541

514542
### IPA-110

tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate
66

77
const RULE_NAME = 'xgen-IPA-104-valid-operation-id';
88

9-
export default (input, { methodName, ignoreList }, { path, documentInventory }) => {
9+
export default (input, { methodName, ignorePluralizationList }, { path, documentInventory }) => {
1010
const resourcePath = path[1];
1111
const oas = documentInventory.resolved;
1212
const resourcePaths = getResourcePathItems(resourcePath, oas.paths);
@@ -23,7 +23,7 @@ export default (input, { methodName, ignoreList }, { path, documentInventory })
2323
if (hasMethodVerbOverride(input, methodName)) {
2424
methodName = input[VERB_OVERRIDE_EXTENSION].verb;
2525
}
26-
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList);
26+
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList);
2727

2828
return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path);
2929
} catch (e) {

tools/spectral/ipa/rulesets/functions/IPA105ValidOperationID.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate
66

77
const RULE_NAME = 'xgen-IPA-105-valid-operation-id';
88

9-
export default (input, { methodName, ignoreList }, { path, documentInventory }) => {
9+
export default (input, { methodName, ignorePluralizationList }, { path, documentInventory }) => {
1010
const resourcePath = path[1];
1111
const oas = documentInventory.resolved;
1212
const resourcePaths = getResourcePathItems(resourcePath, oas.paths);
@@ -24,7 +24,7 @@ export default (input, { methodName, ignoreList }, { path, documentInventory })
2424
}
2525

2626
try {
27-
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList);
27+
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList);
2828
return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path);
2929
} catch (e) {
3030
return handleInternalError(RULE_NAME, path, e);

tools/spectral/ipa/rulesets/functions/IPA106ValidOperationID.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { validateOperationIdAndReturnErrors } from './utils/validations/validate
55

66
const RULE_NAME = 'xgen-IPA-106-valid-operation-id';
77

8-
export default (input, { methodName, ignoreList }, { path }) => {
8+
export default (input, { methodName, ignorePluralizationList }, { path }) => {
99
const resourcePath = path[1];
1010

1111
if (hasCustomMethodOverride(input) || isCustomMethodIdentifier(resourcePath)) {
@@ -17,7 +17,7 @@ export default (input, { methodName, ignoreList }, { path }) => {
1717
}
1818

1919
try {
20-
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignoreList);
20+
const errors = validateOperationIdAndReturnErrors(methodName, resourcePath, input, path, ignorePluralizationList);
2121
return evaluateAndCollectAdoptionStatus(errors, RULE_NAME, input, path);
2222
} catch (e) {
2323
return handleInternalError(RULE_NAME, path, e);

0 commit comments

Comments
 (0)