Skip to content

Commit c040303

Browse files
committed
chore: changes after review
1 parent 094ff83 commit c040303

File tree

8 files changed

+95
-82
lines changed

8 files changed

+95
-82
lines changed

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ rules:
13211321

13221322
### Features
13231323

1324-
- Added five new built-in rules:
1324+
- Added four new built-in rules:
13251325
- [path-excludes-patterns](./rules/oas/path-excludes-patterns.md)
13261326
- [no-http-verbs-in-paths](./rules/oas/no-http-verbs-in-paths.md)
13271327
- [request-mime-type](./rules/oas/request-mime-type.md)

docs/rules/built-in-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Details of all the rules available "out of the box" with Redocly CLI are listed
2222
- [no-unresolved-refs](./oas/no-unresolved-refs.md): Every `$ref` must exist
2323
- [no-unused-components](./oas/no-unused-components.md): All components must be used
2424
- [security-defined](./oas/security-defined.md): Security rules must be defined, either globally or per-operation
25-
- [spec](./spec.md): Conform to the declared OpenAPI specification version
25+
- [struct](./oas/struct.md): Conform to the declared OpenAPI specification version
2626
- [spec-components-invalid-map-name](./oas/spec-components-invalid-map-name.md): Use only alphanumeric and basic punctuation as key names in the components section
2727
- [spec-strict-refs](./oas/spec-strict-refs.md) Restricts the usage of the `$ref` keyword.
2828

docs/rules/minimal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Errors:
1111
- [no-server-trailing-slash](./oas/no-server-trailing-slash.md)
1212
- [no-server-variables-empty-enum](./oas/no-server-variables-empty-enum.md)
1313
- [no-unresolved-refs](./oas/no-unresolved-refs.md)
14-
- [spec](./spec.md)
14+
- [struct](./oas/struct.md)
1515

1616
Warnings:
1717

docs/rules/oas/struct.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
slug: /docs/cli/rules/oas/struct
3+
---
4+
5+
# struct
6+
7+
Ensures that your API document conforms to the [OpenAPI specification](https://spec.openapis.org/oas/v3.1.0.html).
8+
9+
| OAS | Compatibility |
10+
| --- | ------------- |
11+
| 2.0 ||
12+
| 3.0 ||
13+
| 3.1 ||
14+
15+
The default setting for this rule (in the `recommended` and `minimal` configuration) is `error`.
16+
17+
This is an essential rule that should not be turned off except in rare and special cases.
18+
19+
## API design principles
20+
21+
It's important to conform to the specification so that tools work with your API document. Doing so makes writing and maintenance of API descriptions easier.
22+
23+
## Configuration
24+
25+
| Option | Type | Description |
26+
| -------- | ------ | ------------------------------------------------------------------------------------------ |
27+
| severity | string | Possible values: `off`, `warn`, `error`. Default `error` (in `recommended` configuration). |
28+
29+
An example configuration:
30+
31+
```yaml
32+
rules:
33+
struct: error
34+
```
35+
36+
## Examples
37+
38+
Given this configuration:
39+
40+
```yaml
41+
rules:
42+
struct: error
43+
```
44+
45+
Example of an **incorrect** struct:
46+
47+
```yaml
48+
openapi: 3.0.0
49+
info:
50+
version: 1.0.0
51+
paths: {}
52+
```
53+
54+
Example of a **correct** struct:
55+
56+
```yaml
57+
openapi: 3.0.0
58+
info:
59+
title: Ultra API
60+
version: 1.0.0
61+
paths: {}
62+
```
63+
64+
## Related rules
65+
66+
- [configurable rules](./configurable-rules.md)
67+
68+
## Resources
69+
70+
- [OpenAPI docs](https://redocly.com/docs/openapi-visual-reference/)

docs/rules/recommended.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Errors:
2626
- [path-parameters-defined](./oas/path-parameters-defined.md)
2727
- [security-defined](./oas/security-defined.md)
2828
- [spec-components-invalid-map-name](./oas/spec-components-invalid-map-name.md)
29-
- [spec](./spec.md)
29+
- [struct](./oas/struct.md)
3030

3131
Warnings:
3232

docs/rules/spec.md

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,12 @@
22
slug: /docs/cli/rules/spec
33
---
44

5-
# spec
5+
# Recommended ruleset
66

7-
Ensures that your API document conforms to the [OpenAPI specification](https://spec.openapis.org/oas/v3.1.0.html).
7+
These are the rules in the `spec` set, grouped by their severity.
88

9-
| OAS | Compatibility |
10-
| --- | ------------- |
11-
| 2.0 ||
12-
| 3.0 ||
13-
| 3.1 ||
9+
## Arazzo1Rules
1410

15-
The default setting for this rule (in the `recommended` and `minimal` configuration) is `error`.
11+
Errors:
1612

17-
This is an essential rule that should not be turned off except in rare and special cases.
18-
19-
## API design principles
20-
21-
It's important to conform to the specification so that tools work with your API document. Doing so makes writing and maintenance of API descriptions easier.
22-
23-
## Configuration
24-
25-
| Option | Type | Description |
26-
| -------- | ------ | ------------------------------------------------------------------------------------------ |
27-
| severity | string | Possible values: `off`, `warn`, `error`. Default `error` (in `recommended` configuration). |
28-
29-
An example configuration:
30-
31-
```yaml
32-
rules:
33-
spec: error
34-
```
35-
36-
## Examples
37-
38-
Given this configuration:
39-
40-
```yaml
41-
rules:
42-
spec: error
43-
```
44-
45-
Example of an **incorrect** spec:
46-
47-
```yaml
48-
openapi: 3.0.0
49-
info:
50-
version: 1.0.0
51-
paths: {}
52-
```
53-
54-
Example of a **correct** spec:
55-
56-
```yaml
57-
openapi: 3.0.0
58-
info:
59-
title: Ultra API
60-
version: 1.0.0
61-
paths: {}
62-
```
63-
64-
## Related rules
65-
66-
- [configurable rules](./configurable-rules.md)
67-
68-
## Resources
69-
70-
- [Rule source](https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/common/spec.ts)
71-
- [OpenAPI docs](https://redocly.com/docs/openapi-visual-reference/)
13+
- [criteria-unique](./arazzo/criteria-unique.md)

packages/core/src/config/spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const spec: PluginStyleguideConfig<'built-in'> = {
44
rules: {
55
struct: 'error',
66
},
7+
// TODO: populate with spec-related rules similar to `arazzo1Rules`
78
oas2Rules: {},
89
oas3_0Rules: {},
910
oas3_1Rules: {},

packages/core/src/rules/arazzo/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ import type { Arazzo1RuleSet } from '../../oas-types';
2222
export const rules: Arazzo1RuleSet<'built-in'> = {
2323
struct: Struct as Arazzo1Rule,
2424
assertions: Assertions as Arazzo1Rule,
25-
'parameters-not-in-body': ParametersNotInBody as Arazzo1Rule,
26-
'sourceDescription-type': SourceDescriptionType as Arazzo1Rule,
27-
'version-enum': VersionEnum as Arazzo1Rule,
28-
'workflowId-unique': WorkflowIdUnique as Arazzo1Rule,
29-
'stepId-unique': StepIdUnique as Arazzo1Rule,
30-
'sourceDescription-name-unique': SourceDescriptionsNameUnique as Arazzo1Rule,
31-
'sourceDescriptions-not-empty': SourceDescriptionsNotEmpty as Arazzo1Rule,
32-
'workflow-dependsOn': WorkflowDependsOn as Arazzo1Rule,
33-
'parameters-unique': ParametersUnique as Arazzo1Rule,
34-
'step-onSuccess-unique': StepOnSuccessUnique as Arazzo1Rule,
35-
'step-onFailure-unique': StepOnFailureUnique as Arazzo1Rule,
36-
'requestBody-replacements-unique': RequestBodyReplacementsUnique as Arazzo1Rule,
37-
'no-criteria-xpath': NoCriteriaXpath as Arazzo1Rule,
38-
'no-actions-type-end': NoActionsTypeEnd as Arazzo1Rule,
39-
'criteria-unique': CriteriaUnique as Arazzo1Rule,
25+
'parameters-not-in-body': ParametersNotInBody,
26+
'sourceDescription-type': SourceDescriptionType,
27+
'version-enum': VersionEnum,
28+
'workflowId-unique': WorkflowIdUnique,
29+
'stepId-unique': StepIdUnique,
30+
'sourceDescription-name-unique': SourceDescriptionsNameUnique,
31+
'sourceDescriptions-not-empty': SourceDescriptionsNotEmpty,
32+
'workflow-dependsOn': WorkflowDependsOn,
33+
'parameters-unique': ParametersUnique,
34+
'step-onSuccess-unique': StepOnSuccessUnique,
35+
'step-onFailure-unique': StepOnFailureUnique,
36+
'requestBody-replacements-unique': RequestBodyReplacementsUnique,
37+
'no-criteria-xpath': NoCriteriaXpath,
38+
'no-actions-type-end': NoActionsTypeEnd,
39+
'criteria-unique': CriteriaUnique,
4040
};
4141

4242
export const preprocessors = {};

0 commit comments

Comments
 (0)