Skip to content

Commit

Permalink
feat: removed parameters-not-in-body rule (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky authored Dec 19, 2024
1 parent 125d240 commit 54bc377
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 208 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-poems-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/openapi-core": patch
---

Updated Spot validation rules.
2 changes: 1 addition & 1 deletion docs/guides/lint-arazzo.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extends:

arazzoRules:
sourceDescription-name-unique: warn
version-enum: error
spot-supported-versions: error
```
The configuration shown here gives some good entry-level linting using the `minimal` standard, and adds checks that we're using a supported version of Arazzo, and warns if each source description doesn't have a unique name.
Expand Down
3 changes: 1 addition & 2 deletions docs/rules/built-in-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ Within the Arazzo family of rules, there are rules for the main Arazzo specifica
The below rules are being migrated to Spot:

- [no-criteria-xpath](./spot/no-criteria-xpath.md): the `xpath` type criteria is not supported by Spot.
- [parameters-not-in-body](./spot/parameters-not-in-body.md): the `in` section inside `parameters` must not contain a `body`.
- [version-enum](./spot/version-enum.md): the `version` property must be one of the supported values.
- [spot-supported-versions](./spot/spot-supported-versions.md): the `version` property must be one of the supported values.

## Resources

Expand Down
8 changes: 3 additions & 5 deletions docs/rules/ruleset-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,15 @@ rules:
```yaml
rules:
struct: error
parameters-not-in-body: off
sourceDescription-type: off
version-enum: warn
workflowId-unique: error
stepId-unique: error
sourceDescription-name-unique: off
workflow-dependsOn: off
parameters-unique: off
step-onSuccess-unique: off
step-onFailure-unique: off
spot-supported-versions: off
requestBody-replacements-unique: off
no-criteria-xpath: off
no-actions-type-end: off
Expand Down Expand Up @@ -491,18 +490,17 @@ rules:
```yaml
rules:
struct: error
parameters-not-in-body: warn
sourceDescription-type: error
version-enum: warn
workflowId-unique: error
stepId-unique: error
sourceDescription-name-unique: error
workflow-dependsOn: error
parameters-unique: error
step-onSuccess-unique: warn
step-onFailure-unique: warn
spot-supported-versions: off
requestBody-replacements-unique: warn
no-criteria-xpath: warn
no-criteria-xpath: off
no-actions-type-end: warn
criteria-unique: warn
```
Expand Down
29 changes: 14 additions & 15 deletions docs/rules/spec-ruleset.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ slug: /docs/cli/rules/spec
This ruleset strictly follows the specifications.
All the rules are of severity `error`:

- `struct`
- [struct](./arazzo/struct.md)
- [criteria-unique](./arazzo/criteria-unique.md)
- [sourceDescription-type](./arazzo/sourceDescriptions-type.md)
- [spot-supported-versions](./spot/spot-supported-versions.md)
- [workflowId-unique](./arazzo/workflowId-unique.md)
- [stepId-unique](./arazzo/stepId-unique.md)
- [sourceDescription-name-unique](./arazzo/sourceDescriptions-name-unique.md)
- [sourceDescriptions-not-empty](./arazzo/sourceDescriptions-not-empty.md)
- [workflow-dependsOn](./arazzo/workflow-dependsOn.md)
- [parameters-unique](./arazzo/parameters-unique.md)
- [step-onSuccess-unique](./arazzo/step-onSuccess-unique.md)
- [step-onFailure-unique](./arazzo/step-onFailure-unique.md)
- [requestBody-replacements-unique](./arazzo/requestBody-replacements-unique.md)
- [no-criteria-xpath](./spot/no-criteria-xpath.md)
- [criteria-unique](./arazzo/criteria-unique.md)
- `parameters-not-in-body`
- `sourceDescription-type`
- `version-enum`
- `workflowId-unique`
- `stepId-unique`
- `sourceDescription-name-unique`
- `sourceDescriptions-not-empty`
- `workflow-dependsOn`
- `parameters-unique`
- `step-onSuccess-unique`
- `step-onFailure-unique`
- `requestBody-replacements-unique`
- `no-criteria-xpath`
- `criteria-unique`
58 changes: 0 additions & 58 deletions docs/rules/spot/parameters-not-in-body.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version-enum
# spot-supported-versions

The `version` property must be one of the supported values.

Expand All @@ -21,7 +21,7 @@ An example configuration:

```yaml
arazzoRules:
version-enum: error
spot-supported-versions: error
```
## Examples
Expand All @@ -30,7 +30,7 @@ Given the following configuration:
```yaml
arazzoRules:
version-enum: error
spot-supported-versions: error
```
Example of a **correct** entry:
Expand All @@ -41,8 +41,8 @@ arazzo: 1.0.0
## Related rules
- [parameters-not-in-body](./parameters-not-in-body.md)
- [no-criteria-xpath](./no-criteria-xpath.md)
## Resources
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/spot/version-enum.ts)
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/spot/spot-supported-versions.ts)
3 changes: 1 addition & 2 deletions docs/sidebars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@
- page: rules/async/no-channel-trailing-slash.md
- separator: Arazzo
- page: rules/spot/no-criteria-xpath.md
- page: rules/spot/version-enum.md
- page: rules/spot/parameters-not-in-body.md
- page: rules/spot/spot-supported-versions.md
- page: rules/arazzo/criteria-unique.md
- page: rules/arazzo/parameters-unique.md
- page: rules/arazzo/requestBody-replacements-unique.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
"arazzo1Preprocessors": {},
"arazzo1Rules": {
"criteria-unique": "warn",
"no-criteria-xpath": "warn",
"parameters-not-in-body": "warn",
"no-criteria-xpath": "off",
"parameters-unique": "error",
"requestBody-replacements-unique": "warn",
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spot-supported-versions": "off",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
"version-enum": "warn",
"workflow-dependsOn": "error",
"workflowId-unique": "error",
},
Expand Down Expand Up @@ -233,17 +232,16 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
"arazzo1Preprocessors": {},
"arazzo1Rules": {
"criteria-unique": "warn",
"no-criteria-xpath": "warn",
"parameters-not-in-body": "warn",
"no-criteria-xpath": "off",
"parameters-unique": "error",
"requestBody-replacements-unique": "warn",
"sourceDescription-name-unique": "error",
"sourceDescription-type": "error",
"sourceDescriptions-not-empty": "error",
"spot-supported-versions": "off",
"step-onFailure-unique": "warn",
"step-onSuccess-unique": "warn",
"stepId-unique": "error",
"version-enum": "warn",
"workflow-dependsOn": "error",
"workflowId-unique": "error",
},
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/config/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
},
arazzo1Rules: {
'criteria-unique': 'error',
'no-criteria-xpath': 'error',
'parameters-not-in-body': 'error',
'no-criteria-xpath': 'off',
'parameters-unique': 'error',
'requestBody-replacements-unique': 'error',
'sourceDescription-type': 'error',
Expand All @@ -220,7 +219,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
'stepId-unique': 'error',
'sourceDescription-name-unique': 'error',
'sourceDescriptions-not-empty': 'error',
'version-enum': 'error',
'spot-supported-versions': 'off',
'workflowId-unique': 'error',
'workflow-dependsOn': 'error',
},
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/config/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
arazzo1Rules: {
'criteria-unique': 'off',
'no-criteria-xpath': 'off',
'parameters-not-in-body': 'off',
'parameters-unique': 'off',
'requestBody-replacements-unique': 'off',
'sourceDescription-type': 'off',
Expand All @@ -196,7 +195,7 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
'step-onFailure-unique': 'off',
'stepId-unique': 'error',
'sourceDescription-name-unique': 'off',
'version-enum': 'off',
'spot-supported-versions': 'off',
'workflowId-unique': 'error',
'workflow-dependsOn': 'off',
},
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/config/recommended-strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
},
arazzo1Rules: {
'criteria-unique': 'error',
'no-criteria-xpath': 'error',
'parameters-not-in-body': 'error',
'no-criteria-xpath': 'off',
'parameters-unique': 'error',
'requestBody-replacements-unique': 'error',
'sourceDescription-type': 'error',
Expand All @@ -196,7 +195,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
'stepId-unique': 'error',
'sourceDescription-name-unique': 'error',
'sourceDescriptions-not-empty': 'error',
'version-enum': 'error',
'spot-supported-versions': 'off',
'workflowId-unique': 'error',
'workflow-dependsOn': 'error',
},
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/config/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
},
arazzo1Rules: {
'criteria-unique': 'warn',
'no-criteria-xpath': 'warn',
'parameters-not-in-body': 'warn',
'no-criteria-xpath': 'off',
'parameters-unique': 'error',
'requestBody-replacements-unique': 'warn',
'sourceDescription-type': 'error',
Expand All @@ -196,7 +195,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
'stepId-unique': 'error',
'sourceDescription-name-unique': 'error',
'sourceDescriptions-not-empty': 'error',
'version-enum': 'warn',
'spot-supported-versions': 'off',
'workflowId-unique': 'error',
'workflow-dependsOn': 'error',
},
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/config/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ const spec: PluginStyleguideConfig<'built-in'> = {
async2Rules: {},
async3Rules: {},
arazzo1Rules: {
'parameters-not-in-body': 'error',
'sourceDescription-type': 'error',
'version-enum': 'error',
'spot-supported-versions': 'off',
'workflowId-unique': 'error',
'stepId-unique': 'error',
'sourceDescription-name-unique': 'error',
Expand All @@ -23,7 +22,7 @@ const spec: PluginStyleguideConfig<'built-in'> = {
'step-onSuccess-unique': 'error',
'step-onFailure-unique': 'error',
'requestBody-replacements-unique': 'error',
'no-criteria-xpath': 'error',
'no-criteria-xpath': 'off',
'criteria-unique': 'error',
},
};
Expand Down
Loading

1 comment on commit 54bc377

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.6% 5043/6416
🟡 Branches 67.21% 2052/3053
🟡 Functions 73.11% 832/1138
🟡 Lines 78.89% 4757/6030

Test suite run success

832 tests passing in 120 suites.

Report generated by 🧪jest coverage report action from 54bc377

Please sign in to comment.